Loading packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -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) }); Loading packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +11 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +2 −3 Original line number Diff line number Diff line Loading @@ -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); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +2 −1 Original line number Diff line number Diff line Loading @@ -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 { Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java +17 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading Loading
packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -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) }); Loading
packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +11 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +2 −3 Original line number Diff line number Diff line Loading @@ -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); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +2 −1 Original line number Diff line number Diff line Loading @@ -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 { Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java +17 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading