From aca32441ea53a03319661f9cf5edb74c1f6f0772 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 1 Jun 2021 14:45:23 +0200 Subject: [PATCH] Fading out keyguard only content instead of occluding them with the scrim The scrim is also used on the lock screen and should therefore be behind the keyguard elements. Instead, we now fade out the views on top of the scrim to achieve the same visual effect. This also fixed an issue where the inset on the scrim was wrong in landscape Fixes: 188660106 Test: drag down on lockscreen, observe content fading out Change-Id: I72e6b964dde5ad3c579a0db71d7914f3e47eab6c --- .../res/layout/status_bar_expanded.xml | 12 -------- .../res/layout/super_notification_shade.xml | 8 ++++++ .../com/android/keyguard/LockIconView.java | 5 ++++ .../keyguard/LockIconViewController.java | 7 +++++ .../LockscreenShadeTransitionController.kt | 2 ++ .../NotificationPanelViewController.java | 28 +++++++++++++++++-- 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index fb39d3e4027d5..dbbf641e4bf7e 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -64,18 +64,6 @@ android:clipToPadding="false" android:clipChildren="false"> - - diff --git a/packages/SystemUI/res/layout/super_notification_shade.xml b/packages/SystemUI/res/layout/super_notification_shade.xml index 08284a0a2e3a5..bea50e87a29a0 100644 --- a/packages/SystemUI/res/layout/super_notification_shade.xml +++ b/packages/SystemUI/res/layout/super_notification_shade.xml @@ -51,6 +51,14 @@ sysui:ignoreRightInset="true" /> + + impleme private final AccessibilityManager.TouchExplorationStateChangeListener mTouchExplorationStateChangeListener = enabled -> updateClickListener(); + + /** + * Set the alpha of this view. + */ + public void setAlpha(float alpha) { + mView.setAlpha(alpha); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt index af8d808874740..4ed376ace8c8a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt @@ -287,6 +287,8 @@ class LockscreenShadeTransitionController @Inject constructor( // TODO: appear media also in split shade val mediaAmount = if (useSplitShade) 0f else field mediaHierarchyManager.setTransitionToFullShadeAmount(mediaAmount) + // Fade out all content only visible on the lockscreen + notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress) } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 7737420cf0262..144e15e590d46 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -577,6 +577,11 @@ public class NotificationPanelViewController extends PanelViewController { */ private ValueAnimator mQsClippingAnimation = null; private final Rect mKeyguardStatusAreaClipBounds = new Rect(); + + /** + * The alpha of the views which only show on the keyguard but not in shade / shade locked + */ + private float mKeyguardOnlyContentAlpha = 1.0f; private int mOldLayoutDirection; private NotificationShelfController mNotificationShelfController; private int mScrimCornerRadius; @@ -1412,12 +1417,13 @@ public class NotificationPanelViewController extends PanelViewController { } private void updateClock() { - mKeyguardStatusViewController.setAlpha(mClockPositionResult.clockAlpha); + float alpha = mClockPositionResult.clockAlpha * mKeyguardOnlyContentAlpha; + mKeyguardStatusViewController.setAlpha(alpha); if (mKeyguardQsUserSwitchController != null) { - mKeyguardQsUserSwitchController.setAlpha(mClockPositionResult.clockAlpha); + mKeyguardQsUserSwitchController.setAlpha(alpha); } if (mKeyguardUserSwitcherController != null) { - mKeyguardUserSwitcherController.setAlpha(mClockPositionResult.clockAlpha); + mKeyguardUserSwitcherController.setAlpha(alpha); } } @@ -2024,6 +2030,7 @@ public class NotificationPanelViewController extends PanelViewController { private void maybeAnimateBottomAreaAlpha() { mBottomAreaShadeAlphaAnimator.cancel(); if (mBarState == StatusBarState.SHADE_LOCKED) { + mBottomAreaShadeAlphaAnimator.setFloatValues(mBottomAreaShadeAlpha, 0.0f); mBottomAreaShadeAlphaAnimator.start(); } else { mBottomAreaShadeAlpha = 1f; @@ -2439,6 +2446,20 @@ public class NotificationPanelViewController extends PanelViewController { updateQsExpansion(); } + /** + * Set the alpha of the keyguard elements which only show on the lockscreen, but not in + * shade locked / shade. This is used when dragging down to the full shade. + */ + public void setKeyguardOnlyContentAlpha(float keyguardAlpha) { + mKeyguardOnlyContentAlpha = Interpolators.ALPHA_IN.getInterpolation(keyguardAlpha); + if (mBarState == KEYGUARD) { + // If the animator is running, it's already fading out the content and this is a reset + mBottomAreaShadeAlpha = mKeyguardOnlyContentAlpha; + updateKeyguardBottomAreaAlpha(); + } + updateClock(); + } + private void trackMovement(MotionEvent event) { if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event); } @@ -2897,6 +2918,7 @@ public class NotificationPanelViewController extends PanelViewController { if (ambientIndicationContainer != null) { ambientIndicationContainer.setAlpha(alpha); } + mLockIconViewController.setAlpha(alpha); } /**