Loading packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +8 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.domain.interactor.KeyguardFaceAuthInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; Loading Loading @@ -126,6 +127,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard private final KeyguardFaceAuthInteractor mKeyguardFaceAuthInteractor; private final BouncerMessageInteractor mBouncerMessageInteractor; private int mTranslationY; private final KeyguardTransitionInteractor mKeyguardTransitionInteractor; // Whether the volume keys should be handled by keyguard. If true, then // they will be handled here for specific media types such as music, otherwise // the audio service will bring up the volume dialog. Loading Loading @@ -299,6 +301,10 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mViewMediatorCallback.keyguardDone(fromPrimaryAuth, targetUserId); } } if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mKeyguardTransitionInteractor.startDismissKeyguardTransition(); } } @Override Loading Loading @@ -424,6 +430,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard Provider<JavaAdapter> javaAdapter, UserInteractor userInteractor, FaceAuthAccessibilityDelegate faceAuthAccessibilityDelegate, KeyguardTransitionInteractor keyguardTransitionInteractor, Provider<AuthenticationInteractor> authenticationInteractor ) { super(view); Loading Loading @@ -455,6 +462,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mUserInteractor = userInteractor; mAuthenticationInteractor = authenticationInteractor; mJavaAdapter = javaAdapter; mKeyguardTransitionInteractor = keyguardTransitionInteractor; } @Override Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +13 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,19 @@ object Flags { R.bool.flag_stop_pulsing_face_scanning_animation, "stop_pulsing_face_scanning_animation") /** * TODO(b/278086361): Tracking bug * Complete rewrite of the interactions between System UI and Window Manager involving keyguard * state. When enabled, calls to ActivityTaskManagerService from System UI will exclusively * occur from [WmLockscreenVisibilityManager] rather than the legacy KeyguardViewMediator. * * This flag is under development; some types of unlock may not animate properly if you enable * it. */ @JvmField val KEYGUARD_WM_STATE_REFACTOR: UnreleasedFlag = unreleasedFlag("keyguard_wm_state_refactor") // 300 - power menu // TODO(b/254512600): Tracking Bug @JvmField val POWER_MENU_LITE = releasedFlag("power_menu_lite") Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +32 −1 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ import com.android.internal.policy.IKeyguardService; import com.android.internal.policy.IKeyguardStateCallback; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.SystemUIApplication; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindViewBinder; import com.android.systemui.keyguard.ui.binder.WindowManagerLockscreenVisibilityViewBinder; import com.android.systemui.keyguard.ui.viewmodel.KeyguardSurfaceBehindViewModel; import com.android.systemui.keyguard.ui.viewmodel.WindowManagerLockscreenVisibilityViewModel; import com.android.systemui.settings.DisplayTracker; import com.android.wm.shell.transition.ShellTransitions; import com.android.wm.shell.transition.Transitions; Loading @@ -85,10 +93,13 @@ import java.util.WeakHashMap; import javax.inject.Inject; import kotlinx.coroutines.CoroutineScope; public class KeyguardService extends Service { static final String TAG = "KeyguardService"; static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD; private final FeatureFlags mFlags; private final KeyguardViewMediator mKeyguardViewMediator; private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher; private final ScreenOnCoordinator mScreenOnCoordinator; Loading Loading @@ -291,13 +302,33 @@ public class KeyguardService extends Service { KeyguardLifecyclesDispatcher keyguardLifecyclesDispatcher, ScreenOnCoordinator screenOnCoordinator, ShellTransitions shellTransitions, DisplayTracker displayTracker) { DisplayTracker displayTracker, WindowManagerLockscreenVisibilityViewModel wmLockscreenVisibilityViewModel, WindowManagerLockscreenVisibilityManager wmLockscreenVisibilityManager, KeyguardSurfaceBehindViewModel keyguardSurfaceBehindViewModel, KeyguardSurfaceBehindParamsApplier keyguardSurfaceBehindAnimator, @Application CoroutineScope scope, FeatureFlags featureFlags) { super(); mKeyguardViewMediator = keyguardViewMediator; mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher; mScreenOnCoordinator = screenOnCoordinator; mShellTransitions = shellTransitions; mDisplayTracker = displayTracker; mFlags = featureFlags; if (mFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { WindowManagerLockscreenVisibilityViewBinder.bind( wmLockscreenVisibilityViewModel, wmLockscreenVisibilityManager, scope); KeyguardSurfaceBehindViewBinder.bind( keyguardSurfaceBehindViewModel, keyguardSurfaceBehindAnimator, scope); } } @Override Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +56 −49 Original line number Diff line number Diff line Loading @@ -405,7 +405,9 @@ class KeyguardUnlockAnimationController @Inject constructor( * the device. */ fun canPerformInWindowLauncherAnimations(): Boolean { return isNexusLauncherUnderneath() && // TODO(b/278086361): Refactor in-window animations. return !featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR) && isNexusLauncherUnderneath() && // If the launcher is underneath, but we're about to launch an activity, don't do // the animations since they won't be visible. !notificationShadeWindowController.isLaunchingActivity && Loading Loading @@ -849,14 +851,16 @@ class KeyguardUnlockAnimationController @Inject constructor( } surfaceBehindRemoteAnimationTargets?.forEach { surfaceBehindRemoteAnimationTarget -> val surfaceHeight: Int = surfaceBehindRemoteAnimationTarget.screenSpaceBounds.height() if (!featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { val surfaceHeight: Int = surfaceBehindRemoteAnimationTarget.screenSpaceBounds.height() var scaleFactor = (SURFACE_BEHIND_START_SCALE_FACTOR + (1f - SURFACE_BEHIND_START_SCALE_FACTOR) * MathUtils.clamp(amount, 0f, 1f)) // If we're dismissing via swipe to the Launcher, we'll play in-window scale animations, // so don't also scale the window. // If we're dismissing via swipe to the Launcher, we'll play in-window scale // animations, so don't also scale the window. if (keyguardStateController.isDismissingFromSwipe && willUnlockWithInWindowLauncherAnimations) { scaleFactor = 1f Loading Loading @@ -899,6 +903,7 @@ class KeyguardUnlockAnimationController @Inject constructor( ) } } } if (wallpapers) { setWallpaperAppearAmount(amount) Loading Loading @@ -985,10 +990,12 @@ class KeyguardUnlockAnimationController @Inject constructor( if (keyguardStateController.isShowing) { // Hide the keyguard, with no fade out since we animated it away during the unlock. if (!featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { keyguardViewController.hide( surfaceBehindRemoteAnimationStartTime, 0 /* fadeOutDuration */ ) } } else { Log.i(TAG, "#hideKeyguardViewAfterRemoteAnimation called when keyguard view is not " + "showing. Ignoring...") Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +76 −30 Original line number Diff line number Diff line Loading @@ -171,8 +171,6 @@ import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.data.repository.WallpaperRepository; import com.android.wm.shell.keyguard.KeyguardTransitions; import dagger.Lazy; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -182,6 +180,7 @@ import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; import dagger.Lazy; import kotlinx.coroutines.CoroutineDispatcher; /** Loading Loading @@ -1035,12 +1034,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, IRemoteAnimationFinishedCallback finishedCallback) { Trace.beginSection("mExitAnimationRunner.onAnimationStart#startKeyguardExitAnimation"); startKeyguardExitAnimation(transit, apps, wallpapers, nonApps, finishedCallback); if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mWmLockscreenVisibilityManager.get().onKeyguardGoingAwayRemoteAnimationStart( transit, apps, wallpapers, nonApps, finishedCallback); } Trace.endSection(); } @Override // Binder interface public void onAnimationCancelled() { cancelKeyguardExitAnimation(); if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mWmLockscreenVisibilityManager.get().onKeyguardGoingAwayRemoteAnimationCancelled(); } } }; Loading Loading @@ -1106,7 +1112,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mOccludeByDreamAnimator = ValueAnimator.ofFloat(0f, 1f); mOccludeByDreamAnimator.setDuration(mDreamOpenAnimationDuration); mOccludeByDreamAnimator.setInterpolator(Interpolators.LINEAR); //mOccludeByDreamAnimator.setInterpolator(Interpolators.LINEAR); mOccludeByDreamAnimator.addUpdateListener( animation -> { SyncRtSurfaceTransactionApplier.SurfaceParams.Builder Loading Loading @@ -1335,6 +1341,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamingToLockscreenTransitionViewModel; private RemoteAnimationTarget mRemoteAnimationTarget; private Lazy<WindowManagerLockscreenVisibilityManager> mWmLockscreenVisibilityManager; /** * Injected constructor. See {@link KeyguardModule}. */ Loading Loading @@ -1377,7 +1385,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, SystemClock systemClock, @Main CoroutineDispatcher mainDispatcher, Lazy<DreamingToLockscreenTransitionViewModel> dreamingToLockscreenTransitionViewModel, SystemPropertiesHelper systemPropertiesHelper) { SystemPropertiesHelper systemPropertiesHelper, Lazy<WindowManagerLockscreenVisibilityManager> wmLockscreenVisibilityManager) { mContext = context; mUserTracker = userTracker; mFalsingCollector = falsingCollector; Loading Loading @@ -1443,8 +1452,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mUiEventLogger = uiEventLogger; mSessionTracker = sessionTracker; mMainDispatcher = mainDispatcher; mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; mWmLockscreenVisibilityManager = wmLockscreenVisibilityManager; mMainDispatcher = mainDispatcher; } public void userActivity() { Loading Loading @@ -2677,6 +2687,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (DEBUG) { Log.d(TAG, "updateActivityLockScreenState(" + showing + ", " + aodShowing + ")"); } if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager if flag is enabled. return; } try { ActivityTaskManager.getService().setLockScreenShown(showing, aodShowing); } catch (RemoteException e) { Loading Loading @@ -2716,7 +2732,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } mHiding = false; if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled directly in StatusBarKeyguardViewManager if enabled. mKeyguardViewControllerLazy.get().show(options); } resetKeyguardDonePendingLocked(); mHideAnimationRun = false; adjustStatusBarLocked(); Loading Loading @@ -2787,11 +2807,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mUpdateMonitor.setKeyguardGoingAway(true); mKeyguardViewControllerLazy.get().setKeyguardGoingAwayState(true); // Don't actually hide the Keyguard at the moment, wait for window // manager until it tells us it's safe to do so with // startKeyguardExitAnimation. // Posting to mUiOffloadThread to ensure that calls to ActivityTaskManager will be in // order. // Handled in WmLockscreenVisibilityManager if flag is enabled. if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Don't actually hide the Keyguard at the moment, wait for window manager until it // tells us it's safe to do so with startKeyguardExitAnimation. // Posting to mUiOffloadThread to ensure that calls to ActivityTaskManager will be // in order. final int keyguardFlag = flags; mUiBgExecutor.execute(() -> { try { Loading @@ -2800,6 +2821,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, Log.e(TAG, "Error while calling WindowManager", e); } }); } Trace.endSection(); } }; Loading Loading @@ -2913,7 +2936,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (!mHiding && !mSurfaceBehindRemoteAnimationRequested && !mKeyguardStateController.isFlingingToDismissKeyguardDuringSwipeGesture()) { if (finishedCallback != null) { // If the flag is enabled, remote animation state is handled in // WmLockscreenVisibilityManager. if (finishedCallback != null && !mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // There will not execute animation, send a finish callback to ensure the remote // animation won't hang there. try { Loading @@ -2939,11 +2965,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, new IRemoteAnimationFinishedCallback() { @Override public void onAnimationFinished() throws RemoteException { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { try { finishedCallback.onAnimationFinished(); } catch (RemoteException e) { Slog.w(TAG, "Failed to call onAnimationFinished", e); } } onKeyguardExitFinished(); mKeyguardViewControllerLazy.get().hide(0 /* startTime */, 0 /* fadeoutDuration */); Loading @@ -2969,7 +2997,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, // it will dismiss the panel in that case. } else if (!mStatusBarStateController.leaveOpenOnKeyguardHide() && apps != null && apps.length > 0) { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager. Other logic in this class will // short circuit when this is null. mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback; } mSurfaceBehindRemoteAnimationRunning = true; mInteractionJankMonitor.begin( Loading @@ -2989,7 +3021,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, createInteractionJankMonitorConf( CUJ_LOCKSCREEN_UNLOCK_ANIMATION, "RemoteAnimationDisabled")); if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled directly in StatusBarKeyguardViewManager if enabled. mKeyguardViewControllerLazy.get().hide(startTime, fadeoutDuration); } // TODO(bc-animation): When remote animation is enabled for keyguard exit animation, // apps, wallpapers and finishedCallback are set to non-null. nonApps is not yet Loading @@ -3003,13 +3038,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } if (apps == null || apps.length == 0) { Slog.e(TAG, "Keyguard exit without a corresponding app to show."); try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { mInteractionJankMonitor.end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION); } return; } Loading @@ -3033,7 +3072,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void onAnimationEnd(Animator animation) { try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { Loading @@ -3044,7 +3085,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void onAnimationCancel(Animator animation) { try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { Loading Loading @@ -3193,7 +3236,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, flags |= KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT; } if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager. ActivityTaskManager.getService().keyguardGoingAway(flags); } mKeyguardStateController.notifyKeyguardGoingAway(true); } catch (RemoteException e) { mSurfaceBehindRemoteAnimationRequested = false; Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +8 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.domain.interactor.KeyguardFaceAuthInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; Loading Loading @@ -126,6 +127,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard private final KeyguardFaceAuthInteractor mKeyguardFaceAuthInteractor; private final BouncerMessageInteractor mBouncerMessageInteractor; private int mTranslationY; private final KeyguardTransitionInteractor mKeyguardTransitionInteractor; // Whether the volume keys should be handled by keyguard. If true, then // they will be handled here for specific media types such as music, otherwise // the audio service will bring up the volume dialog. Loading Loading @@ -299,6 +301,10 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mViewMediatorCallback.keyguardDone(fromPrimaryAuth, targetUserId); } } if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mKeyguardTransitionInteractor.startDismissKeyguardTransition(); } } @Override Loading Loading @@ -424,6 +430,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard Provider<JavaAdapter> javaAdapter, UserInteractor userInteractor, FaceAuthAccessibilityDelegate faceAuthAccessibilityDelegate, KeyguardTransitionInteractor keyguardTransitionInteractor, Provider<AuthenticationInteractor> authenticationInteractor ) { super(view); Loading Loading @@ -455,6 +462,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mUserInteractor = userInteractor; mAuthenticationInteractor = authenticationInteractor; mJavaAdapter = javaAdapter; mKeyguardTransitionInteractor = keyguardTransitionInteractor; } @Override Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +13 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,19 @@ object Flags { R.bool.flag_stop_pulsing_face_scanning_animation, "stop_pulsing_face_scanning_animation") /** * TODO(b/278086361): Tracking bug * Complete rewrite of the interactions between System UI and Window Manager involving keyguard * state. When enabled, calls to ActivityTaskManagerService from System UI will exclusively * occur from [WmLockscreenVisibilityManager] rather than the legacy KeyguardViewMediator. * * This flag is under development; some types of unlock may not animate properly if you enable * it. */ @JvmField val KEYGUARD_WM_STATE_REFACTOR: UnreleasedFlag = unreleasedFlag("keyguard_wm_state_refactor") // 300 - power menu // TODO(b/254512600): Tracking Bug @JvmField val POWER_MENU_LITE = releasedFlag("power_menu_lite") Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +32 −1 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ import com.android.internal.policy.IKeyguardService; import com.android.internal.policy.IKeyguardStateCallback; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.SystemUIApplication; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindViewBinder; import com.android.systemui.keyguard.ui.binder.WindowManagerLockscreenVisibilityViewBinder; import com.android.systemui.keyguard.ui.viewmodel.KeyguardSurfaceBehindViewModel; import com.android.systemui.keyguard.ui.viewmodel.WindowManagerLockscreenVisibilityViewModel; import com.android.systemui.settings.DisplayTracker; import com.android.wm.shell.transition.ShellTransitions; import com.android.wm.shell.transition.Transitions; Loading @@ -85,10 +93,13 @@ import java.util.WeakHashMap; import javax.inject.Inject; import kotlinx.coroutines.CoroutineScope; public class KeyguardService extends Service { static final String TAG = "KeyguardService"; static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD; private final FeatureFlags mFlags; private final KeyguardViewMediator mKeyguardViewMediator; private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher; private final ScreenOnCoordinator mScreenOnCoordinator; Loading Loading @@ -291,13 +302,33 @@ public class KeyguardService extends Service { KeyguardLifecyclesDispatcher keyguardLifecyclesDispatcher, ScreenOnCoordinator screenOnCoordinator, ShellTransitions shellTransitions, DisplayTracker displayTracker) { DisplayTracker displayTracker, WindowManagerLockscreenVisibilityViewModel wmLockscreenVisibilityViewModel, WindowManagerLockscreenVisibilityManager wmLockscreenVisibilityManager, KeyguardSurfaceBehindViewModel keyguardSurfaceBehindViewModel, KeyguardSurfaceBehindParamsApplier keyguardSurfaceBehindAnimator, @Application CoroutineScope scope, FeatureFlags featureFlags) { super(); mKeyguardViewMediator = keyguardViewMediator; mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher; mScreenOnCoordinator = screenOnCoordinator; mShellTransitions = shellTransitions; mDisplayTracker = displayTracker; mFlags = featureFlags; if (mFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { WindowManagerLockscreenVisibilityViewBinder.bind( wmLockscreenVisibilityViewModel, wmLockscreenVisibilityManager, scope); KeyguardSurfaceBehindViewBinder.bind( keyguardSurfaceBehindViewModel, keyguardSurfaceBehindAnimator, scope); } } @Override Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +56 −49 Original line number Diff line number Diff line Loading @@ -405,7 +405,9 @@ class KeyguardUnlockAnimationController @Inject constructor( * the device. */ fun canPerformInWindowLauncherAnimations(): Boolean { return isNexusLauncherUnderneath() && // TODO(b/278086361): Refactor in-window animations. return !featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR) && isNexusLauncherUnderneath() && // If the launcher is underneath, but we're about to launch an activity, don't do // the animations since they won't be visible. !notificationShadeWindowController.isLaunchingActivity && Loading Loading @@ -849,14 +851,16 @@ class KeyguardUnlockAnimationController @Inject constructor( } surfaceBehindRemoteAnimationTargets?.forEach { surfaceBehindRemoteAnimationTarget -> val surfaceHeight: Int = surfaceBehindRemoteAnimationTarget.screenSpaceBounds.height() if (!featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { val surfaceHeight: Int = surfaceBehindRemoteAnimationTarget.screenSpaceBounds.height() var scaleFactor = (SURFACE_BEHIND_START_SCALE_FACTOR + (1f - SURFACE_BEHIND_START_SCALE_FACTOR) * MathUtils.clamp(amount, 0f, 1f)) // If we're dismissing via swipe to the Launcher, we'll play in-window scale animations, // so don't also scale the window. // If we're dismissing via swipe to the Launcher, we'll play in-window scale // animations, so don't also scale the window. if (keyguardStateController.isDismissingFromSwipe && willUnlockWithInWindowLauncherAnimations) { scaleFactor = 1f Loading Loading @@ -899,6 +903,7 @@ class KeyguardUnlockAnimationController @Inject constructor( ) } } } if (wallpapers) { setWallpaperAppearAmount(amount) Loading Loading @@ -985,10 +990,12 @@ class KeyguardUnlockAnimationController @Inject constructor( if (keyguardStateController.isShowing) { // Hide the keyguard, with no fade out since we animated it away during the unlock. if (!featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { keyguardViewController.hide( surfaceBehindRemoteAnimationStartTime, 0 /* fadeOutDuration */ ) } } else { Log.i(TAG, "#hideKeyguardViewAfterRemoteAnimation called when keyguard view is not " + "showing. Ignoring...") Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +76 −30 Original line number Diff line number Diff line Loading @@ -171,8 +171,6 @@ import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.data.repository.WallpaperRepository; import com.android.wm.shell.keyguard.KeyguardTransitions; import dagger.Lazy; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -182,6 +180,7 @@ import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; import dagger.Lazy; import kotlinx.coroutines.CoroutineDispatcher; /** Loading Loading @@ -1035,12 +1034,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, IRemoteAnimationFinishedCallback finishedCallback) { Trace.beginSection("mExitAnimationRunner.onAnimationStart#startKeyguardExitAnimation"); startKeyguardExitAnimation(transit, apps, wallpapers, nonApps, finishedCallback); if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mWmLockscreenVisibilityManager.get().onKeyguardGoingAwayRemoteAnimationStart( transit, apps, wallpapers, nonApps, finishedCallback); } Trace.endSection(); } @Override // Binder interface public void onAnimationCancelled() { cancelKeyguardExitAnimation(); if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { mWmLockscreenVisibilityManager.get().onKeyguardGoingAwayRemoteAnimationCancelled(); } } }; Loading Loading @@ -1106,7 +1112,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mOccludeByDreamAnimator = ValueAnimator.ofFloat(0f, 1f); mOccludeByDreamAnimator.setDuration(mDreamOpenAnimationDuration); mOccludeByDreamAnimator.setInterpolator(Interpolators.LINEAR); //mOccludeByDreamAnimator.setInterpolator(Interpolators.LINEAR); mOccludeByDreamAnimator.addUpdateListener( animation -> { SyncRtSurfaceTransactionApplier.SurfaceParams.Builder Loading Loading @@ -1335,6 +1341,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamingToLockscreenTransitionViewModel; private RemoteAnimationTarget mRemoteAnimationTarget; private Lazy<WindowManagerLockscreenVisibilityManager> mWmLockscreenVisibilityManager; /** * Injected constructor. See {@link KeyguardModule}. */ Loading Loading @@ -1377,7 +1385,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, SystemClock systemClock, @Main CoroutineDispatcher mainDispatcher, Lazy<DreamingToLockscreenTransitionViewModel> dreamingToLockscreenTransitionViewModel, SystemPropertiesHelper systemPropertiesHelper) { SystemPropertiesHelper systemPropertiesHelper, Lazy<WindowManagerLockscreenVisibilityManager> wmLockscreenVisibilityManager) { mContext = context; mUserTracker = userTracker; mFalsingCollector = falsingCollector; Loading Loading @@ -1443,8 +1452,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mUiEventLogger = uiEventLogger; mSessionTracker = sessionTracker; mMainDispatcher = mainDispatcher; mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; mWmLockscreenVisibilityManager = wmLockscreenVisibilityManager; mMainDispatcher = mainDispatcher; } public void userActivity() { Loading Loading @@ -2677,6 +2687,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (DEBUG) { Log.d(TAG, "updateActivityLockScreenState(" + showing + ", " + aodShowing + ")"); } if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager if flag is enabled. return; } try { ActivityTaskManager.getService().setLockScreenShown(showing, aodShowing); } catch (RemoteException e) { Loading Loading @@ -2716,7 +2732,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } mHiding = false; if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled directly in StatusBarKeyguardViewManager if enabled. mKeyguardViewControllerLazy.get().show(options); } resetKeyguardDonePendingLocked(); mHideAnimationRun = false; adjustStatusBarLocked(); Loading Loading @@ -2787,11 +2807,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mUpdateMonitor.setKeyguardGoingAway(true); mKeyguardViewControllerLazy.get().setKeyguardGoingAwayState(true); // Don't actually hide the Keyguard at the moment, wait for window // manager until it tells us it's safe to do so with // startKeyguardExitAnimation. // Posting to mUiOffloadThread to ensure that calls to ActivityTaskManager will be in // order. // Handled in WmLockscreenVisibilityManager if flag is enabled. if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Don't actually hide the Keyguard at the moment, wait for window manager until it // tells us it's safe to do so with startKeyguardExitAnimation. // Posting to mUiOffloadThread to ensure that calls to ActivityTaskManager will be // in order. final int keyguardFlag = flags; mUiBgExecutor.execute(() -> { try { Loading @@ -2800,6 +2821,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, Log.e(TAG, "Error while calling WindowManager", e); } }); } Trace.endSection(); } }; Loading Loading @@ -2913,7 +2936,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (!mHiding && !mSurfaceBehindRemoteAnimationRequested && !mKeyguardStateController.isFlingingToDismissKeyguardDuringSwipeGesture()) { if (finishedCallback != null) { // If the flag is enabled, remote animation state is handled in // WmLockscreenVisibilityManager. if (finishedCallback != null && !mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // There will not execute animation, send a finish callback to ensure the remote // animation won't hang there. try { Loading @@ -2939,11 +2965,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, new IRemoteAnimationFinishedCallback() { @Override public void onAnimationFinished() throws RemoteException { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { try { finishedCallback.onAnimationFinished(); } catch (RemoteException e) { Slog.w(TAG, "Failed to call onAnimationFinished", e); } } onKeyguardExitFinished(); mKeyguardViewControllerLazy.get().hide(0 /* startTime */, 0 /* fadeoutDuration */); Loading @@ -2969,7 +2997,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, // it will dismiss the panel in that case. } else if (!mStatusBarStateController.leaveOpenOnKeyguardHide() && apps != null && apps.length > 0) { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager. Other logic in this class will // short circuit when this is null. mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback; } mSurfaceBehindRemoteAnimationRunning = true; mInteractionJankMonitor.begin( Loading @@ -2989,7 +3021,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, createInteractionJankMonitorConf( CUJ_LOCKSCREEN_UNLOCK_ANIMATION, "RemoteAnimationDisabled")); if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled directly in StatusBarKeyguardViewManager if enabled. mKeyguardViewControllerLazy.get().hide(startTime, fadeoutDuration); } // TODO(bc-animation): When remote animation is enabled for keyguard exit animation, // apps, wallpapers and finishedCallback are set to non-null. nonApps is not yet Loading @@ -3003,13 +3038,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } if (apps == null || apps.length == 0) { Slog.e(TAG, "Keyguard exit without a corresponding app to show."); try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { mInteractionJankMonitor.end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION); } return; } Loading @@ -3033,7 +3072,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void onAnimationEnd(Animator animation) { try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { Loading @@ -3044,7 +3085,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void onAnimationCancel(Animator animation) { try { if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { finishedCallback.onAnimationFinished(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException"); } finally { Loading Loading @@ -3193,7 +3236,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, flags |= KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT; } if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { // Handled in WmLockscreenVisibilityManager. ActivityTaskManager.getService().keyguardGoingAway(flags); } mKeyguardStateController.notifyKeyguardGoingAway(true); } catch (RemoteException e) { mSurfaceBehindRemoteAnimationRequested = false; Loading