summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2018-05-21 18:23:59 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-05-21 18:23:59 +0000
commit402e2a2b6f47ca955db084255d642e9f3765e4eb (patch)
tree118e50fef7d0e45b88f9d88ddf8f63d9fb52a0f3
parent711a8f7f286b30df0ab82d4f64ff6202414d65ca (diff)
parent69bda6014fd5a4c70a99906675cfdc394a275376 (diff)
Merge "Keep scrim black when "always on" is off" into pi-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java10
2 files changed, 20 insertions, 2 deletions
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 ae93d986ea36..9ba0880b3748 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -450,10 +450,18 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
}
/**
- * Sets the front alpha while in AOD.
+ * Sets the front scrim opacity in AOD so it's not as bright.
+ * <p>
+ * Displays usually don't support multiple dimming settings when in low power mode.
+ * The workaround is to modify the front scrim opacity when in AOD, so it's not as
+ * bright when you're at the movies or lying down on bed.
+ * <p>
+ * This value will be lost during transitions and only updated again after the the
+ * device is dozing when the light sensor is on.
*/
public void setAodFrontScrimAlpha(float alpha) {
- if (mState == ScrimState.AOD && mCurrentInFrontAlpha != alpha) {
+ if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()
+ && mCurrentInFrontAlpha != alpha) {
mCurrentInFrontAlpha = alpha;
scheduleUpdate();
}
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 4e047901fb50..a2a866e79af3 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
@@ -184,6 +184,16 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.finishAnimationsImmediately();
assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
+ // ... and alpha updates should be completely ignored if always_on is off.
+ // Passing it forward would mess up the wake-up transition.
+ mAlwaysOnEnabled = false;
+ mScrimController.transitionTo(ScrimState.UNLOCKED);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ mScrimController.setAodFrontScrimAlpha(0.3f);
+ Assert.assertEquals(ScrimState.AOD.getFrontAlpha(), mScrimInFront.getViewAlpha(), 0.001f);
+ Assert.assertNotEquals(0.3f, mScrimInFront.getViewAlpha(), 0.001f);
+
// Reset value since enums are static.
mScrimController.setAodFrontScrimAlpha(0f);
}