Merge "Mirror task visibility on task org leash" into rvc-dev am: 1298d2b760 am: 376ac8a830
Change-Id: If996f8c95293c33a2bbe1e2f5215d2a9efbd0fb9
This commit is contained in:
@@ -27,7 +27,8 @@ import android.window.WindowContainerToken;
|
||||
oneway interface ITaskOrganizer {
|
||||
/**
|
||||
* A callback when the Task is available for the registered organizer. The client is responsible
|
||||
* for releasing the SurfaceControl in the callback.
|
||||
* for releasing the SurfaceControl in the callback. For non-root tasks, the leash may initially
|
||||
* be hidden so it is up to the organizer to show this task.
|
||||
*
|
||||
* @param taskInfo The information about the Task that's available
|
||||
* @param leash A persistent leash for this Task.
|
||||
|
||||
@@ -59,6 +59,11 @@ public class TaskOrganizer extends WindowOrganizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a task with the registered windowing mode can be controlled by this task
|
||||
* organizer. For non-root tasks, the leash may initially be hidden so it is up to the organizer
|
||||
* to show this task.
|
||||
*/
|
||||
@BinderThread
|
||||
public void onTaskAppeared(@NonNull ActivityManager.RunningTaskInfo taskInfo,
|
||||
@NonNull SurfaceControl leash) {}
|
||||
|
||||
@@ -340,6 +340,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
||||
final SurfaceControl.Transaction tx =
|
||||
mSurfaceControlTransactionFactory.getTransaction();
|
||||
tx.setAlpha(mLeash, 0f);
|
||||
tx.show(mLeash);
|
||||
tx.apply();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,11 +98,14 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
|
||||
final ITaskOrganizer mTaskOrganizer;
|
||||
final Consumer<Runnable> mDeferTaskOrgCallbacksConsumer;
|
||||
|
||||
private final SurfaceControl.Transaction mTransaction;
|
||||
|
||||
TaskOrganizerCallbacks(WindowManagerService wm, ITaskOrganizer taskOrg,
|
||||
Consumer<Runnable> deferTaskOrgCallbacksConsumer) {
|
||||
mService = wm;
|
||||
mDeferTaskOrgCallbacksConsumer = deferTaskOrgCallbacksConsumer;
|
||||
mTaskOrganizer = taskOrg;
|
||||
mTransaction = wm.mTransactionFactory.get();
|
||||
}
|
||||
|
||||
IBinder getBinder() {
|
||||
@@ -110,10 +113,17 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
|
||||
}
|
||||
|
||||
void onTaskAppeared(Task task) {
|
||||
final boolean visible = task.isVisible();
|
||||
final RunningTaskInfo taskInfo = task.getTaskInfo();
|
||||
mDeferTaskOrgCallbacksConsumer.accept(() -> {
|
||||
try {
|
||||
SurfaceControl outSurfaceControl = new SurfaceControl(task.getSurfaceControl());
|
||||
if (!task.mCreatedByOrganizer && !visible) {
|
||||
// To prevent flashes, we hide the task prior to sending the leash to the
|
||||
// task org if the task has previously hidden (ie. when entering PIP)
|
||||
mTransaction.hide(outSurfaceControl);
|
||||
mTransaction.apply();
|
||||
}
|
||||
mTaskOrganizer.onTaskAppeared(taskInfo, outSurfaceControl);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Exception sending onTaskAppeared callback", e);
|
||||
|
||||
Reference in New Issue
Block a user