Merge changes I09f58bdc,Iaf6cee33 into pi-dev
am: b5438ce105
Change-Id: I0e90c930d11e7909d8a519b5714dd2ef3fa6e338
This commit is contained in:
@@ -158,6 +158,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
|
||||
|
||||
private final WakeLock mWakeLock;
|
||||
private boolean mWakeLockHeld;
|
||||
private boolean mKeyguardOccluded;
|
||||
|
||||
public ScrimController(LightBarController lightBarController, ScrimView scrimBehind,
|
||||
ScrimView scrimInFront, View headsUpScrim, Consumer<Integer> scrimVisibleListener,
|
||||
@@ -268,12 +269,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
|
||||
|
||||
// AOD wallpapers should fade away after a while
|
||||
if (mWallpaperSupportsAmbientMode && mDozeParameters.getAlwaysOn()
|
||||
&& (mState == ScrimState.AOD || mState == ScrimState.PULSING)) {
|
||||
&& mState == ScrimState.AOD) {
|
||||
if (!mWallpaperVisibilityTimedOut) {
|
||||
mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
|
||||
AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
|
||||
}
|
||||
} else {
|
||||
// Do not re-schedule timeout when pulsing, let's save some extra battery.
|
||||
} else if (mState != ScrimState.PULSING) {
|
||||
mTimeTicker.cancel();
|
||||
mWallpaperVisibilityTimedOut = false;
|
||||
}
|
||||
@@ -317,7 +319,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
|
||||
|
||||
@VisibleForTesting
|
||||
protected void onHideWallpaperTimeout() {
|
||||
if (mState != ScrimState.AOD && mState != ScrimState.PULSING) {
|
||||
if (mState != ScrimState.AOD) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -478,11 +480,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
|
||||
mLightBarController.setScrimColor(mScrimInFront.getColors());
|
||||
}
|
||||
|
||||
// We want to override the back scrim opacity for AOD and PULSING
|
||||
// We want to override the back scrim opacity for the AOD state
|
||||
// when it's time to fade the wallpaper away.
|
||||
boolean overrideBackScrimAlpha = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
|
||||
&& mWallpaperVisibilityTimedOut;
|
||||
if (overrideBackScrimAlpha) {
|
||||
boolean aodWallpaperTimeout = mState == ScrimState.AOD && mWallpaperVisibilityTimedOut;
|
||||
// We also want to hide FLAG_SHOW_WHEN_LOCKED activities under the scrim.
|
||||
boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
|
||||
&& mKeyguardOccluded;
|
||||
if (aodWallpaperTimeout || occludedKeyguard) {
|
||||
mCurrentBehindAlpha = 1;
|
||||
}
|
||||
|
||||
@@ -926,6 +930,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
|
||||
mExpansionAffectsAlpha = expansionAffectsAlpha;
|
||||
}
|
||||
|
||||
public void setKeyguardOccluded(boolean keyguardOccluded) {
|
||||
mKeyguardOccluded = keyguardOccluded;
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
default void onStart() {
|
||||
}
|
||||
|
||||
@@ -2040,6 +2040,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
public void setOccluded(boolean occluded) {
|
||||
mIsOccluded = occluded;
|
||||
mScrimController.setKeyguardOccluded(occluded);
|
||||
updateHideIconsForBouncer(false /* animate */);
|
||||
}
|
||||
|
||||
|
||||
@@ -475,6 +475,19 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
Assert.assertTrue("Should be focusable on keyguard", mScrimInFront.isFocusable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHidesShowWhenLockedActivity() {
|
||||
mScrimController.setWallpaperSupportsAmbientMode(true);
|
||||
mScrimController.setKeyguardOccluded(true);
|
||||
mScrimController.transitionTo(ScrimState.AOD);
|
||||
mScrimController.finishAnimationsImmediately();
|
||||
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||
|
||||
mScrimController.transitionTo(ScrimState.PULSING);
|
||||
mScrimController.finishAnimationsImmediately();
|
||||
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Conserves old notification density after leaving state and coming back.
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@ import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -547,6 +548,16 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetOccluded_propagatesToScrimController() {
|
||||
mStatusBar.setOccluded(true);
|
||||
verify(mScrimController).setKeyguardOccluded(eq(true));
|
||||
|
||||
reset(mScrimController);
|
||||
mStatusBar.setOccluded(false);
|
||||
verify(mScrimController).setKeyguardOccluded(eq(false));
|
||||
}
|
||||
|
||||
static class TestableStatusBar extends StatusBar {
|
||||
public TestableStatusBar(StatusBarKeyguardViewManager man,
|
||||
UnlockMethodCache unlock, KeyguardIndicationController key,
|
||||
|
||||
Reference in New Issue
Block a user