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

Commit d854d917 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow controlling SystemUI flags during RecentsAnimation" into pi-dev

parents 0db87b19 50bf59ca
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
@@ -140,6 +140,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="
@@ -289,6 +305,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
@@ -1573,7 +1573,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