diff options
16 files changed, 240 insertions, 43 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 6a9149ee0a09..ea1095d75340 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1286,6 +1286,9 @@ translate into their final position. --> <dimen name="lockscreen_shade_keyguard_transition_distance">@dimen/lockscreen_shade_media_transition_distance</dimen> + <!-- DREAMING -> LOCKSCREEN transition: Amount to shift lockscreen content on entering --> + <dimen name="dreaming_to_lockscreen_transition_lockscreen_translation_y">40dp</dimen> + <!-- The amount of vertical offset for the keyguard during the full shade transition. --> <dimen name="lockscreen_shade_keyguard_transition_vertical_offset">0dp</dimen> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 8b9823be65fd..b8e196fb8787 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -16,6 +16,8 @@ package com.android.keyguard; +import static java.util.Collections.emptySet; + import android.content.Context; import android.os.Trace; import android.util.AttributeSet; @@ -88,8 +90,9 @@ public class KeyguardStatusView extends GridLayout { } /** Sets a translationY value on every child view except for the media view. */ - public void setChildrenTranslationYExcludingMediaView(float translationY) { - setChildrenTranslationYExcluding(translationY, Set.of(mMediaHostContainer)); + public void setChildrenTranslationY(float translationY, boolean excludeMedia) { + setChildrenTranslationYExcluding(translationY, + excludeMedia ? Set.of(mMediaHostContainer) : emptySet()); } /** Sets a translationY value on every view except for the views in the provided set. */ diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java index 784974778af5..aec30632c41e 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.util.Slog; import com.android.keyguard.KeyguardClockSwitch.ClockSize; +import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags; import com.android.systemui.plugins.ClockAnimations; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; @@ -59,6 +61,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV KeyguardUpdateMonitor keyguardUpdateMonitor, ConfigurationController configurationController, DozeParameters dozeParameters, + FeatureFlags featureFlags, ScreenOffAnimationController screenOffAnimationController) { super(keyguardStatusView); mKeyguardSliceViewController = keyguardSliceViewController; @@ -67,6 +70,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV mConfigurationController = configurationController; mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView, keyguardStateController, dozeParameters, screenOffAnimationController, /* animateYPos= */ true); + mKeyguardVisibilityHelper.setOcclusionTransitionFlagEnabled( + featureFlags.isEnabled(Flags.UNOCCLUSION_TRANSITION)); } @Override @@ -115,8 +120,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV /** * Sets a translationY on the views on the keyguard, except on the media view. */ - public void setTranslationYExcludingMedia(float translationY) { - mView.setChildrenTranslationYExcludingMediaView(translationY); + public void setTranslationY(float translationY, boolean excludeMedia) { + mView.setChildrenTranslationY(translationY, excludeMedia); } /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardVisibilityHelper.java b/packages/SystemUI/src/com/android/keyguard/KeyguardVisibilityHelper.java index 498304b3fc55..bde06929a3d1 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardVisibilityHelper.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardVisibilityHelper.java @@ -44,6 +44,7 @@ public class KeyguardVisibilityHelper { private boolean mAnimateYPos; private boolean mKeyguardViewVisibilityAnimating; private boolean mLastOccludedState = false; + private boolean mIsUnoccludeTransitionFlagEnabled = false; private final AnimationProperties mAnimationProperties = new AnimationProperties(); public KeyguardVisibilityHelper(View view, @@ -62,6 +63,10 @@ public class KeyguardVisibilityHelper { return mKeyguardViewVisibilityAnimating; } + public void setOcclusionTransitionFlagEnabled(boolean enabled) { + mIsUnoccludeTransitionFlagEnabled = enabled; + } + /** * Set the visibility of a keyguard view based on some new state. */ @@ -129,7 +134,7 @@ public class KeyguardVisibilityHelper { // since it may need to be cancelled due to keyguard lifecycle events. mScreenOffAnimationController.animateInKeyguard( mView, mAnimateKeyguardStatusViewVisibleEndRunnable); - } else if (mLastOccludedState && !isOccluded) { + } else if (!mIsUnoccludeTransitionFlagEnabled && mLastOccludedState && !isOccluded) { // An activity was displayed over the lock screen, and has now gone away mView.setVisibility(View.VISIBLE); mView.setAlpha(0f); @@ -142,7 +147,9 @@ public class KeyguardVisibilityHelper { .start(); } else { mView.setVisibility(View.VISIBLE); - mView.setAlpha(1f); + if (!mIsUnoccludeTransitionFlagEnabled) { + mView.setAlpha(1f); + } } } else { mView.setVisibility(View.GONE); diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 25fa91561bc1..fa62ca5d91f3 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -188,10 +188,6 @@ object Flags { // TODO(b/260619425): Tracking Bug @JvmField val MODERN_ALTERNATE_BOUNCER = unreleasedFlag(219, "modern_alternate_bouncer") - // TODO(b/262780002): Tracking Bug - @JvmField - val REVAMPED_WALLPAPER_UI = unreleasedFlag(222, "revamped_wallpaper_ui", teamfood = false) - /** Flag to control the migration of face auth to modern architecture. */ // TODO(b/262838215): Tracking bug @JvmField val FACE_AUTH_REFACTOR = unreleasedFlag(220, "face_auth_refactor") @@ -200,6 +196,15 @@ object Flags { // TODO(b/244313043): Tracking bug @JvmField val BIOMETRICS_ANIMATION_REVAMP = unreleasedFlag(221, "biometrics_animation_revamp") + // TODO(b/262780002): Tracking Bug + @JvmField + val REVAMPED_WALLPAPER_UI = unreleasedFlag(222, "revamped_wallpaper_ui", teamfood = false) + + /** A different path for unocclusion transitions back to keyguard */ + // TODO(b/262859270): Tracking Bug + @JvmField + val UNOCCLUSION_TRANSITION = unreleasedFlag(223, "unocclusion_transition", teamfood = false) + // 300 - power menu // TODO(b/254512600): Tracking Bug @JvmField val POWER_MENU_LITE = releasedFlag(300, "power_menu_lite") diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index d59745566e72..3beec3611dae 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -33,7 +33,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE; import static com.android.systemui.DejankUtils.whitelistIpcs; -import static com.android.systemui.keyguard.domain.interactor.DreamingTransitionInteractor.TO_LOCKSCREEN_DURATION_MS; +import static com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.LOCKSCREEN_ANIMATION_DURATION_MS; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -1233,7 +1233,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamOpenAnimationDuration = context.getResources().getInteger( com.android.internal.R.integer.config_dreamOpenAnimationDuration); - mDreamCloseAnimationDuration = (int) TO_LOCKSCREEN_DURATION_MS; + mDreamCloseAnimationDuration = (int) LOCKSCREEN_ANIMATION_DURATION_MS; } public void userActivity() { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DreamingTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DreamingTransitionInteractor.kt index 4d60579a75ac..188930c36097 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DreamingTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DreamingTransitionInteractor.kt @@ -179,6 +179,5 @@ constructor( companion object { private val DEFAULT_DURATION = 500.milliseconds val TO_LOCKSCREEN_DURATION = 1183.milliseconds - @JvmField val TO_LOCKSCREEN_DURATION_MS = TO_LOCKSCREEN_DURATION.inWholeMilliseconds } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt index 9b36e8c6a8af..402fac1c8fb4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE +import com.android.systemui.animation.Interpolators.EMPHASIZED_DECELERATE import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.domain.interactor.DreamingTransitionInteractor.Companion.TO_LOCKSCREEN_DURATION import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor @@ -46,12 +47,11 @@ constructor( /** Dream overlay views alpha - fade out */ val dreamOverlayAlpha: Flow<Float> = flowForAnimation(DREAM_OVERLAY_ALPHA).map { 1f - it } - /** Dream background alpha - fade out */ - val dreamBackgroundAlpha: Flow<Float> = flowForAnimation(DREAM_BACKGROUND_ALPHA).map { 1f - it } - /** Lockscreen views y-translation */ fun lockscreenTranslationY(translatePx: Int): Flow<Float> { - return flowForAnimation(LOCKSCREEN_TRANSLATION_Y).map { it * translatePx } + return flowForAnimation(LOCKSCREEN_TRANSLATION_Y).map { value -> + -translatePx + (EMPHASIZED_DECELERATE.getInterpolation(value) * translatePx) + } } /** Lockscreen views alpha */ @@ -68,10 +68,12 @@ constructor( companion object { /* Length of time before ending the dream activity, in order to start unoccluding */ val DREAM_ANIMATION_DURATION = 250.milliseconds + @JvmField + val LOCKSCREEN_ANIMATION_DURATION_MS = + (TO_LOCKSCREEN_DURATION - DREAM_ANIMATION_DURATION).inWholeMilliseconds - val DREAM_OVERLAY_TRANSLATION_Y = AnimationParams(duration = 500.milliseconds) + val DREAM_OVERLAY_TRANSLATION_Y = AnimationParams(duration = 600.milliseconds) val DREAM_OVERLAY_ALPHA = AnimationParams(duration = 250.milliseconds) - val DREAM_BACKGROUND_ALPHA = AnimationParams(duration = 250.milliseconds) val LOCKSCREEN_TRANSLATION_Y = AnimationParams(duration = TO_LOCKSCREEN_DURATION) val LOCKSCREEN_ALPHA = AnimationParams(startTime = 233.milliseconds, duration = 250.milliseconds) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 170904384ae6..31543dfcb540 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -44,6 +44,7 @@ import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED; import static com.android.systemui.statusbar.VibratorHelper.TOUCH_VIBRATION_ATTRIBUTES; import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD; import static com.android.systemui.util.DumpUtilsKt.asIndenting; +import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; import static java.lang.Float.isNaN; @@ -139,6 +140,10 @@ import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor; +import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; +import com.android.systemui.keyguard.shared.model.TransitionState; +import com.android.systemui.keyguard.shared.model.TransitionStep; +import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; import com.android.systemui.media.controls.pipeline.MediaDataManager; import com.android.systemui.media.controls.ui.KeyguardMediaController; @@ -679,6 +684,12 @@ public final class NotificationPanelViewController implements Dumpable { private boolean mGestureWaitForTouchSlop; private boolean mIgnoreXTouchSlop; private boolean mExpandLatencyTracking; + private DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel; + + private KeyguardTransitionInteractor mKeyguardTransitionInteractor; + private boolean mIsDreamToLockscreenTransitionRunning = false; + private int mDreamingToLockscreenTransitionTranslationY; + private boolean mUnocclusionTransitionFlagEnabled = false; private final Runnable mFlingCollapseRunnable = () -> fling(0, false /* expand */, mNextCollapseSpeedUpFactor, false /* expandBecauseOfFalsing */); @@ -694,6 +705,12 @@ public final class NotificationPanelViewController implements Dumpable { } }; + private final Consumer<TransitionStep> mDreamingToLockscreenTransition = + (TransitionStep step) -> { + mIsDreamToLockscreenTransitionRunning = + step.getTransitionState() == TransitionState.RUNNING; + }; + @Inject public NotificationPanelViewController(NotificationPanelView view, @Main Handler handler, @@ -763,6 +780,8 @@ public final class NotificationPanelViewController implements Dumpable { KeyguardBottomAreaViewModel keyguardBottomAreaViewModel, KeyguardBottomAreaInteractor keyguardBottomAreaInteractor, AlternateBouncerInteractor alternateBouncerInteractor, + DreamingToLockscreenTransitionViewModel dreamingToLockscreenTransitionViewModel, + KeyguardTransitionInteractor keyguardTransitionInteractor, DumpManager dumpManager) { keyguardStateController.addCallback(new KeyguardStateController.Callback() { @Override @@ -778,6 +797,8 @@ public final class NotificationPanelViewController implements Dumpable { mShadeLog = shadeLogger; mShadeHeightLogger = shadeHeightLogger; mGutsManager = gutsManager; + mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; + mKeyguardTransitionInteractor = keyguardTransitionInteractor; mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { @@ -923,6 +944,8 @@ public final class NotificationPanelViewController implements Dumpable { mNotificationPanelUnfoldAnimationController = unfoldComponent.map( SysUIUnfoldComponent::getNotificationPanelUnfoldAnimationController); + mUnocclusionTransitionFlagEnabled = featureFlags.isEnabled(Flags.UNOCCLUSION_TRANSITION); + mQsFrameTranslateController = qsFrameTranslateController; updateUserSwitcherFlags(); mKeyguardBottomAreaViewModel = keyguardBottomAreaViewModel; @@ -1076,6 +1099,18 @@ public final class NotificationPanelViewController implements Dumpable { mKeyguardUnfoldTransition.ifPresent(u -> u.setup(mView)); mNotificationPanelUnfoldAnimationController.ifPresent(controller -> controller.setup(mNotificationContainerParent)); + + if (mUnocclusionTransitionFlagEnabled) { + collectFlow(mView, mDreamingToLockscreenTransitionViewModel.getLockscreenAlpha(), + dreamingToLockscreenTransitionAlpha(mNotificationStackScrollLayoutController)); + + collectFlow(mView, mDreamingToLockscreenTransitionViewModel.lockscreenTranslationY( + mDreamingToLockscreenTransitionTranslationY), + dreamingToLockscreenTransitionY(mNotificationStackScrollLayoutController)); + + collectFlow(mView, mKeyguardTransitionInteractor.getDreamingToLockscreenTransition(), + mDreamingToLockscreenTransition); + } } @VisibleForTesting @@ -1110,6 +1145,8 @@ public final class NotificationPanelViewController implements Dumpable { mUdfpsMaxYBurnInOffset = mResources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y); mSplitShadeScrimTransitionDistance = mResources.getDimensionPixelSize( R.dimen.split_shade_scrim_transition_distance); + mDreamingToLockscreenTransitionTranslationY = mResources.getDimensionPixelSize( + R.dimen.dreaming_to_lockscreen_transition_lockscreen_translation_y); } private void updateViewControllers(KeyguardStatusView keyguardStatusView, @@ -1773,10 +1810,14 @@ public final class NotificationPanelViewController implements Dumpable { } private void updateClock() { + if (mIsDreamToLockscreenTransitionRunning) { + return; + } float alpha = mClockPositionResult.clockAlpha * mKeyguardOnlyContentAlpha; mKeyguardStatusViewController.setAlpha(alpha); mKeyguardStatusViewController - .setTranslationYExcludingMedia(mKeyguardOnlyTransitionTranslationY); + .setTranslationY(mKeyguardOnlyTransitionTranslationY, /* excludeMedia= */true); + if (mKeyguardQsUserSwitchController != null) { mKeyguardQsUserSwitchController.setAlpha(alpha); } @@ -2660,7 +2701,9 @@ public final class NotificationPanelViewController implements Dumpable { } else if (statusBarState == KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.setVisibility(View.VISIBLE); - mKeyguardBottomArea.setAlpha(1f); + if (!mIsDreamToLockscreenTransitionRunning) { + mKeyguardBottomArea.setAlpha(1f); + } } else { mKeyguardBottomArea.setVisibility(View.GONE); } @@ -3527,6 +3570,9 @@ public final class NotificationPanelViewController implements Dumpable { } private void updateNotificationTranslucency() { + if (mIsDreamToLockscreenTransitionRunning) { + return; + } float alpha = 1f; if (mClosingWithAlphaFadeOut && !mExpandingFromHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) { @@ -3582,6 +3628,9 @@ public final class NotificationPanelViewController implements Dumpable { } private void updateKeyguardBottomAreaAlpha() { + if (mIsDreamToLockscreenTransitionRunning) { + return; + } // There are two possible panel expansion behaviors: // • User dragging up to unlock: we want to fade out as quick as possible // (ALPHA_EXPANSION_THRESHOLD) to avoid seeing the bouncer over the bottom area. @@ -3614,7 +3663,9 @@ public final class NotificationPanelViewController implements Dumpable { } private void onExpandingFinished() { - mScrimController.onExpandingFinished(); + if (!mUnocclusionTransitionFlagEnabled) { + mScrimController.onExpandingFinished(); + } mNotificationStackScrollLayoutController.onExpansionStopped(); mHeadsUpManager.onExpandingFinished(); mConversationNotificationManager.onNotificationPanelExpandStateChanged(isFullyCollapsed()); @@ -5809,6 +5860,32 @@ public final class NotificationPanelViewController implements Dumpable { mCurrentPanelState = state; } + private Consumer<Float> dreamingToLockscreenTransitionAlpha( + NotificationStackScrollLayoutController stackScroller) { + return (Float alpha) -> { + mKeyguardStatusViewController.setAlpha(alpha); + stackScroller.setAlpha(alpha); + + mKeyguardBottomAreaInteractor.setAlpha(alpha); + mLockIconViewController.setAlpha(alpha); + + if (mKeyguardQsUserSwitchController != null) { + mKeyguardQsUserSwitchController.setAlpha(alpha); + } + if (mKeyguardUserSwitcherController != null) { + mKeyguardUserSwitcherController.setAlpha(alpha); + } + }; + } + + private Consumer<Float> dreamingToLockscreenTransitionY( + NotificationStackScrollLayoutController stackScroller) { + return (Float translationY) -> { + mKeyguardStatusViewController.setTranslationY(translationY, /* excludeMedia= */false); + stackScroller.setTranslationY(translationY); + }; + } + @VisibleForTesting StatusBarStateController getStatusBarStateController() { return mStatusBarStateController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 4bcc0b6923a1..c2c38a7b355b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -916,6 +916,11 @@ public class NotificationStackScrollLayoutController { return mView.getTranslationX(); } + /** Set view y-translation */ + public void setTranslationY(float translationY) { + mView.setTranslationY(translationY); + } + public int indexOfChild(View view) { return mView.indexOfChild(view); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index d500f999b5e2..ee8b86160f51 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -232,7 +232,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private boolean mExpansionAffectsAlpha = true; private boolean mAnimateChange; private boolean mUpdatePending; - private boolean mTracking; private long mAnimationDuration = -1; private long mAnimationDelay; private Animator.AnimatorListener mAnimatorListener; @@ -526,7 +525,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } public void onTrackingStarted() { - mTracking = true; mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen(); if (!mKeyguardUnlockAnimationController.isPlayingCannedUnlockAnimation()) { mAnimatingPanelExpansionOnUnlock = false; @@ -534,7 +532,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } public void onExpandingFinished() { - mTracking = false; setUnocclusionAnimationRunning(false); } @@ -1450,8 +1447,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump pw.print(" expansionProgress="); pw.println(mTransitionToLockScreenFullShadeNotificationsProgress); - pw.print(" mTracking="); - pw.println(mTracking); pw.print(" mDefaultScrimAlpha="); pw.println(mDefaultScrimAlpha); pw.print(" mPanelExpansionFraction="); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 3e3ce775edd8..61ddf8c2c661 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -137,7 +137,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; private final AlternateBouncerInteractor mAlternateBouncerInteractor; private final BouncerView mPrimaryBouncerView; - private final Lazy<com.android.systemui.shade.ShadeController> mShadeController; + private final Lazy<ShadeController> mShadeController; // Local cache of expansion events, to avoid duplicates private float mFraction = -1f; @@ -255,6 +255,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb final Set<KeyguardViewManagerCallback> mCallbacks = new HashSet<>(); private boolean mIsModernBouncerEnabled; private boolean mIsModernAlternateBouncerEnabled; + private boolean mIsUnoccludeTransitionFlagEnabled; private OnDismissAction mAfterKeyguardGoneAction; private Runnable mKeyguardGoneCancelAction; @@ -335,6 +336,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mIsModernBouncerEnabled = featureFlags.isEnabled(Flags.MODERN_BOUNCER); mIsModernAlternateBouncerEnabled = featureFlags.isEnabled(Flags.MODERN_ALTERNATE_BOUNCER); mAlternateBouncerInteractor = alternateBouncerInteractor; + mIsUnoccludeTransitionFlagEnabled = featureFlags.isEnabled(Flags.UNOCCLUSION_TRANSITION); } @Override @@ -891,8 +893,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // by a FLAG_DISMISS_KEYGUARD_ACTIVITY. reset(isOccluding /* hideBouncerWhenShowing*/); } - if (animate && !isOccluded && isShowing && !primaryBouncerIsShowing()) { - mCentralSurfaces.animateKeyguardUnoccluding(); + if (!mIsUnoccludeTransitionFlagEnabled) { + if (animate && !isOccluded && isShowing && !primaryBouncerIsShowing()) { + mCentralSurfaces.animateKeyguardUnoccluding(); + } } } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java index c94c97c9b638..be4bbdf5adbc 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java @@ -25,6 +25,7 @@ import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import com.android.systemui.SysuiTestCase; +import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.ClockAnimations; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; @@ -59,6 +60,8 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { @Mock DozeParameters mDozeParameters; @Mock + FeatureFlags mFeatureFlags; + @Mock ScreenOffAnimationController mScreenOffAnimationController; @Captor private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallbackCaptor; @@ -77,6 +80,7 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { mKeyguardUpdateMonitor, mConfigurationController, mDozeParameters, + mFeatureFlags, mScreenOffAnimationController); } @@ -96,9 +100,9 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { public void setTranslationYExcludingMedia_forwardsCallToView() { float translationY = 123f; - mController.setTranslationYExcludingMedia(translationY); + mController.setTranslationY(translationY, /* excludeMedia= */true); - verify(mKeyguardStatusView).setChildrenTranslationYExcludingMediaView(translationY); + verify(mKeyguardStatusView).setChildrenTranslationY(translationY, /* excludeMedia= */true); } @Test diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt index ce44f4d82d69..508aea51b666 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt @@ -37,19 +37,23 @@ class KeyguardStatusViewTest : SysuiTestCase() { fun setChildrenTranslationYExcludingMediaView_mediaViewIsNotTranslated() { val translationY = 1234f - keyguardStatusView.setChildrenTranslationYExcludingMediaView(translationY) + keyguardStatusView.setChildrenTranslationY(translationY, /* excludeMedia= */true) assertThat(mediaView.translationY).isEqualTo(0) + + childrenExcludingMedia.forEach { + assertThat(it.translationY).isEqualTo(translationY) + } } @Test - fun setChildrenTranslationYExcludingMediaView_childrenAreTranslated() { + fun setChildrenTranslationYIncludeMediaView() { val translationY = 1234f - keyguardStatusView.setChildrenTranslationYExcludingMediaView(translationY) + keyguardStatusView.setChildrenTranslationY(translationY, /* excludeMedia= */false) - childrenExcludingMedia.forEach { + statusViewContainer.children.forEach { assertThat(it.translationY).isEqualTo(translationY) } } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt index 81950f1c22e5..c54e456416c7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt @@ -19,6 +19,7 @@ package com.android.systemui.keyguard.ui.viewmodel import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE +import com.android.systemui.animation.Interpolators.EMPHASIZED_DECELERATE import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.domain.interactor.DreamingTransitionInteractor.Companion.TO_LOCKSCREEN_DURATION import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor @@ -28,6 +29,8 @@ import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.DREAM_OVERLAY_ALPHA import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.DREAM_OVERLAY_TRANSLATION_Y +import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.LOCKSCREEN_ALPHA +import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.LOCKSCREEN_TRANSLATION_Y import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -65,10 +68,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { repository.sendTransitionStep(step(0.5f)) repository.sendTransitionStep(step(1f)) - // Only two values should be present, since the dream overlay runs for a small fraction - // of - // the overall animation time - assertThat(values.size).isEqualTo(2) + // Only 3 values should be present, since the dream overlay runs for a small fraction + // of the overall animation time + assertThat(values.size).isEqualTo(3) assertThat(values[0]) .isEqualTo( EMPHASIZED_ACCELERATE.getInterpolation( @@ -81,6 +83,12 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { animValue(0.3f, DREAM_OVERLAY_TRANSLATION_Y) ) * pixels ) + assertThat(values[2]) + .isEqualTo( + EMPHASIZED_ACCELERATE.getInterpolation( + animValue(0.5f, DREAM_OVERLAY_TRANSLATION_Y) + ) * pixels + ) job.cancel() } @@ -98,8 +106,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { repository.sendTransitionStep(step(1f)) // Only two values should be present, since the dream overlay runs for a small fraction - // of - // the overall animation time + // of the overall animation time assertThat(values.size).isEqualTo(2) assertThat(values[0]).isEqualTo(1f - animValue(0f, DREAM_OVERLAY_ALPHA)) assertThat(values[1]).isEqualTo(1f - animValue(0.1f, DREAM_OVERLAY_ALPHA)) @@ -107,6 +114,77 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { job.cancel() } + @Test + fun lockscreenFadeIn() = + runTest(UnconfinedTestDispatcher()) { + val values = mutableListOf<Float>() + + val job = underTest.lockscreenAlpha.onEach { values.add(it) }.launchIn(this) + + repository.sendTransitionStep(step(0f)) + repository.sendTransitionStep(step(0.1f)) + // Should start running here... + repository.sendTransitionStep(step(0.2f)) + repository.sendTransitionStep(step(0.3f)) + // ...up to here + repository.sendTransitionStep(step(1f)) + + // Only two values should be present, since the dream overlay runs for a small fraction + // of the overall animation time + assertThat(values.size).isEqualTo(2) + assertThat(values[0]).isEqualTo(animValue(0.2f, LOCKSCREEN_ALPHA)) + assertThat(values[1]).isEqualTo(animValue(0.3f, LOCKSCREEN_ALPHA)) + + job.cancel() + } + + @Test + fun lockscreenTranslationY() = + runTest(UnconfinedTestDispatcher()) { + val values = mutableListOf<Float>() + + val pixels = 100 + val job = + underTest.lockscreenTranslationY(pixels).onEach { values.add(it) }.launchIn(this) + + repository.sendTransitionStep(step(0f)) + repository.sendTransitionStep(step(0.3f)) + repository.sendTransitionStep(step(0.5f)) + repository.sendTransitionStep(step(1f)) + + assertThat(values.size).isEqualTo(4) + assertThat(values[0]) + .isEqualTo( + -pixels + + EMPHASIZED_DECELERATE.getInterpolation( + animValue(0f, LOCKSCREEN_TRANSLATION_Y) + ) * pixels + ) + assertThat(values[1]) + .isEqualTo( + -pixels + + EMPHASIZED_DECELERATE.getInterpolation( + animValue(0.3f, LOCKSCREEN_TRANSLATION_Y) + ) * pixels + ) + assertThat(values[2]) + .isEqualTo( + -pixels + + EMPHASIZED_DECELERATE.getInterpolation( + animValue(0.5f, LOCKSCREEN_TRANSLATION_Y) + ) * pixels + ) + assertThat(values[3]) + .isEqualTo( + -pixels + + EMPHASIZED_DECELERATE.getInterpolation( + animValue(1f, LOCKSCREEN_TRANSLATION_Y) + ) * pixels + ) + + job.cancel() + } + private fun animValue(stepValue: Float, params: AnimationParams): Float { val totalDuration = TO_LOCKSCREEN_DURATION val startValue = (params.startTime / totalDuration).toFloat() diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index 4843c76f7eaf..0586a0cbfb8e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -105,6 +105,8 @@ import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor; +import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; +import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; import com.android.systemui.media.controls.pipeline.MediaDataManager; import com.android.systemui.media.controls.ui.KeyguardMediaController; @@ -288,6 +290,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { @Mock private KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel; @Mock private KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; @Mock private AlternateBouncerInteractor mAlternateBouncerInteractor; + @Mock private DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel; + @Mock private KeyguardTransitionInteractor mKeyguardTransitionInteractor; @Mock private MotionEvent mDownMotionEvent; @Captor private ArgumentCaptor<NotificationStackScrollLayout.OnEmptySpaceClickListener> @@ -505,6 +509,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mKeyguardBottomAreaViewModel, mKeyguardBottomAreaInteractor, mAlternateBouncerInteractor, + mDreamingToLockscreenTransitionViewModel, + mKeyguardTransitionInteractor, mDumpManager); mNotificationPanelViewController.initDependencies( mCentralSurfaces, |