summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Dupin <dupin@google.com>2021-07-01 19:30:09 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-07-01 19:30:09 +0000
commit87065aa1d2f577e73273453abc2bc6f87c2ee69a (patch)
tree8ed927e947d221a3fb58dc89e9688e3d15365185
parent55f1f3ef7f0aada55bef95d0226b208c98116afe (diff)
parent6b9f1a5e2a60d334cad0ea9b280d556602ccf19a (diff)
Merge "Fix wallpaper showing on AOD" into sc-dev am: 6b9f1a5e2a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15176330 Change-Id: I37a1df9d10aa9396d6a45716286d81ea80cf5f5c
-rw-r--r--packages/SystemUI/res/values/flags.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java23
6 files changed, 48 insertions, 2 deletions
diff --git a/packages/SystemUI/res/values/flags.xml b/packages/SystemUI/res/values/flags.xml
index b999e51bdaa5..7a4403260415 100644
--- a/packages/SystemUI/res/values/flags.xml
+++ b/packages/SystemUI/res/values/flags.xml
@@ -34,7 +34,7 @@
<bool name="flag_conversations">false</bool>
<!-- 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 swipe. -->
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt
index 5d8bed57563b..538db6168408 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt
@@ -14,6 +14,7 @@ import android.graphics.Shader
import android.util.AttributeSet
import android.view.View
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
@@ -148,6 +149,8 @@ class PowerButtonReveal(
*/
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
* obscured and 1 means they'll be fully visible.
@@ -158,6 +161,7 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
field = value
revealEffect.setRevealAmountOnScrim(value, this)
+ revealAmountListener.accept(value)
invalidate()
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java
index 045a1976d502..f0d779ce1e0f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java
@@ -182,6 +182,12 @@ public interface NotificationShadeWindowController extends RemoteInputController
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
* collapsed if not for the plugin.
* TODO: Find cleaner way to do this.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java
index ae36e1a09d92..a45ef942ed63 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java
@@ -254,7 +254,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
private void applyKeyguardFlags(State state) {
final boolean scrimsOccludingWallpaper =
- state.mScrimsVisibility == ScrimController.OPAQUE;
+ state.mScrimsVisibility == ScrimController.OPAQUE || state.mLightRevealScrimOpaque;
final boolean keyguardOrAod = state.mKeyguardShowing
|| (state.mDozing && mDozeParameters.getAlwaysOn());
if ((keyguardOrAod && !state.mBackdropShowing && !scrimsOccludingWallpaper)
@@ -571,6 +571,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
}
@Override
+ public void setLightRevealScrimAmount(float amount) {
+ boolean lightRevealScrimOpaque = amount == 0;
+ if (mCurrentState.mLightRevealScrimOpaque == lightRevealScrimOpaque) {
+ return;
+ }
+ mCurrentState.mLightRevealScrimOpaque = lightRevealScrimOpaque;
+ apply(mCurrentState);
+ }
+
+ @Override
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
apply(mCurrentState);
@@ -735,6 +745,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
boolean mKeyguardGoingAway;
boolean mQsExpanded;
boolean mHeadsUpShowing;
+ boolean mLightRevealScrimOpaque;
boolean mForceCollapsed;
boolean mForceDozeBrightness;
int mFaceAuthDisplayBrightness;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 61a0d637e79d..2a41c906ee0a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1243,6 +1243,8 @@ public class StatusBar extends SystemUI implements DemoMode,
mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront, scrimForBubble);
mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim);
+ mLightRevealScrim.setRevealAmountListener(
+ mNotificationShadeWindowController::setLightRevealScrimAmount);
mUnlockedScreenOffAnimationController.initialize(this, mLightRevealScrim);
updateLightRevealScrimVisibility();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java
index b03712c2d997..038645637f21 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java
@@ -88,6 +88,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
mColorExtractor, mDumpManager, mKeyguardStateController,
mUnlockedScreenOffAnimationController);
+ mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {});
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowController.attach();
@@ -138,6 +139,28 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
}
@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
public void attach_animatingKeyguardAndSurface_wallpaperVisible() {
clearInvocations(mWindowManager);
when(mKeyguardViewMediator.isShowingAndNotOccluded()).thenReturn(true);