summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2019-01-28 14:31:40 -0800
committer Lucas Dupin <dupin@google.com> 2019-02-05 11:13:32 -0500
commit023d727a9c47017ebdeb048ece833afddb0dd536 (patch)
tree8919971365d7dc75788867a42e3f09207ac5b95f
parent7343460cd0a7957966b31a263c261dcaf337eb78 (diff)
LS sensor should wake-up the wallpaper
Change-Id: Ic383fa003667cec91a3c6b49b7354813e7ee8728 Fixes: 123535182 Test: manual Test: atest DozeWallpaperStateTest
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java19
5 files changed, 33 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
index e338a3406d7f..325018227692 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
@@ -71,7 +71,7 @@ public class DozeFactory {
new DozeScreenState(wrappedService, handler, params, wakeLock),
createDozeScreenBrightness(context, wrappedService, sensorManager, host, params,
handler),
- new DozeWallpaperState(context),
+ new DozeWallpaperState(context, machine),
new DozeDockHandler(context, machine, host, config, handler, dockManager)
});
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java b/packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java
index be504ef5eb9c..ca9f24fd236f 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java
@@ -37,17 +37,20 @@ public class DozeWallpaperState implements DozeMachine.Part {
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private final IWallpaperManager mWallpaperManagerService;
- private boolean mIsAmbientMode;
private final DozeParameters mDozeParameters;
+ private final DozeMachine mMachine;
+ private boolean mIsAmbientMode;
- public DozeWallpaperState(Context context) {
- this(IWallpaperManager.Stub.asInterface(
+ public DozeWallpaperState(Context context, DozeMachine machine) {
+ this(machine, IWallpaperManager.Stub.asInterface(
ServiceManager.getService(Context.WALLPAPER_SERVICE)),
DozeParameters.getInstance(context));
}
@VisibleForTesting
- DozeWallpaperState(IWallpaperManager wallpaperManagerService, DozeParameters parameters) {
+ DozeWallpaperState(DozeMachine machine, IWallpaperManager wallpaperManagerService,
+ DozeParameters parameters) {
+ mMachine = machine;
mWallpaperManagerService = wallpaperManagerService;
mDozeParameters = parameters;
}
@@ -61,10 +64,13 @@ public class DozeWallpaperState implements DozeMachine.Part {
case DOZE_AOD_PAUSING:
case DOZE_AOD_PAUSED:
case DOZE_REQUEST_PULSE:
- case DOZE_PULSING:
case DOZE_PULSE_DONE:
isAmbientMode = true;
break;
+ case DOZE_PULSING:
+ isAmbientMode =
+ mMachine.getPulseReason() != DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN;
+ break;
default:
isAmbientMode = false;
}
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 bf143c8940e5..ee1e3c09597f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -272,9 +272,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// AOD wallpapers should fade away after a while.
// Docking pulses may take a long time, wallpapers should also fade away after a while.
- if (mWallpaperSupportsAmbientMode && (
- mDozeParameters.getAlwaysOn() && mState == ScrimState.AOD
- || mState == ScrimState.PULSING && mCallback != null)) {
+ if (mWallpaperSupportsAmbientMode && mDozeParameters.getAlwaysOn()
+ && mState == ScrimState.AOD) {
if (!mWallpaperVisibilityTimedOut) {
mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
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 11a2d32c9dd6..0f85c187ab7e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -128,7 +128,8 @@ public enum ScrimState {
public void prepare(ScrimState previousState) {
mCurrentInFrontAlpha = 0f;
if (mPulseReason == DozeLog.PULSE_REASON_NOTIFICATION
- || mPulseReason == DozeLog.PULSE_REASON_DOCKING) {
+ || mPulseReason == DozeLog.PULSE_REASON_DOCKING
+ || mPulseReason == DozeLog.PULSE_REASON_INTENT) {
mCurrentBehindAlpha = previousState.getBehindAlpha();
mCurrentBehindTint = Color.BLACK;
} else {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
index ec2319d80194..9eb94f4aed72 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
@@ -44,11 +44,12 @@ public class DozeWallpaperStateTest extends SysuiTestCase {
private DozeWallpaperState mDozeWallpaperState;
@Mock IWallpaperManager mIWallpaperManager;
@Mock DozeParameters mDozeParameters;
+ @Mock DozeMachine mMachine;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- mDozeWallpaperState = new DozeWallpaperState(mIWallpaperManager, mDozeParameters);
+ mDozeWallpaperState = new DozeWallpaperState(mMachine, mIWallpaperManager, mDozeParameters);
}
@Test
@@ -108,14 +109,28 @@ public class DozeWallpaperStateTest extends SysuiTestCase {
}
@Test
- public void testTransitionTo_pulseIsAmbientMode() throws RemoteException {
+ public void testTransitionTo_notificationPulseIsAmbientMode() throws RemoteException {
+ when(mMachine.getPulseReason()).thenReturn(DozeLog.PULSE_REASON_NOTIFICATION);
mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_REQUEST_PULSE,
DozeMachine.State.DOZE_PULSING);
verify(mIWallpaperManager).setInAmbientMode(eq(true), eq(0L));
}
@Test
+ public void testTransitionTo_wakeFromPulseIsNotAmbientMode() throws RemoteException {
+ when(mMachine.getPulseReason()).thenReturn(DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN);
+ mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_AOD,
+ DozeMachine.State.DOZE_REQUEST_PULSE);
+ reset(mIWallpaperManager);
+
+ mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_REQUEST_PULSE,
+ DozeMachine.State.DOZE_PULSING);
+ verify(mIWallpaperManager).setInAmbientMode(eq(false), anyLong());
+ }
+
+ @Test
public void testTransitionTo_animatesWhenWakingUpFromPulse() throws RemoteException {
+ when(mMachine.getPulseReason()).thenReturn(DozeLog.PULSE_REASON_NOTIFICATION);
mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_REQUEST_PULSE,
DozeMachine.State.DOZE_PULSING);
reset(mIWallpaperManager);