Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +8 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,14 @@ public class DozeScrimController implements StateListener { public void onCancelled() { pulseFinished(); } /** * Whether to fade out wallpaper. */ @Override public boolean isFadeOutWallpaper() { return mPulseReason == DozeLog.PULSE_REASON_DOCKING; } }; public DozeScrimController(DozeParameters dozeParameters) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +12 −5 Original line number Diff line number Diff line Loading @@ -275,9 +275,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo holdWakeLock(); } // AOD wallpapers should fade away after a while if (mWallpaperSupportsAmbientMode && mDozeParameters.getAlwaysOn() && mState == ScrimState.AOD) { // 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 && mCallback.isFadeOutWallpaper())) { if (!mWallpaperVisibilityTimedOut) { mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(), AlarmTimeout.MODE_IGNORE_IF_SCHEDULED); Loading Loading @@ -329,7 +332,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo @VisibleForTesting protected void onHideWallpaperTimeout() { if (mState != ScrimState.AOD) { if (mState != ScrimState.AOD && mState != ScrimState.PULSING) { return; } Loading Loading @@ -504,7 +507,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo // We want to override the back scrim opacity for the AOD state // when it's time to fade the wallpaper away. boolean aodWallpaperTimeout = mState == ScrimState.AOD && mWallpaperVisibilityTimedOut; boolean aodWallpaperTimeout = (mState == ScrimState.AOD || mState == ScrimState.PULSING) && mWallpaperVisibilityTimedOut; // We also want to hide FLAG_SHOW_WHEN_LOCKED activities under the scrim. boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD) && mKeyguardOccluded; Loading Loading @@ -917,6 +921,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo } default void onCancelled() { } default boolean isFadeOutWallpaper() { return false; } } /** Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +49 −1 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ public class ScrimControllerTest extends SysuiTestCase { }, visible -> mScrimVisibility = visible, mDozeParamenters, mAlarmManager); mScrimController.setHasBackdrop(false); mScrimController.setWallpaperSupportsAmbientMode(false); } @Test Loading Loading @@ -473,6 +474,26 @@ public class ScrimControllerTest extends SysuiTestCase { verify(mWakeLock).release(); } @Test public void testHoldsPulsingWallpaperAnimationLock() { // Pre-conditions mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() { @Override public boolean isFadeOutWallpaper() { return true; } }); mScrimController.finishAnimationsImmediately(); reset(mWakeLock); mScrimController.onHideWallpaperTimeout(); verify(mWakeLock).acquire(); verify(mWakeLock, never()).release(); mScrimController.finishAnimationsImmediately(); verify(mWakeLock).release(); assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE); } @Test public void testWillHideAodWallpaper() { mScrimController.setWallpaperSupportsAmbientMode(true); Loading @@ -482,6 +503,34 @@ public class ScrimControllerTest extends SysuiTestCase { verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class)); } @Test public void testWillHidePulsingWallpaper_withRequestFadeOut() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() { @Override public boolean isFadeOutWallpaper() { return true; } }); verify(mAlarmManager).setExact(anyInt(), anyLong(), any(), any(), any()); mScrimController.transitionTo(ScrimState.KEYGUARD); verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class)); } @Test public void testDoesNotHidePulsingWallpaper_withoutRequestFadeOut() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() {}); verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any()); } @Test public void testDoesNotHidePulsingWallpaper_withoutCallback() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING); verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any()); } @Test public void testConservesExpansionOpacityAfterTransition() { mScrimController.transitionTo(ScrimState.UNLOCKED); Loading Loading @@ -738,5 +787,4 @@ public class ScrimControllerTest extends SysuiTestCase { callback.run(); } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +8 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,14 @@ public class DozeScrimController implements StateListener { public void onCancelled() { pulseFinished(); } /** * Whether to fade out wallpaper. */ @Override public boolean isFadeOutWallpaper() { return mPulseReason == DozeLog.PULSE_REASON_DOCKING; } }; public DozeScrimController(DozeParameters dozeParameters) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +12 −5 Original line number Diff line number Diff line Loading @@ -275,9 +275,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo holdWakeLock(); } // AOD wallpapers should fade away after a while if (mWallpaperSupportsAmbientMode && mDozeParameters.getAlwaysOn() && mState == ScrimState.AOD) { // 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 && mCallback.isFadeOutWallpaper())) { if (!mWallpaperVisibilityTimedOut) { mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(), AlarmTimeout.MODE_IGNORE_IF_SCHEDULED); Loading Loading @@ -329,7 +332,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo @VisibleForTesting protected void onHideWallpaperTimeout() { if (mState != ScrimState.AOD) { if (mState != ScrimState.AOD && mState != ScrimState.PULSING) { return; } Loading Loading @@ -504,7 +507,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo // We want to override the back scrim opacity for the AOD state // when it's time to fade the wallpaper away. boolean aodWallpaperTimeout = mState == ScrimState.AOD && mWallpaperVisibilityTimedOut; boolean aodWallpaperTimeout = (mState == ScrimState.AOD || mState == ScrimState.PULSING) && mWallpaperVisibilityTimedOut; // We also want to hide FLAG_SHOW_WHEN_LOCKED activities under the scrim. boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD) && mKeyguardOccluded; Loading Loading @@ -917,6 +921,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo } default void onCancelled() { } default boolean isFadeOutWallpaper() { return false; } } /** Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +49 −1 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ public class ScrimControllerTest extends SysuiTestCase { }, visible -> mScrimVisibility = visible, mDozeParamenters, mAlarmManager); mScrimController.setHasBackdrop(false); mScrimController.setWallpaperSupportsAmbientMode(false); } @Test Loading Loading @@ -473,6 +474,26 @@ public class ScrimControllerTest extends SysuiTestCase { verify(mWakeLock).release(); } @Test public void testHoldsPulsingWallpaperAnimationLock() { // Pre-conditions mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() { @Override public boolean isFadeOutWallpaper() { return true; } }); mScrimController.finishAnimationsImmediately(); reset(mWakeLock); mScrimController.onHideWallpaperTimeout(); verify(mWakeLock).acquire(); verify(mWakeLock, never()).release(); mScrimController.finishAnimationsImmediately(); verify(mWakeLock).release(); assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE); } @Test public void testWillHideAodWallpaper() { mScrimController.setWallpaperSupportsAmbientMode(true); Loading @@ -482,6 +503,34 @@ public class ScrimControllerTest extends SysuiTestCase { verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class)); } @Test public void testWillHidePulsingWallpaper_withRequestFadeOut() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() { @Override public boolean isFadeOutWallpaper() { return true; } }); verify(mAlarmManager).setExact(anyInt(), anyLong(), any(), any(), any()); mScrimController.transitionTo(ScrimState.KEYGUARD); verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class)); } @Test public void testDoesNotHidePulsingWallpaper_withoutRequestFadeOut() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() {}); verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any()); } @Test public void testDoesNotHidePulsingWallpaper_withoutCallback() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.PULSING); verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any()); } @Test public void testConservesExpansionOpacityAfterTransition() { mScrimController.transitionTo(ScrimState.UNLOCKED); Loading Loading @@ -738,5 +787,4 @@ public class ScrimControllerTest extends SysuiTestCase { callback.run(); } } }