Merge "Mirror task visibility on task org leash" into rvc-dev am: 1298d2b760
Change-Id: Icbc53a4b5e4b0f63fcf01c8dd5fc8511add40c89
This commit is contained in:
@@ -27,7 +27,8 @@ import android.window.WindowContainerToken;
|
|||||||
oneway interface ITaskOrganizer {
|
oneway interface ITaskOrganizer {
|
||||||
/**
|
/**
|
||||||
* A callback when the Task is available for the registered organizer. The client is responsible
|
* 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 taskInfo The information about the Task that's available
|
||||||
* @param leash A persistent leash for this Task.
|
* @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
|
@BinderThread
|
||||||
public void onTaskAppeared(@NonNull ActivityManager.RunningTaskInfo taskInfo,
|
public void onTaskAppeared(@NonNull ActivityManager.RunningTaskInfo taskInfo,
|
||||||
@NonNull SurfaceControl leash) {}
|
@NonNull SurfaceControl leash) {}
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
final SurfaceControl.Transaction tx =
|
final SurfaceControl.Transaction tx =
|
||||||
mSurfaceControlTransactionFactory.getTransaction();
|
mSurfaceControlTransactionFactory.getTransaction();
|
||||||
tx.setAlpha(mLeash, 0f);
|
tx.setAlpha(mLeash, 0f);
|
||||||
|
tx.show(mLeash);
|
||||||
tx.apply();
|
tx.apply();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,11 +98,14 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
|
|||||||
final ITaskOrganizer mTaskOrganizer;
|
final ITaskOrganizer mTaskOrganizer;
|
||||||
final Consumer<Runnable> mDeferTaskOrgCallbacksConsumer;
|
final Consumer<Runnable> mDeferTaskOrgCallbacksConsumer;
|
||||||
|
|
||||||
|
private final SurfaceControl.Transaction mTransaction;
|
||||||
|
|
||||||
TaskOrganizerCallbacks(WindowManagerService wm, ITaskOrganizer taskOrg,
|
TaskOrganizerCallbacks(WindowManagerService wm, ITaskOrganizer taskOrg,
|
||||||
Consumer<Runnable> deferTaskOrgCallbacksConsumer) {
|
Consumer<Runnable> deferTaskOrgCallbacksConsumer) {
|
||||||
mService = wm;
|
mService = wm;
|
||||||
mDeferTaskOrgCallbacksConsumer = deferTaskOrgCallbacksConsumer;
|
mDeferTaskOrgCallbacksConsumer = deferTaskOrgCallbacksConsumer;
|
||||||
mTaskOrganizer = taskOrg;
|
mTaskOrganizer = taskOrg;
|
||||||
|
mTransaction = wm.mTransactionFactory.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinder getBinder() {
|
IBinder getBinder() {
|
||||||
@@ -110,10 +113,17 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onTaskAppeared(Task task) {
|
void onTaskAppeared(Task task) {
|
||||||
|
final boolean visible = task.isVisible();
|
||||||
final RunningTaskInfo taskInfo = task.getTaskInfo();
|
final RunningTaskInfo taskInfo = task.getTaskInfo();
|
||||||
mDeferTaskOrgCallbacksConsumer.accept(() -> {
|
mDeferTaskOrgCallbacksConsumer.accept(() -> {
|
||||||
try {
|
try {
|
||||||
SurfaceControl outSurfaceControl = new SurfaceControl(task.getSurfaceControl());
|
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);
|
mTaskOrganizer.onTaskAppeared(taskInfo, outSurfaceControl);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Exception sending onTaskAppeared callback", e);
|
Slog.e(TAG, "Exception sending onTaskAppeared callback", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user