Merge "Fix wallpaper showing on AOD" into sc-dev
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
<bool name="flag_conversations">false</bool>
|
<bool name="flag_conversations">false</bool>
|
||||||
|
|
||||||
<!-- The new animations to/from lockscreen and AOD! -->
|
<!-- The new animations to/from lockscreen and AOD! -->
|
||||||
<bool name="flag_lockscreen_animations">false</bool>
|
<bool name="flag_lockscreen_animations">true</bool>
|
||||||
|
|
||||||
<!-- The new swipe to unlock animation, which shows the app/launcher behind the keyguard during
|
<!-- The new swipe to unlock animation, which shows the app/launcher behind the keyguard during
|
||||||
the swipe. -->
|
the swipe. -->
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.graphics.Shader
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
|
import java.util.function.Consumer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides methods to modify the various properties of a [LightRevealScrim] to reveal between 0% to
|
* Provides methods to modify the various properties of a [LightRevealScrim] to reveal between 0% to
|
||||||
@@ -148,6 +149,8 @@ class PowerButtonReveal(
|
|||||||
*/
|
*/
|
||||||
class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
|
class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
|
||||||
|
|
||||||
|
lateinit var revealAmountListener: Consumer<Float>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How much of the underlying views are revealed, in percent. 0 means they will be completely
|
* How much of the underlying views are revealed, in percent. 0 means they will be completely
|
||||||
* obscured and 1 means they'll be fully visible.
|
* obscured and 1 means they'll be fully visible.
|
||||||
@@ -158,6 +161,7 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
|
|||||||
field = value
|
field = value
|
||||||
|
|
||||||
revealEffect.setRevealAmountOnScrim(value, this)
|
revealEffect.setRevealAmountOnScrim(value, this)
|
||||||
|
revealAmountListener.accept(value)
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,6 +181,12 @@ public interface NotificationShadeWindowController extends RemoteInputController
|
|||||||
*/
|
*/
|
||||||
default void setFaceAuthDisplayBrightness(float brightness) {}
|
default void setFaceAuthDisplayBrightness(float brightness) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How much {@link LightRevealScrim} obscures the UI.
|
||||||
|
* @param amount 0 when opaque, 1 when not transparent
|
||||||
|
*/
|
||||||
|
default void setLightRevealScrimAmount(float amount) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom listener to pipe data back to plugins about whether or not the status bar would be
|
* Custom listener to pipe data back to plugins about whether or not the status bar would be
|
||||||
* collapsed if not for the plugin.
|
* collapsed if not for the plugin.
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
private void applyKeyguardFlags(State state) {
|
private void applyKeyguardFlags(State state) {
|
||||||
final boolean scrimsOccludingWallpaper =
|
final boolean scrimsOccludingWallpaper =
|
||||||
state.mScrimsVisibility == ScrimController.OPAQUE;
|
state.mScrimsVisibility == ScrimController.OPAQUE || state.mLightRevealScrimOpaque;
|
||||||
final boolean keyguardOrAod = state.mKeyguardShowing
|
final boolean keyguardOrAod = state.mKeyguardShowing
|
||||||
|| (state.mDozing && mDozeParameters.getAlwaysOn());
|
|| (state.mDozing && mDozeParameters.getAlwaysOn());
|
||||||
if ((keyguardOrAod && !state.mBackdropShowing && !scrimsOccludingWallpaper)
|
if ((keyguardOrAod && !state.mBackdropShowing && !scrimsOccludingWallpaper)
|
||||||
@@ -569,6 +569,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLightRevealScrimAmount(float amount) {
|
||||||
|
boolean lightRevealScrimOpaque = amount == 0;
|
||||||
|
if (mCurrentState.mLightRevealScrimOpaque == lightRevealScrimOpaque) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mCurrentState.mLightRevealScrimOpaque = lightRevealScrimOpaque;
|
||||||
|
apply(mCurrentState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
|
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
|
||||||
mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
|
mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
|
||||||
@@ -734,6 +744,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
boolean mKeyguardGoingAway;
|
boolean mKeyguardGoingAway;
|
||||||
boolean mQsExpanded;
|
boolean mQsExpanded;
|
||||||
boolean mHeadsUpShowing;
|
boolean mHeadsUpShowing;
|
||||||
|
boolean mLightRevealScrimOpaque;
|
||||||
boolean mForceCollapsed;
|
boolean mForceCollapsed;
|
||||||
boolean mForceDozeBrightness;
|
boolean mForceDozeBrightness;
|
||||||
int mFaceAuthDisplayBrightness;
|
int mFaceAuthDisplayBrightness;
|
||||||
|
|||||||
@@ -1243,6 +1243,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront, scrimForBubble);
|
mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront, scrimForBubble);
|
||||||
|
|
||||||
mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim);
|
mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim);
|
||||||
|
mLightRevealScrim.setRevealAmountListener(
|
||||||
|
mNotificationShadeWindowController::setLightRevealScrimAmount);
|
||||||
mUnlockedScreenOffAnimationController.initialize(this, mLightRevealScrim);
|
mUnlockedScreenOffAnimationController.initialize(this, mLightRevealScrim);
|
||||||
updateLightRevealScrimVisibility();
|
updateLightRevealScrimVisibility();
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager, mKeyguardStateController,
|
mColorExtractor, mDumpManager, mKeyguardStateController,
|
||||||
mUnlockedScreenOffAnimationController);
|
mUnlockedScreenOffAnimationController);
|
||||||
|
mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {});
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
|
|
||||||
mNotificationShadeWindowController.attach();
|
mNotificationShadeWindowController.attach();
|
||||||
@@ -137,6 +138,28 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) != 0).isTrue();
|
assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) != 0).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void attach_lightScrimHidesWallpaper() {
|
||||||
|
when(mKeyguardViewMediator.isShowingAndNotOccluded()).thenReturn(true);
|
||||||
|
mNotificationShadeWindowController.attach();
|
||||||
|
|
||||||
|
clearInvocations(mWindowManager);
|
||||||
|
mNotificationShadeWindowController.setLightRevealScrimAmount(0f);
|
||||||
|
verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
|
||||||
|
assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) == 0).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void attach_scrimHidesWallpaper() {
|
||||||
|
when(mKeyguardViewMediator.isShowingAndNotOccluded()).thenReturn(true);
|
||||||
|
mNotificationShadeWindowController.attach();
|
||||||
|
|
||||||
|
clearInvocations(mWindowManager);
|
||||||
|
mNotificationShadeWindowController.setScrimsVisibility(ScrimController.OPAQUE);
|
||||||
|
verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
|
||||||
|
assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) == 0).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void attach_animatingKeyguardAndSurface_wallpaperVisible() {
|
public void attach_animatingKeyguardAndSurface_wallpaperVisible() {
|
||||||
clearInvocations(mWindowManager);
|
clearInvocations(mWindowManager);
|
||||||
|
|||||||
Reference in New Issue
Block a user