diff options
11 files changed, 47 insertions, 70 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index b1eeef2c26c8..5816e984704e 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -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; } diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index c4713efa8926..e8a3dcd5635f 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); /** - * @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 diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index efffd62a5ed0..55d6b2fe8226 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -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); } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 767df6d60b3b..fccf54d83198 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -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(); diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 23b03e06e18a..07694065cbd7 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -616,8 +616,7 @@ public class DisplayPolicy { } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, - boolean keyguardOccludedCancelled) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { 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 1404f2f49767..5b702eac7059 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -169,8 +169,7 @@ public class RecentsAnimationController implements DeathRecipient { } @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, - boolean keyguardOccludedCancelled) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { continueDeferredCancel(); } diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 6ee9999f77e2..bbc95a1dd70f 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( - false /* notify */); + true /* keyguardOccludingStarted */); } } diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 3c6d6dcae60e..4f324f22aa5e 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 /* keyguardGoingAwayCancelled */, false /* keyguardOccludedCancelled */); + false /* keyguardGoingAway */); } } diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index a3245e0a1a5c..da5f5d0e29fd 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -219,13 +219,10 @@ public abstract class WindowManagerInternal { /** * Called when a pending app transition gets cancelled. - * @param keyguardGoingAwayCancelled {@code true} if keyguard going away transition was - * cancelled. - * @param keyguardOccludedCancelled {@code true} if keyguard (un)occluded transition was - * cancelled. + * + * @param keyguardGoingAway true if keyguard going away transition got cancelled. */ - public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, - boolean keyguardOccludedCancelled) {} + public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {} /** * 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 31adbc2028df..fd54f78b22fe 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1117,8 +1117,7 @@ public class WindowManagerService extends IWindowManager.Stub = new WindowManagerInternal.AppTransitionListener() { @Override - public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled, - boolean keyguardOccludedCancelled) { + public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { } @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 2d921cfa2003..851be9d77348 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 notify) { + public int applyKeyguardOcclusionChange(boolean keyguardOccludingStarted) { return 0; } |