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

Commit 50bf59ca authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Allow controlling SystemUI flags during RecentsAnimation

Such that the bars can flip from light/dark depending on animation
progress.

Test: go/wm-smoke
Test: Swipe up from light bar app
Test: WindowStateTests
Bug: 73498721
Change-Id: Ie4b99c75840474a01225720fcd7372191f035a3e
parent f0927b07
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -51,4 +51,12 @@ interface IRecentsAnimationController {
     * and then enable it mid-animation to start receiving touch events.
     */
    void setInputConsumerEnabled(boolean enabled);

    /**
    * Informs the system whether the animation targets passed into
    * IRecentsAnimationRunner.onAnimationStart are currently behind the system bars. If they are,
    * they can control the SystemUI flags, otherwise the SystemUI flags from home activity will be
    * taken.
    */
    void setAnimationTargetsBehindSystemBars(boolean behindSystemBars);
}
+8 −0
Original line number Diff line number Diff line
@@ -51,6 +51,14 @@ public class RecentsAnimationControllerCompat {
        }
    }

    public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
        try {
            mAnimationController.setAnimationTargetsBehindSystemBars(behindSystemBars);
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to set whether animation targets are behind system bars", e);
        }
    }

    public void finish(boolean toHome) {
        try {
            mAnimationController.finish(toHome);
+17 −0
Original line number Diff line number Diff line
@@ -135,6 +135,22 @@ public class RecentsAnimationController {
            }
        }

        @Override
        public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars)
                throws RemoteException {
            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
                        mPendingAnimations.get(i).mTask.setCanAffectSystemUiFlags(behindSystemBars);
                    }
                    mService.mWindowPlacerLocked.requestTraversal();
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void setInputConsumerEnabled(boolean enabled) {
            if (DEBUG) Log.d(TAG, "setInputConsumerEnabled(" + enabled + "): mCanceled="
@@ -279,6 +295,7 @@ public class RecentsAnimationController {
                + mPendingAnimations.size());
        for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
            final TaskAnimationAdapter adapter = mPendingAnimations.get(i);
            adapter.mTask.setCanAffectSystemUiFlags(true);
            adapter.mCapturedFinishCallback.onAnimationFinished(adapter);
        }
        mPendingAnimations.clear();
+18 −0
Original line number Diff line number Diff line
@@ -96,6 +96,9 @@ class Task extends WindowContainer<AppWindowToken> {
    private Dimmer mDimmer = new Dimmer(this);
    private final Rect mTmpDimBoundsRect = new Rect();

    /** @see #setCanAffectSystemUiFlags */
    private boolean mCanAffectSystemUiFlags = true;

    Task(int taskId, TaskStack stack, int userId, WindowManagerService service, int resizeMode,
            boolean supportsPictureInPicture, TaskDescription taskDescription,
            TaskWindowContainerController controller) {
@@ -627,6 +630,21 @@ class Task extends WindowContainer<AppWindowToken> {
        callback.accept(this);
    }

    /**
     * @param canAffectSystemUiFlags If false, all windows in this task can not affect SystemUI
     *                               flags. See {@link WindowState#canAffectSystemUiFlags()}.
     */
    void setCanAffectSystemUiFlags(boolean canAffectSystemUiFlags) {
        mCanAffectSystemUiFlags = canAffectSystemUiFlags;
    }

    /**
     * @see #setCanAffectSystemUiFlags
     */
    boolean canAffectSystemUiFlags() {
        return mCanAffectSystemUiFlags;
    }

    @Override
    public String toString() {
        return "{taskId=" + mTaskId + " appTokens=" + mChildren + " mdr=" + mDeferRemoval + "}";
+3 −1
Original line number Diff line number Diff line
@@ -1569,7 +1569,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            final boolean exiting = mAnimatingExit || mDestroying;
            return shown && !exiting;
        } else {
            return !mAppToken.isHidden();
            final Task task = getTask();
            final boolean canFromTask = task != null && task.canAffectSystemUiFlags();
            return canFromTask && !mAppToken.isHidden();
        }
    }

Loading