summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Josh Tsuji <tsuji@google.com> 2023-01-24 23:58:25 -0400
committer Josh Tsuji <tsuji@google.com> 2023-03-15 21:23:58 +0000
commit88885b0e68fc1327ebf20ce70d36df82112b36c7 (patch)
tree372eb6fd2ac7b6ac790506716f1b98afaf46a706
parentfe532fc2cb84616db8c56c5ff3f23d21dbd112c1 (diff)
Keep keyguard visible if we're launching an occluding activity over a going-away keyguard.
This happens when bypass is enabled - the occluding activity launches over the keyguard visually, but the keyguard is going away since it's being dismissed by the launch. We weren't checking for this case, so we were allowing keyguard to be hidden, showing the shade UI. Additionally, we need to keep the wallpaper around to prevent the keyguard UI from showing over a black backdrop during this animation. Fixes: 266630755 Test: launch occluding activity over unlocked lockscreen w/ bypass enabled Change-Id: I5a7df7df5aa5339276470529e7164475c6e99e13
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java15
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java12
5 files changed, 45 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index fdaeeee26812..ce479bb60721 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -2732,6 +2732,7 @@ public final class NotificationPanelViewController implements Dumpable {
public void setIsLaunchAnimationRunning(boolean running) {
boolean wasRunning = mIsLaunchAnimationRunning;
mIsLaunchAnimationRunning = running;
+ mCentralSurfaces.updateIsKeyguard();
if (wasRunning != mIsLaunchAnimationRunning) {
mShadeExpansionStateManager.notifyLaunchingActivityChanged(running);
}
@@ -3792,6 +3793,10 @@ public final class NotificationPanelViewController implements Dumpable {
return mClosing || mIsLaunchAnimationRunning;
}
+ public boolean isLaunchAnimationRunning() {
+ return mIsLaunchAnimationRunning;
+ }
+
public boolean isTracking() {
return mTracking;
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
index 156e4fd1889f..e7759df6e81b 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
@@ -301,9 +301,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
}
private void applyKeyguardFlags(NotificationShadeWindowState state) {
- final boolean keyguardOrAod = state.keyguardShowing
+ // Keyguard is visible if it's showing or if it's fading away (in which case we're animating
+ // it out, but the wallpaper should remain visible as a backdrop for the animation);
+ final boolean keyguardOrAodVisible = (state.keyguardShowing || state.keyguardFadingAway)
|| (state.dozing && mDozeParameters.getAlwaysOn());
- if ((keyguardOrAod && !state.mediaBackdropShowing && !state.lightRevealScrimOpaque)
+ if ((keyguardOrAodVisible && !state.mediaBackdropShowing && !state.lightRevealScrimOpaque)
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehind()) {
// Show the wallpaper if we're on keyguard/AOD and the wallpaper is not occluded by a
// solid backdrop. Also, show it if we are currently animating between the
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 5131772e34a0..191302547458 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -1007,6 +1007,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
// The light reveal scrim should always be fully revealed by the time the keyguard
// is done going away. Double check that this is true.
if (!mKeyguardStateController.isKeyguardGoingAway()) {
+ updateIsKeyguard();
+
if (mLightRevealScrim.getRevealAmount() != 1f) {
Log.e(TAG, "Keyguard is done going away, but someone left the light reveal "
+ "scrim at reveal amount: " + mLightRevealScrim.getRevealAmount());
@@ -2893,6 +2895,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
showKeyguardImpl();
}
} else {
+ final boolean isLaunchingOrGoingAway =
+ mNotificationPanelViewController.isLaunchAnimationRunning()
+ || mKeyguardStateController.isKeyguardGoingAway();
+
// During folding a foldable device this might be called as a result of
// 'onScreenTurnedOff' call for the inner display.
// In this case:
@@ -2904,7 +2910,14 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
if (!mScreenOffAnimationController.isKeyguardHideDelayed()
// If we're animating occluded, there's an activity launching over the keyguard
// UI. Wait to hide it until after the animation concludes.
- && !mKeyguardViewMediator.isOccludeAnimationPlaying()) {
+ && !mKeyguardViewMediator.isOccludeAnimationPlaying()
+ // If we're occluded, but playing an animation (launch or going away animations)
+ // the keyguard is visible behind the animation.
+ && !(mKeyguardStateController.isOccluded() && isLaunchingOrGoingAway)) {
+ // If we're going away and occluded, it means we are launching over the
+ // unsecured keyguard, which will subsequently go away. Wait to hide it until
+ // after the animation concludes to avoid the lockscreen UI changing into the
+ // shade UI behind the launch animation.
return hideKeyguardImpl(forceStateChange);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
index 526dc8d150fe..dd7929771bb2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
@@ -223,6 +223,16 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
}
@Test
+ public void attach_fadingAway_wallpaperVisible() {
+ clearInvocations(mWindowManager);
+ mNotificationShadeWindowController.attach();
+ mNotificationShadeWindowController.setKeyguardFadingAway(true);
+
+ verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
+ assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) != 0).isTrue();
+ }
+
+ @Test
public void setBackgroundBlurRadius_expandedWithBlurs() {
mNotificationShadeWindowController.setBackgroundBlurRadius(10);
verify(mNotificationShadeWindowView).setVisibility(eq(View.VISIBLE));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 98f5a10aa203..b68297f3e531 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -1288,6 +1288,18 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
}
@Test
+ public void keyguard_notHidden_ifGoingAwayAndOccluded() {
+ setKeyguardShowingAndOccluded(true /* showing */, false /* occluded */);
+
+ when(mKeyguardStateController.isKeyguardGoingAway()).thenReturn(true);
+ when(mKeyguardStateController.isOccluded()).thenReturn(true);
+
+ mCentralSurfaces.updateIsKeyguard(false);
+
+ verify(mStatusBarStateController, never()).setState(eq(SHADE), anyBoolean());
+ }
+
+ @Test
public void frpLockedDevice_shadeDisabled() {
when(mDeviceProvisionedController.isFrpActive()).thenReturn(true);
when(mDozeServiceHost.isPulsing()).thenReturn(true);