diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 51bf557599622..7dcfd8bd446ba 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2082,21 +2082,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWindowManagerInternal.registerAppTransitionListener(new AppTransitionListener() { @Override - public int onAppTransitionStartingLocked(long statusBarAnimationStartTime, + public int onAppTransitionStartingLocked(boolean keyguardGoingAway, + boolean keyguardOccluding, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration) { - return handleTransitionForKeyguardLw(false /* startKeyguardExitAnimation */, - false /* notifyOccluded */); + // 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 */); + public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) { + handleStartTransitionForKeyguardLw( + keyguardGoingAway, false /* keyguardOccludingStarted */, + 0 /* duration */); } }); @@ -3262,39 +3263,31 @@ 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. - * - * @return Whether the flags have changed and we have to redo the layout. - */ - private int handleTransitionForKeyguardLw(boolean startKeyguardExitAnimation, - boolean notifyOccluded) { - 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()); + startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration); } return 0; } @@ -3526,18 +3519,28 @@ 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; } - mKeyguardDelegate.setOccluded(isOccluded, notify); - return mKeyguardDelegate.isShowing(); + + 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; } /** {@inheritDoc} */ @@ -4933,10 +4936,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { } @Override - public void startKeyguardExitAnimation(long startTime) { + public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) { if (mKeyguardDelegate != null) { if (DEBUG_KEYGUARD) Slog.d(TAG, "PWM.startKeyguardExitAnimation"); - mKeyguardDelegate.startKeyguardExitAnimation(startTime); + mKeyguardDelegate.startKeyguardExitAnimation(startTime, fadeoutDuration); } } diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index 2b04050733230..4f00992c713e2 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 @@ -1129,10 +1129,11 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { /** * Notifies the keyguard to start fading out. - * @param startTime the start time of the animation in uptime milliseconds * + * @param startTime the start time of the animation in uptime milliseconds + * @param fadeoutDuration the duration of the exit animation, in milliseconds */ - void startKeyguardExitAnimation(long startTime); + void startKeyguardExitAnimation(long startTime, long fadeoutDuration); /** * Called when System UI has been started. diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java index 7737421654ee2..b79ac6f68be20 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java @@ -249,10 +249,10 @@ public class KeyguardServiceDelegate { } } - public void setOccluded(boolean isOccluded, boolean notify) { + public void setOccluded(boolean isOccluded, boolean animate, boolean notify) { if (mKeyguardService != null && notify) { - if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ")"); - mKeyguardService.setOccluded(isOccluded, false /* animate */); + if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate); + mKeyguardService.setOccluded(isOccluded, animate); } mKeyguardState.occluded = isOccluded; } @@ -394,9 +394,9 @@ public class KeyguardServiceDelegate { } } - public void startKeyguardExitAnimation(long startTime) { + public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) { if (mKeyguardService != null) { - mKeyguardService.startKeyguardExitAnimation(startTime, 0); + mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration); } } diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index 95169dbd70920..55d6b2fe82269 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -375,6 +375,9 @@ public class AppTransition implements Dump { final AnimationAdapter topOpeningAnim = wc != null ? wc.getAnimation() : null; int redoLayout = notifyAppTransitionStartingLocked( + AppTransition.isKeyguardGoingAwayTransitOld(transit), + AppTransition.isKeyguardOccludeTransitOld(transit), + topOpeningAnim != null ? topOpeningAnim.getDurationHint() : 0, topOpeningAnim != null ? topOpeningAnim.getStatusBarTransitionsStartTime() : SystemClock.uptimeMillis(), @@ -413,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(). @@ -429,7 +429,7 @@ public class AppTransition implements Dump { mNextAppTransitionRequests.clear(); clear(); setReady(); - notifyAppTransitionCancelledLocked(keyguardGoingAwayCancelled, keyguardOccludedCancelled); + notifyAppTransitionCancelledLocked(keyguardGoingAway); } private void setAppTransitionState(int state) { @@ -479,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); } } @@ -493,12 +491,14 @@ public class AppTransition implements Dump { } } - private int notifyAppTransitionStartingLocked(long statusBarAnimationStartTime, + private int notifyAppTransitionStartingLocked(boolean keyguardGoingAway, + boolean keyguardOcclude, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration) { int redoLayout = 0; for (int i = 0; i < mListeners.size(); i++) { - redoLayout |= mListeners.get(i).onAppTransitionStartingLocked( - statusBarAnimationStartTime, statusBarAnimationDuration); + redoLayout |= mListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway, + keyguardOcclude, duration, statusBarAnimationStartTime, + statusBarAnimationDuration); } return redoLayout; } diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 4b0005d77e40d..44f388b6ed39f 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -20,6 +20,10 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; @@ -91,6 +95,7 @@ import android.view.WindowManager.LayoutParams; import android.view.WindowManager.TransitionFlags; import android.view.WindowManager.TransitionOldType; import android.view.WindowManager.TransitionType; +import android.view.animation.Animation; import android.window.ITaskFragmentOrganizer; import com.android.internal.annotations.VisibleForTesting; @@ -292,6 +297,7 @@ public class AppTransitionController { final int flags = appTransition.getTransitFlags(); layoutRedo = appTransition.goodToGo(transit, topOpeningApp); + handleNonAppWindowsInTransition(transit, flags); appTransition.postAnimationCallback(); appTransition.clear(); } finally { @@ -1165,6 +1171,30 @@ public class AppTransitionController { } } + private void handleNonAppWindowsInTransition(@TransitionOldType int transit, int flags) { + if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY + && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) { + if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) { + Animation anim = mService.mPolicy.createKeyguardWallpaperExit( + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); + if (anim != null) { + anim.scaleCurrentDuration(mService.getTransitionAnimationScaleLocked()); + mDisplayContent.mWallpaperController.startWallpaperAnimation(anim); + } + } + } + if ((transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY + || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER) + && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) { + mDisplayContent.startKeyguardExitOnNonAppWindows( + transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER, + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0, + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0); + } + } + private boolean transitionGoodToGo(ArraySet apps, ArrayMap outReasons) { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index c6fa4c1874be3..8a34af3b01079 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -6598,8 +6598,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 2d05f07f31c48..1a34c93f2ad69 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -602,8 +602,9 @@ public class DisplayPolicy { } @Override - public int onAppTransitionStartingLocked(long statusBarAnimationStartTime, - long statusBarAnimationDuration) { + public int onAppTransitionStartingLocked(boolean keyguardGoingAway, + boolean keyguardOccluding, long duration, + long statusBarAnimationStartTime, long statusBarAnimationDuration) { mHandler.post(() -> { StatusBarManagerInternal statusBar = getStatusBarManagerInternal(); if (statusBar != null) { @@ -615,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 db79eae1d80c5..5b702eac70590 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -161,15 +161,15 @@ public class RecentsAnimationController implements DeathRecipient { */ final AppTransitionListener mAppTransitionListener = new AppTransitionListener() { @Override - public int onAppTransitionStartingLocked(long statusBarAnimationStartTime, + public int onAppTransitionStartingLocked(boolean keyguardGoingAway, + boolean keyguardOccluding, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration) { continueDeferredCancel(); return 0; } @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 6e0d411caca43..803890b4032dd 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -31,7 +31,13 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; +import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; @@ -66,6 +72,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.IRemoteCallback; import android.os.RemoteException; +import android.os.SystemClock; import android.os.Trace; import android.util.ArrayMap; import android.util.ArraySet; @@ -73,6 +80,7 @@ import android.util.Slog; import android.util.SparseArray; import android.view.SurfaceControl; import android.view.WindowManager; +import android.view.animation.Animation; import android.window.RemoteTransition; import android.window.TransitionInfo; @@ -1058,9 +1066,36 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe private void handleNonAppWindowsInTransition(@NonNull DisplayContent dc, @TransitionType int transit, @TransitionFlags int flags) { + if ((transit == TRANSIT_KEYGUARD_GOING_AWAY + || (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0) + && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) { + if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) { + Animation anim = mController.mAtm.mWindowManager.mPolicy + .createKeyguardWallpaperExit( + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); + if (anim != null) { + anim.scaleCurrentDuration( + mController.mAtm.mWindowManager.getTransitionAnimationScaleLocked()); + dc.mWallpaperController.startWallpaperAnimation(anim); + } + } + dc.startKeyguardExitOnNonAppWindows( + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0, + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0, + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0); + if (!WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) { + // 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. + mController.mAtm.mWindowManager.mPolicy.startKeyguardExitAnimation( + SystemClock.uptimeMillis(), 0 /* duration */); + } + } 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 010c509ddd8a4..846aa3e3739a1 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -637,9 +637,11 @@ class TransitionController { } void dispatchLegacyAppTransitionStarting(TransitionInfo info, long statusBarTransitionDelay) { + final boolean keyguardGoingAway = info.isKeyguardGoingAway(); for (int i = 0; i < mLegacyListeners.size(); ++i) { // TODO(shell-transitions): handle (un)occlude transition. - mLegacyListeners.get(i).onAppTransitionStartingLocked( + mLegacyListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway, + false /* keyguardOcclude */, 0 /* durationHint */, SystemClock.uptimeMillis() + statusBarTransitionDelay, AnimationAdapter.STATUS_BAR_TRANSITION_DURATION); } @@ -654,7 +656,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 4b5b6dad4fc42..a71c3866ba381 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -220,13 +220,9 @@ 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. @@ -236,6 +232,9 @@ public abstract class WindowManagerInternal { /** * Called when an app transition gets started * + * @param keyguardGoingAway true if keyguard going away transition is started. + * @param keyguardOccluding true if keyguard (un)occlude transition is started. + * @param duration the total duration of the transition * @param statusBarAnimationStartTime the desired start time for all visual animations in * the status bar caused by this app transition in uptime millis * @param statusBarAnimationDuration the duration for all visual animations in the status @@ -246,7 +245,8 @@ public abstract class WindowManagerInternal { * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER}, * or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}. */ - public int onAppTransitionStartingLocked(long statusBarAnimationStartTime, + public int onAppTransitionStartingLocked(boolean keyguardGoingAway, + boolean keyguardOccluding, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration) { return 0; } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 298f93d75e7a9..22411bb068a03 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -424,6 +424,32 @@ public class WindowManagerService extends IWindowManager.Stub public static final boolean sEnableShellTransitions = SystemProperties.getBoolean(ENABLE_SHELL_TRANSITIONS, false); + /** + * Run Keyguard animation as remote animation in System UI instead of local animation in + * the server process. + * + * 0: Runs all keyguard animation as local animation + * 1: Only runs keyguard going away animation as remote animation + * 2: Runs all keyguard animation as remote animation + */ + private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY = + "persist.wm.enable_remote_keyguard_animation"; + + private static final int sEnableRemoteKeyguardAnimation = + SystemProperties.getInt(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, 2); + + /** + * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY + */ + public static final boolean sEnableRemoteKeyguardGoingAwayAnimation = + sEnableRemoteKeyguardAnimation >= 1; + + /** + * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY + */ + public static final boolean sEnableRemoteKeyguardOccludeAnimation = + sEnableRemoteKeyguardAnimation >= 2; + /** * Allows a fullscreen windowing mode activity to launch in its desired orientation directly * when the display has different orientation. @@ -1092,8 +1118,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/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index 88e58eab58aa1..8546763aebecf 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -281,7 +281,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { verify(mMockRunner).onAnimationCanceled(null /* taskIds */, null /* taskSnapshots */); // Simulate the app transition finishing - mController.mAppTransitionListener.onAppTransitionStartingLocked(0, 0); + mController.mAppTransitionListener.onAppTransitionStartingLocked(false, false, 0, 0, 0); verify(mAnimationCallbacks).onAnimationFinished(REORDER_KEEP_IN_PLACE, false); } 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 13da1543cfb83..d2cb7ba5d3111 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java @@ -310,11 +310,11 @@ class TestWindowManagerPolicy implements WindowManagerPolicy { } @Override - public void startKeyguardExitAnimation(long startTime) { + public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) { } @Override - public int applyKeyguardOcclusionChange(boolean notify) { + public int applyKeyguardOcclusionChange(boolean keyguardOccludingStarted) { return 0; }