Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1298d2b7 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Mirror task visibility on task org leash" into rvc-dev

parents 200e84a8 14a657c9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.
+5 −0
Original line number Diff line number Diff line
@@ -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) {}
+1 −0
Original line number Diff line number Diff line
@@ -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;
        }
+10 −0
Original line number Diff line number Diff line
@@ -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);