summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt22
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java22
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java9
6 files changed, 89 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
index 8f78feb979b8..3620e84de398 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
@@ -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(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
index a70ba8236e9a..57d63487cf7a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
@@ -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,
@@ -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)
- * mKeyguardStatusBarAnimateAlpha
- * (1.0f - mKeyguardHeadsUpShowingAmount);
+
+ float newAlpha;
+ if (mExplicitAlpha != -1) {
+ newAlpha = mExplicitAlpha;
+ } else {
+ newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion)
+ * mKeyguardStatusBarAnimateAlpha
+ * (1.0f - mKeyguardHeadsUpShowingAmount);
+ }
boolean hideForBypass =
mFirstBypassAttempt && mKeyguardUpdateMonitor.shouldListenForFace()
@@ -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();
+ }
}
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 999ebc11b621..2d16b52839eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -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);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
index 52c8a559b7b3..311e257f047f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
@@ -413,6 +413,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)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
index 7de35458a893..39d5a160c657 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
@@ -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
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
index 5add2f2a5148..22bf6c8324ae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
@@ -938,6 +938,15 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
verify(mScrimController).setExpansionAffectsAlpha(true);
}
+ @Test
+ public void setKeyguardStatusBarAlpha_setsAlphaOnKeyguardStatusBarController() {
+ float statusBarAlpha = 0.5f;
+
+ mNotificationPanelViewController.setKeyguardStatusBarAlpha(statusBarAlpha);
+
+ verify(mKeyguardStatusBarViewController).setAlpha(statusBarAlpha);
+ }
+
private void triggerPositionClockAndNotifications() {
mNotificationPanelViewController.closeQs();
}