diff options
author | Josh Tsuji <tsuji@google.com> | 2021-05-10 11:52:06 -0400 |
---|---|---|
committer | Josh Tsuji <tsuji@google.com> | 2021-05-17 16:07:58 -0400 |
commit | 2da469ffdfacfdb5a616f231e07e0d6f3e503703 (patch) | |
tree | fa54506611de97126e4f2ac6ed45a7089b949057 /packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java | |
parent | 25ad0530803567da5ed8c7a54e2b324d290ceaec (diff) |
Adds the initial SmartSpace shared element transition!
To see this in action, enable the remote animation (adb shell setprop persist.wm.enable_remote_keyguard_animation 1) and enhanced SmartSpace (adb shell device_config put launcher ENABLE_SMARTSPACE_ENHANCED true). Also, set your lock mode to swipe or some sort of non-bypass biometrics, so you can swipe to unlock.
KIs:
- It looks pretty janky on a fast swipe - this is the same root cause as b/186847064 so will have the same fix
- Launcher animates in with window-level animations (Launcher team is looking into helping)
- Screen off animation is not yet implemented (this is for unlock only)
Bug: 187025480
Test: unlock with every possible permutation of lock settings
Change-Id: I8c186fe57132ebc9a0bc5e3d8785e753e72c3bf2
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java index 388c085fd1a0..7b6514a63195 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java @@ -20,6 +20,8 @@ import android.graphics.Rect; import android.os.UserHandle; import android.util.Slog; +import com.android.systemui.keyguard.KeyguardUnlockAnimationController; +import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.stack.AnimationProperties; @@ -49,6 +51,9 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV private final ConfigurationController mConfigurationController; private final DozeParameters mDozeParameters; private final KeyguardVisibilityHelper mKeyguardVisibilityHelper; + private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; + private final KeyguardStateController mKeyguardStateController; + private SmartspaceTransitionController mSmartspaceTransitionController; private final Rect mClipBounds = new Rect(); @Inject @@ -59,15 +64,33 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV KeyguardStateController keyguardStateController, KeyguardUpdateMonitor keyguardUpdateMonitor, ConfigurationController configurationController, - DozeParameters dozeParameters) { + DozeParameters dozeParameters, + KeyguardUnlockAnimationController keyguardUnlockAnimationController, + SmartspaceTransitionController smartspaceTransitionController) { super(keyguardStatusView); mKeyguardSliceViewController = keyguardSliceViewController; mKeyguardClockSwitchController = keyguardClockSwitchController; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mConfigurationController = configurationController; mDozeParameters = dozeParameters; + mKeyguardStateController = keyguardStateController; mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView, keyguardStateController, dozeParameters); + mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; + mSmartspaceTransitionController = smartspaceTransitionController; + + mKeyguardStateController.addCallback(new KeyguardStateController.Callback() { + @Override + public void onKeyguardShowingChanged() { + // If we explicitly re-show the keyguard, make sure that all the child views are + // visible. They might have been animating out as part of the SmartSpace shared + // element transition. + if (keyguardStateController.isShowing()) { + mView.setChildrenAlphaExcludingClockView(1f); + mKeyguardClockSwitchController.setChildrenAlphaExcludingSmartspace(1f); + } + } + }); } @Override @@ -137,7 +160,24 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV */ public void setAlpha(float alpha) { if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) { - mView.setAlpha(alpha); + // If we're capable of performing the SmartSpace shared element transition, and we are + // going to (we're swiping to dismiss vs. bringing up the PIN screen), then fade out + // everything except for the SmartSpace. + if (mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) { + mView.setChildrenAlphaExcludingClockView(alpha); + mKeyguardClockSwitchController.setChildrenAlphaExcludingSmartspace(alpha); + } else if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) { + // Otherwise, we can just set the alpha for the entire container. + mView.setAlpha(alpha); + + // If we previously unlocked with the shared element transition, some child views + // might still have alpha = 0f. Set them back to 1f since we're just using the + // parent container's alpha. + if (mView.getChildrenAlphaExcludingSmartSpace() < 1f) { + mView.setChildrenAlphaExcludingClockView(1f); + mKeyguardClockSwitchController.setChildrenAlphaExcludingSmartspace(1f); + } + } } } |