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

Commit 92b15a07 authored by Vlad Popa's avatar Vlad Popa
Browse files

Revert "Remove flag for keyguard remote animations [1/n]"

Revert submission 19658837

Reason for revert: DroidMonitor-triggered revert due to breakage b/243379321
Reverted Changes:
I2f672fb6d:Remove flag for keyguard remote animations [1/n]
Ib103172b7:Remove flag for keyguard remote animations [2/n]

Bug: 243379321

Change-Id: Ia53ce4d2f5a76424a6143dfcbd913635a10761bc
parent a707bb95
Loading
Loading
Loading
Loading
+30 −41
Original line number Diff line number Diff line
@@ -2085,28 +2085,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
                    boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
                    long statusBarAnimationDuration) {
                // When remote animation is enabled for keyguard transition, SysUI receives
                // IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
                // need to call IKeyguardService#keyguardGoingAway and #setOccluded.
                final boolean notifyOccluded =
                        !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
                        && keyguardOccluding;
                final boolean startKeyguardExitAnimation =
                        !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation
                        && keyguardGoingAway;
                return handleTransitionForKeyguardLw(startKeyguardExitAnimation,
                        notifyOccluded, duration);
                // When remote animation is enabled for KEYGUARD_GOING_AWAY transition, SysUI
                // receives IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
                // need to call IKeyguardService#keyguardGoingAway here.
                return handleStartTransitionForKeyguardLw(keyguardGoingAway
                        && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation,
                        keyguardOccluding, duration);
            }

            @Override
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
                    boolean keyguardOccludedCancelled) {
                // When app KEYGUARD_GOING_AWAY or (UN)OCCLUDE app transition is canceled, we need
                // to trigger relevant IKeyguardService calls to sync keyguard status in
                // WindowManagerService and SysUI.
                handleTransitionForKeyguardLw(
                        keyguardGoingAwayCancelled /* startKeyguardExitAnimation */,
                        keyguardOccludedCancelled /* notifyOccluded */, 0 /* duration */);
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
                handleStartTransitionForKeyguardLw(
                        keyguardGoingAway, false /* keyguardOccludingStarted */,
                        0 /* duration */);
            }
        });

@@ -3272,38 +3263,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mPendingKeyguardOccluded = occluded;
            mKeyguardOccludedChanged = true;
        } else {
            setKeyguardOccludedLw(occluded, true /* notify */);
            setKeyguardOccludedLw(occluded, false /* force */,
                    false /* transitionStarted */);
        }
    }

    @Override
    public int applyKeyguardOcclusionChange(boolean notify) {
    public int applyKeyguardOcclusionChange(boolean transitionStarted) {
        if (mKeyguardOccludedChanged) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
                    + mPendingKeyguardOccluded);
            if (setKeyguardOccludedLw(mPendingKeyguardOccluded, notify)) {
            if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */,
                    transitionStarted)) {
                return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
            }
        }
        return 0;
    }

    /**
     * Called when keyguard related app transition starts, or cancelled.
     *
     * @param startKeyguardExitAnimation Trigger IKeyguardService#startKeyguardExitAnimation to
     *                                  start keyguard exit animation.
     * @param notifyOccluded Trigger IKeyguardService#setOccluded binder call to notify whether
     *                      the top activity can occlude the keyguard or not.
     * @param duration the duration of the exit animation, in milliseconds.
     *
     * @return Whether the flags have changed and we have to redo the layout.
     */
    private int handleTransitionForKeyguardLw(boolean startKeyguardExitAnimation,
            boolean notifyOccluded, long duration) {
        final int redoLayout = applyKeyguardOcclusionChange(notifyOccluded);
    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway,
            boolean keyguardOccluding, long duration) {
        final int redoLayout = applyKeyguardOcclusionChange(keyguardOccluding);
        if (redoLayout != 0) return redoLayout;
        if (startKeyguardExitAnimation) {
        if (keyguardGoingAway) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
        }
@@ -3537,19 +3519,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     * Updates the occluded state of the Keyguard.
     *
     * @param isOccluded Whether the Keyguard is occluded by another window.
     * @param notify Notify keyguard occlude status change immediately via
     *       {@link com.android.internal.policy.IKeyguardService}.
     * @param force notify the occluded status to KeyguardService and update flags even though
     *             occlude status doesn't change.
     * @param transitionStarted {@code true} if keyguard (un)occluded transition started.
     * @return Whether the flags have changed and we have to redo the layout.
     */
    private boolean setKeyguardOccludedLw(boolean isOccluded, boolean notify) {
    private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force,
            boolean transitionStarted) {
        if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
        mKeyguardOccludedChanged = false;
        if (isKeyguardOccluded() == isOccluded) {
        if (isKeyguardOccluded() == isOccluded && !force) {
            return false;
        }

        final boolean showing = mKeyguardDelegate.isShowing();
        final boolean animate = showing && !isOccluded;
        // When remote animation is enabled for keyguard (un)occlude transition, KeyguardService
        // uses remote animation start as a signal to update its occlusion status ,so we don't need
        // to notify here.
        final boolean notify = !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
                || !transitionStarted;
        mKeyguardDelegate.setOccluded(isOccluded, animate, notify);
        return showing;
    }
+3 −3
Original line number Diff line number Diff line
@@ -171,10 +171,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
    void onKeyguardOccludedChangedLw(boolean occluded);

    /**
     * @param notify {@code true} if the status change should be immediately notified via
     *        {@link com.android.internal.policy.IKeyguardService}
     * Applies a keyguard occlusion change if one happened.
     * @param transitionStarted Whether keyguard (un)occlude transition is starting or not.
     */
    int applyKeyguardOcclusionChange(boolean notify);
    int applyKeyguardOcclusionChange(boolean transitionStarted);

    /**
     * Interface to the Window Manager state associated with a particular
+4 −9
Original line number Diff line number Diff line
@@ -416,11 +416,8 @@ public class AppTransition implements Dump {
    }

    void freeze() {
        final boolean keyguardGoingAwayCancelled = mNextAppTransitionRequests.contains(
        final boolean keyguardGoingAway = mNextAppTransitionRequests.contains(
                TRANSIT_KEYGUARD_GOING_AWAY);
        final boolean keyguardOccludedCancelled =
                mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_OCCLUDE)
                || mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE);

        // The RemoteAnimationControl didn't register AppTransitionListener and
        // only initialized the finish and timeout callback when goodToGo().
@@ -432,7 +429,7 @@ public class AppTransition implements Dump {
        mNextAppTransitionRequests.clear();
        clear();
        setReady();
        notifyAppTransitionCancelledLocked(keyguardGoingAwayCancelled, keyguardOccludedCancelled);
        notifyAppTransitionCancelledLocked(keyguardGoingAway);
    }

    private void setAppTransitionState(int state) {
@@ -482,11 +479,9 @@ public class AppTransition implements Dump {
        }
    }

    private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
            boolean keyguardOccludedCancelled) {
    private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAway) {
        for (int i = 0; i < mListeners.size(); i++) {
            mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAwayCancelled,
                    keyguardOccludedCancelled);
            mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAway);
        }
    }

+1 −2
Original line number Diff line number Diff line
@@ -6602,8 +6602,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }

        @Override
        public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
                boolean keyguardOccludedCancelled) {
        public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
            // It is only needed when freezing display in legacy transition.
            if (mTransitionController.isShellTransitionsEnabled()) return;
            continueUpdateOrientationForDiffOrienLaunchingApp();
+1 −2
Original line number Diff line number Diff line
@@ -616,8 +616,7 @@ public class DisplayPolicy {
            }

            @Override
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
                    boolean keyguardOccludedCancelled) {
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
                mHandler.post(mAppTransitionCancelled);
            }

Loading