diff options
| author | 2022-08-17 12:01:08 +0000 | |
|---|---|---|
| committer | 2022-08-19 14:56:47 +0000 | |
| commit | f0f72bc73bee9d74a15a00a96b726dc7530e58e9 (patch) | |
| tree | a8df252408f0e6d8d9db617243d2d01da832f798 | |
| parent | cb2ec7b31dfb53ac70f189eb2db2aeef4c00e42f (diff) | |
Remove flag for keyguard remote animations [1/n]
Prepare for the removal.
Changed meaning of the parameters of handleStartTransitionForKeyguardLw()
They used to indicate if KEYGUARD_GOING_AWAY or (UN)OCCLUDE) transition
has just started. With this change, the arguments now specify if the
WindowManager immediately calls the old IKeyguardService API.
The argument "force" in PhoneWindowManager#setKeyguardOccludedLw() is
always false, so removed the argument.
onAppTransitionCancelledLocked() override in PhoneWindowManager always
triggered IKeyguardService#setOcclud, but we only need to trigger it
when (UN)OCCLUDE transition is canceled.
Bug: 242833285
Test: Pass existing tests.
Change-Id: I2f672fb6d13c99b68c20293d837f76d478fce4f9
11 files changed, 70 insertions, 47 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 5816e984704e..b1eeef2c26c8 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2085,19 +2085,28 @@ 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_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); + // 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); } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { - handleStartTransitionForKeyguardLw( - keyguardGoingAway, false /* keyguardOccludingStarted */, - 0 /* duration */); + 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 */); } }); @@ -3263,29 +3272,38 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPendingKeyguardOccluded = occluded; mKeyguardOccludedChanged = true; } else { - setKeyguardOccludedLw(occluded, false /* force */, - false /* transitionStarted */); + setKeyguardOccludedLw(occluded, true /* notify */); } } @Override - public int applyKeyguardOcclusionChange(boolean transitionStarted) { + public int applyKeyguardOcclusionChange(boolean notify) { if (mKeyguardOccludedChanged) { if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded=" + mPendingKeyguardOccluded); - if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */, - transitionStarted)) { + if (setKeyguardOccludedLw(mPendingKeyguardOccluded, notify)) { return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER; } } return 0; } - private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, - boolean keyguardOccluding, long duration) { - final int redoLayout = applyKeyguardOcclusionChange(keyguardOccluding); + /** + * 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); if (redoLayout != 0) return redoLayout; - if (keyguardGoingAway) { + if (startKeyguardExitAnimation) { if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation"); startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration); } @@ -3519,26 +3537,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { * Updates the occluded state of the Keyguard. * * @param isOccluded Whether the Keyguard is occluded by another window. - * @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. + * @param notify Notify keyguard occlude status change immediately via + * {@link com.android.internal.policy.IKeyguardService}. * @return Whether the flags have changed and we have to redo the layout. */ - private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force, - boolean transitionStarted) { + private boolean setKeyguardOccludedLw(boolean isOccluded, boolean notify) { if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded); mKeyguardOccludedChanged = false; - if (isKeyguardOccluded() == isOccluded && !force) { + if (isKeyguardOccluded() == isOccluded) { 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; } diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index e8a3dcd5635f..c4713efa8926 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -171,10 +171,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { void onKeyguardOccludedChangedLw(boolean occluded); /** - * Applies a keyguard occlusion change if one happened. - * @param transitionStarted Whether keyguard (un)occlude transition is starting or not. + * @param notify {@code true} if the status change should be immediately notified via + * {@link com.android.internal.policy.IKeyguardService} */ - int applyKeyguardOcclusionChange(boolean transitionStarted); + int applyKeyguardOcclusionChange(boolean notify); /** * Interface to the Window Manager state associated with a particular diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index 55d6b2fe8226..efffd62a5ed0 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -416,8 +416,11 @@ public class AppTransition implements Dump { } void freeze() { - final boolean keyguardGoingAway = mNextAppTransitionRequests.contains( + final boolean keyguardGoingAwayCancelled = 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(). @@ -429,7 +432,7 @@ public class AppTransition implements Dump { mNextAppTransitionRequests.clear(); clear(); setReady(); - notifyAppTransitionCancelledLocked(keyguardGoingAway); + notifyAppTransitionCancelledLocked(keyguardGoingAwayCancelled, keyguardOccludedCancelled); } private void setAppTransitionState(int state) { @@ -479,9 +482,11 @@ public class AppTransition implements Dump { } } - private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAway) { + private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) { for (int i = 0; i < mListeners.size(); i++) { - mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAway); + mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAwayCancelled, + keyguardOccludedCancelled); } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index fccf54d83198..767df6d60b3b 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -6602,7 +6602,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) { // It is only needed when freezing display in legacy transition. if (mTransitionController.isShellTransitionsEnabled()) return; continueUpdateOrientationForDiffOrienLaunchingApp(); diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 07694065cbd7..23b03e06e18a 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -616,7 +616,8 @@ public class DisplayPolicy { } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) { mHandler.post(mAppTransitionCancelled); } diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 5b702eac7059..1404f2f49767 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -169,7 +169,8 @@ public class RecentsAnimationController implements DeathRecipient { } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) { continueDeferredCancel(); } diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index bbc95a1dd70f..6ee9999f77e2 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1082,7 +1082,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } if ((flags & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) { mController.mAtm.mWindowManager.mPolicy.applyKeyguardOcclusionChange( - true /* keyguardOccludingStarted */); + false /* notify */); } } diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 4f324f22aa5e..3c6d6dcae60e 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -657,7 +657,7 @@ class TransitionController { void dispatchLegacyAppTransitionCancelled() { for (int i = 0; i < mLegacyListeners.size(); ++i) { mLegacyListeners.get(i).onAppTransitionCancelledLocked( - false /* keyguardGoingAway */); + false /* keyguardGoingAwayCancelled */, false /* keyguardOccludedCancelled */); } } diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index da5f5d0e29fd..a3245e0a1a5c 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -219,10 +219,13 @@ public abstract class WindowManagerInternal { /** * Called when a pending app transition gets cancelled. - * - * @param keyguardGoingAway true if keyguard going away transition got cancelled. + * @param keyguardGoingAwayCancelled {@code true} if keyguard going away transition was + * cancelled. + * @param keyguardOccludedCancelled {@code true} if keyguard (un)occluded transition was + * cancelled. */ - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {} + public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) {} /** * Called when an app transition is timed out. diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fd54f78b22fe..31adbc2028df 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1117,7 +1117,8 @@ public class WindowManagerService extends IWindowManager.Stub = new WindowManagerInternal.AppTransitionListener() { @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, + boolean keyguardOccludedCancelled) { } @Override diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java index 851be9d77348..2d921cfa2003 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java @@ -314,7 +314,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy { } @Override - public int applyKeyguardOcclusionChange(boolean keyguardOccludingStarted) { + public int applyKeyguardOcclusionChange(boolean notify) { return 0; } |