summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2019-01-02 14:38:35 -0800
committer Lucas Dupin <dupin@google.com> 2019-01-18 12:30:06 -0800
commit3d36dd83a9c107b98455a0e00b0a6614f6a8ee1d (patch)
tree393270ba061d9b3feac13111f74c9e43c8f73921
parent61ae7ed2c6697d95c06422cad6aa4d4063dd4b24 (diff)
Light scrim on pulsing state
New scrim opacity - 20% - and also keeping the pulse state bright, so it's more similar to lock screen. Bug: 111405682 Test: visual Test: atest ScrimControllerTest Change-Id: Iecf86f5eeb5fcab9ada198e97f7da2f4e362e22f
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java21
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java52
4 files changed, 10 insertions, 97 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 28aae7781412..a9b7972e50b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -5219,9 +5219,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
// another "changeViewPosition" call is ever added.
changeViewPosition(mShelf,
getChildCount() - offsetFromEnd);
-
- // Scrim opacity varies based on notification count
- mScrimController.setNotificationCount(getNotGoneChildCount());
}
@ShadeViewRefactor(RefactorComponent.SHADE_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 3568f2846a51..6deff82d845d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -88,16 +88,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
/**
* Default alpha value for most scrims.
*/
- public static final float GRADIENT_SCRIM_ALPHA = 0.45f;
+ public static final float GRADIENT_SCRIM_ALPHA = 0.2f;
/**
* A scrim varies its opacity based on a busyness factor, for example
* how many notifications are currently visible.
*/
public static final float GRADIENT_SCRIM_ALPHA_BUSY = 0.7f;
- /**
- * Scrim opacity when a wallpaper doesn't support ambient mode.
- */
- public static final float PULSING_WALLPAPER_SCRIM_ALPHA = 0.6f;
/**
* The most common scrim, the one under the keyguard.
@@ -154,7 +150,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private Callback mCallback;
private boolean mWallpaperSupportsAmbientMode;
private boolean mScreenOn;
- private float mNotificationDensity;
// Scrim blanking callbacks
private Runnable mPendingFrameCallback;
@@ -245,7 +240,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
mCurrentInFrontTint = state.getFrontTint();
mCurrentBehindTint = state.getBehindTint();
mCurrentInFrontAlpha = state.getFrontAlpha();
- mCurrentBehindAlpha = state.getBehindAlpha(mNotificationDensity);
+ mCurrentBehindAlpha = state.getBehindAlpha();
applyExpansionToAlpha();
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
@@ -416,7 +411,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// Either darken of make the scrim transparent when you
// pull down the shade
float interpolatedFract = getInterpolatedFraction();
- float alphaBehind = mState.getBehindAlpha(mNotificationDensity);
+ float alphaBehind = mState.getBehindAlpha();
if (mDarkenWhileDragging) {
mCurrentBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
interpolatedFract);
@@ -430,24 +425,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
}
/**
- * Keyguard and shade scrim opacity varies according to how many notifications are visible.
- * @param notificationCount Number of visible notifications.
- */
- public void setNotificationCount(int notificationCount) {
- final float maxNotificationDensity = 3;
- float notificationDensity = Math.min(notificationCount / maxNotificationDensity, 1f);
- if (mNotificationDensity == notificationDensity) {
- return;
- }
- mNotificationDensity = notificationDensity;
-
- if (mState == ScrimState.KEYGUARD) {
- applyExpansionToAlpha();
- scheduleUpdate();
- }
- }
-
- /**
* Sets the given drawable as the background of the scrim that shows up behind the
* notifications.
*/
@@ -909,7 +886,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// Backdrop event may arrive after state was already applied,
// in this case, back-scrim needs to be re-evaluated
if (mState == ScrimState.AOD || mState == ScrimState.PULSING) {
- float newBehindAlpha = mState.getBehindAlpha(mNotificationDensity);
+ float newBehindAlpha = mState.getBehindAlpha();
if (mCurrentBehindAlpha != newBehindAlpha) {
mCurrentBehindAlpha = newBehindAlpha;
updateScrims();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index 72519ba3503c..a68c7513b9d0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -18,7 +18,6 @@ package com.android.systemui.statusbar.phone;
import android.graphics.Color;
import android.os.Trace;
-import android.util.MathUtils;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
@@ -57,13 +56,6 @@ public enum ScrimState {
mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
mCurrentInFrontAlpha = 0;
}
-
- @Override
- public float getBehindAlpha(float busynessFactor) {
- return MathUtils.map(0 /* start */, 1 /* stop */,
- mScrimBehindAlphaKeyguard, ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
- busynessFactor);
- }
},
/**
@@ -117,7 +109,7 @@ public enum ScrimState {
}
@Override
- public float getBehindAlpha(float busyness) {
+ public float getBehindAlpha() {
return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
}
@@ -134,16 +126,9 @@ public enum ScrimState {
@Override
public void prepare(ScrimState previousState) {
mCurrentInFrontAlpha = 0;
- mCurrentInFrontTint = Color.BLACK;
- mCurrentBehindTint = Color.BLACK;
+ mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
mBlankScreen = mDisplayRequiresBlanking;
}
-
- @Override
- public float getBehindAlpha(float busyness) {
- return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f
- : ScrimController.PULSING_WALLPAPER_SCRIM_ALPHA;
- }
},
/**
@@ -235,7 +220,7 @@ public enum ScrimState {
return mCurrentInFrontAlpha;
}
- public float getBehindAlpha(float busyness) {
+ public float getBehindAlpha() {
return mCurrentBehindAlpha;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 8eb42c4b088c..0471d7622cb6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -133,10 +133,10 @@ public class ScrimControllerTest extends SysuiTestCase {
// Back scrim should be transparent
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
- // Move on to PULSING and check if the back scrim is still transparent
+ // Move on to PULSING and check if the back scrim was updated
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
- assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
}
@Test
@@ -224,7 +224,7 @@ public class ScrimControllerTest extends SysuiTestCase {
// Back scrim should be semi-transparent so the user can see the wallpaper
// Pulse callback should have been invoked
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
- assertScrimTint(mScrimBehind, true /* tinted */);
+ assertScrimTint(mScrimBehind, false /* tinted */);
}
@Test
@@ -560,34 +560,6 @@ public class ScrimControllerTest extends SysuiTestCase {
Assert.assertTrue(mScrimController.wasAnimationJustCancelled());
}
- /**
- * Number of visible notifications affects scrim opacity.
- */
- @Test
- public void testNotificationDensity() {
- mScrimController.transitionTo(ScrimState.KEYGUARD);
- mScrimController.finishAnimationsImmediately();
-
- mScrimController.setNotificationCount(0);
- mScrimController.finishAnimationsImmediately();
- Assert.assertEquals("lower density when no notifications",
- ScrimController.GRADIENT_SCRIM_ALPHA, mScrimBehind.getViewAlpha(), 0.01f);
-
- mScrimController.setNotificationCount(3);
- mScrimController.finishAnimationsImmediately();
- Assert.assertEquals("stronger density when notifications are visible",
- ScrimController.GRADIENT_SCRIM_ALPHA_BUSY, mScrimBehind.getViewAlpha(), 0.01f);
- }
-
- /**
- * Moving from/to states conserves old notification density.
- */
- @Test
- public void testConservesNotificationDensity() {
- testConservesNotificationDensity(0 /* count */, ScrimController.GRADIENT_SCRIM_ALPHA);
- testConservesNotificationDensity(3 /* count */, ScrimController.GRADIENT_SCRIM_ALPHA_BUSY);
- }
-
@Test
public void testScrimFocus() {
mScrimController.transitionTo(ScrimState.AOD);
@@ -662,24 +634,6 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimBehind.getDefaultFocusHighlightEnabled());
}
- /**
- * Conserves old notification density after leaving state and coming back.
- *
- * @param count How many notification.
- * @param expectedAlpha Expected alpha.
- */
- private void testConservesNotificationDensity(int count, float expectedAlpha) {
- mScrimController.setNotificationCount(count);
- mScrimController.transitionTo(ScrimState.UNLOCKED);
- mScrimController.finishAnimationsImmediately();
-
- mScrimController.transitionTo(ScrimState.KEYGUARD);
- mScrimController.finishAnimationsImmediately();
-
- Assert.assertEquals("Doesn't respect notification busyness after transition",
- expectedAlpha, mScrimBehind.getViewAlpha(), 0.01f);
- }
-
private void assertScrimTint(ScrimView scrimView, boolean tinted) {
final boolean viewIsTinted = scrimView.getTint() != Color.TRANSPARENT;
final String name = scrimView == mScrimInFront ? "front" : "back";