Merge "Allow checking if an activity is organized" into sc-v2-dev am: 2176d951d0 am: 732d80927d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16186763 Change-Id: Ia7c9abe2ee40f3ddaa0d078148bb8d3a32297d3e
This commit is contained in:
@@ -44,4 +44,10 @@ interface ITaskFragmentOrganizerController {
|
||||
* Unregisters remote animations per transition type for the organizer.
|
||||
*/
|
||||
void unregisterRemoteAnimations(in ITaskFragmentOrganizer organizer);
|
||||
|
||||
/**
|
||||
* Checks if an activity organized by a {@link android.window.TaskFragmentOrganizer} and
|
||||
* only occupies a portion of Task bounds.
|
||||
*/
|
||||
boolean isActivityEmbedded(in IBinder activityToken);
|
||||
}
|
||||
|
||||
@@ -216,4 +216,17 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an activity organized by a {@link android.window.TaskFragmentOrganizer} and
|
||||
* only occupies a portion of Task bounds.
|
||||
* @hide
|
||||
*/
|
||||
public boolean isActivityEmbedded(@NonNull IBinder activityToken) {
|
||||
try {
|
||||
return getController().isActivityEmbedded(activityToken);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,4 +860,12 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
||||
launchingContainer.getTaskFragmentToken());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an activity is embedded and its presentation is customized by a
|
||||
* {@link android.window.TaskFragmentOrganizer} to only occupy a portion of Task bounds.
|
||||
*/
|
||||
public boolean isActivityEmbedded(@NonNull Activity activity) {
|
||||
return mPresenter.isActivityEmbedded(activity.getActivityToken());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -24,6 +24,7 @@ import static com.android.server.wm.WindowOrganizerController.configurationsAreE
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
@@ -579,4 +580,26 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr
|
||||
event.mException);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/204399167): change to push the embedded state to the client side
|
||||
@Override
|
||||
public boolean isActivityEmbedded(IBinder activityToken) {
|
||||
synchronized (mGlobalLock) {
|
||||
final ActivityRecord activity = ActivityRecord.forTokenLocked(activityToken);
|
||||
if (activity == null) {
|
||||
return false;
|
||||
}
|
||||
final TaskFragment taskFragment = activity.getOrganizedTaskFragment();
|
||||
if (taskFragment == null) {
|
||||
return false;
|
||||
}
|
||||
final Task parentTask = taskFragment.getTask();
|
||||
if (parentTask != null) {
|
||||
final Rect taskBounds = parentTask.getBounds();
|
||||
final Rect taskFragBounds = taskFragment.getBounds();
|
||||
return !taskBounds.equals(taskFragBounds) && taskBounds.contains(taskFragBounds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user