Loading packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +3 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,9 @@ class LockscreenShadeTransitionController @Inject constructor( } notificationPanelController .setKeyguardTransitionProgress(keyguardAlpha, keyguardTranslationY) val statusBarAlpha = if (useSplitShade) keyguardAlpha else -1f notificationPanelController.setKeyguardStatusBarAlpha(statusBarAlpha) } private fun setDragDownAmountAnimated( Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +24 −3 Original line number Diff line number Diff line Loading @@ -229,6 +229,11 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat private boolean mShowingKeyguardHeadsUp; private StatusBarSystemEventAnimator mSystemEventAnimator; /** * The alpha value to be set on the View. If -1, this value is to be ignored. */ private float mExplicitAlpha = -1f; @Inject public KeyguardStatusBarViewController( KeyguardStatusBarView view, Loading Loading @@ -425,9 +430,15 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat float alphaQsExpansion = 1 - Math.min( 1, mNotificationPanelViewStateProvider.getLockscreenShadeDragProgress() * 2); float newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) float newAlpha; if (mExplicitAlpha != -1) { newAlpha = mExplicitAlpha; } else { newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha * (1.0f - mKeyguardHeadsUpShowingAmount); } boolean hideForBypass = mFirstBypassAttempt && mKeyguardUpdateMonitor.shouldListenForFace() Loading Loading @@ -510,7 +521,17 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("KeyguardStatusBarView:"); pw.println(" mBatteryListening: " + mBatteryListening); pw.println(" mExplicitAlpha: " + mExplicitAlpha); mView.dump(fd, pw, args); } /** * Sets the alpha to be set on the view. * * @param alpha a value between 0 and 1. -1 if the value is to be reset/ignored. */ public void setAlpha(float alpha) { mExplicitAlpha = alpha; updateViewState(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +9 −0 Original line number Diff line number Diff line Loading @@ -2682,6 +2682,15 @@ public class NotificationPanelViewController extends PanelViewController { updateClock(); } /** * Sets the alpha value to be set on the keyguard status bar. * * @param alpha value between 0 and 1. -1 if the value is to be reset. */ public void setKeyguardStatusBarAlpha(float alpha) { mKeyguardStatusBarViewController.setAlpha(alpha); } private void trackMovement(MotionEvent event) { if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -424,6 +424,28 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { verifyZeroInteractions(singleShadeOverScroller) } @Test fun setDragDownAmount_inSplitShade_setsKeyguardStatusBarAlphaBasedOnDistance() { val alphaDistance = context.resources.getDimensionPixelSize( R.dimen.lockscreen_shade_npvc_keyguard_content_alpha_transition_distance) val dragDownAmount = 10f enableSplitShade() transitionController.dragDownAmount = dragDownAmount val expectedAlpha = 1 - dragDownAmount / alphaDistance verify(notificationPanelController).setKeyguardStatusBarAlpha(expectedAlpha) } @Test fun setDragDownAmount_notInSplitShade_setsKeyguardStatusBarAlphaToMinusOne() { disableSplitShade() transitionController.dragDownAmount = 10f verify(notificationPanelController).setKeyguardStatusBarAlpha(-1f) } private fun enableSplitShade() { setSplitShadeEnabled(true) } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,28 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase { assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.INVISIBLE); } @Test public void setAlpha_explicitAlpha_setsExplicitAlpha() { mController.onViewAttached(); updateStateToKeyguard(); mController.setAlpha(0.5f); assertThat(mKeyguardStatusBarView.getAlpha()).isEqualTo(0.5f); } @Test public void setAlpha_explicitAlpha_thenMinusOneAlpha_setsAlphaBasedOnDefaultCriteria() { mController.onViewAttached(); updateStateToKeyguard(); mController.setAlpha(0.5f); mController.setAlpha(-1f); assertThat(mKeyguardStatusBarView.getAlpha()).isGreaterThan(0); assertThat(mKeyguardStatusBarView.getAlpha()).isNotEqualTo(0.5f); } // TODO(b/195442899): Add more tests for #updateViewState once CLs are finalized. @Test Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +3 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,9 @@ class LockscreenShadeTransitionController @Inject constructor( } notificationPanelController .setKeyguardTransitionProgress(keyguardAlpha, keyguardTranslationY) val statusBarAlpha = if (useSplitShade) keyguardAlpha else -1f notificationPanelController.setKeyguardStatusBarAlpha(statusBarAlpha) } private fun setDragDownAmountAnimated( Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +24 −3 Original line number Diff line number Diff line Loading @@ -229,6 +229,11 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat private boolean mShowingKeyguardHeadsUp; private StatusBarSystemEventAnimator mSystemEventAnimator; /** * The alpha value to be set on the View. If -1, this value is to be ignored. */ private float mExplicitAlpha = -1f; @Inject public KeyguardStatusBarViewController( KeyguardStatusBarView view, Loading Loading @@ -425,9 +430,15 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat float alphaQsExpansion = 1 - Math.min( 1, mNotificationPanelViewStateProvider.getLockscreenShadeDragProgress() * 2); float newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) float newAlpha; if (mExplicitAlpha != -1) { newAlpha = mExplicitAlpha; } else { newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha * (1.0f - mKeyguardHeadsUpShowingAmount); } boolean hideForBypass = mFirstBypassAttempt && mKeyguardUpdateMonitor.shouldListenForFace() Loading Loading @@ -510,7 +521,17 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("KeyguardStatusBarView:"); pw.println(" mBatteryListening: " + mBatteryListening); pw.println(" mExplicitAlpha: " + mExplicitAlpha); mView.dump(fd, pw, args); } /** * Sets the alpha to be set on the view. * * @param alpha a value between 0 and 1. -1 if the value is to be reset/ignored. */ public void setAlpha(float alpha) { mExplicitAlpha = alpha; updateViewState(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +9 −0 Original line number Diff line number Diff line Loading @@ -2682,6 +2682,15 @@ public class NotificationPanelViewController extends PanelViewController { updateClock(); } /** * Sets the alpha value to be set on the keyguard status bar. * * @param alpha value between 0 and 1. -1 if the value is to be reset. */ public void setKeyguardStatusBarAlpha(float alpha) { mKeyguardStatusBarViewController.setAlpha(alpha); } private void trackMovement(MotionEvent event) { if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -424,6 +424,28 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { verifyZeroInteractions(singleShadeOverScroller) } @Test fun setDragDownAmount_inSplitShade_setsKeyguardStatusBarAlphaBasedOnDistance() { val alphaDistance = context.resources.getDimensionPixelSize( R.dimen.lockscreen_shade_npvc_keyguard_content_alpha_transition_distance) val dragDownAmount = 10f enableSplitShade() transitionController.dragDownAmount = dragDownAmount val expectedAlpha = 1 - dragDownAmount / alphaDistance verify(notificationPanelController).setKeyguardStatusBarAlpha(expectedAlpha) } @Test fun setDragDownAmount_notInSplitShade_setsKeyguardStatusBarAlphaToMinusOne() { disableSplitShade() transitionController.dragDownAmount = 10f verify(notificationPanelController).setKeyguardStatusBarAlpha(-1f) } private fun enableSplitShade() { setSplitShadeEnabled(true) } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,28 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase { assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.INVISIBLE); } @Test public void setAlpha_explicitAlpha_setsExplicitAlpha() { mController.onViewAttached(); updateStateToKeyguard(); mController.setAlpha(0.5f); assertThat(mKeyguardStatusBarView.getAlpha()).isEqualTo(0.5f); } @Test public void setAlpha_explicitAlpha_thenMinusOneAlpha_setsAlphaBasedOnDefaultCriteria() { mController.onViewAttached(); updateStateToKeyguard(); mController.setAlpha(0.5f); mController.setAlpha(-1f); assertThat(mKeyguardStatusBarView.getAlpha()).isGreaterThan(0); assertThat(mKeyguardStatusBarView.getAlpha()).isNotEqualTo(0.5f); } // TODO(b/195442899): Add more tests for #updateViewState once CLs are finalized. @Test Loading