From 8f95a348fa6f4e512b59ed759710b0f0731a3085 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Thu, 3 Mar 2022 08:14:47 -0500 Subject: [PATCH 1/2] Scrim was flickering on FPS unlock After inspecting traces, the scrim state was flickering between UNLOCKED -> KEYGUARD -> UNLOCKED within a few hundred millis after unlocking the device. This could produce an inconsistency in state, where CentralSurfaces thinks keyguardShowing=true but KeyguardStateController thinks keyguardShowing=false. When the CentralSurfaces#updateScrimController(), the code was checking both locations and getting a different answer. Remove mKeyguard from CentralSurfaces and rely on KeyguardStateController Fixes: 221732271 Test: atest CentralSurfacesTest and manual locks/unlocks Change-Id: I6b2ce8e01ac9e61bd31c6928a20303347af79583 --- .../systemui/statusbar/phone/CentralSurfaces.java | 10 ++++------ .../systemui/statusbar/phone/CentralSurfacesTest.java | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index 84adc5679a814..95a4659892995 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -663,7 +663,6 @@ public class CentralSurfaces extends CoreStartable implements protected final BatteryController mBatteryController; protected boolean mPanelExpanded; private UiModeManager mUiModeManager; - protected boolean mIsKeyguard; private LogMaker mStatusBarStateLog; protected final NotificationIconAreaController mNotificationIconAreaController; @Nullable private View mAmbientIndicationContainer; @@ -1142,7 +1141,7 @@ public class CentralSurfaces extends CoreStartable implements } if (leaveOpen) { mStatusBarStateController.setLeaveOpenOnKeyguardHide(true); - if (mIsKeyguard) { + if (mKeyguardStateController.isShowing()) { // When device state changes on keyguard we don't want to keep the state of // the shade and instead we open clean state of keyguard with shade closed. // Normally some parts of QS state (like expanded/collapsed) are persisted and @@ -2890,7 +2889,8 @@ public class CentralSurfaces extends CoreStartable implements // late in the transition, so we also allow the device to start dozing once the screen has // turned off fully. boolean keyguardForDozing = mDozeServiceHost.getDozingRequested() - && (!mDeviceInteractive || isGoingToSleep() && (isScreenFullyOff() || mIsKeyguard)); + && (!mDeviceInteractive || (isGoingToSleep() + && (isScreenFullyOff() || mKeyguardStateController.isShowing()))); boolean isWakingAndOccluded = isOccluded() && isWaking(); boolean shouldBeKeyguard = (mStatusBarStateController.isKeyguardRequested() || keyguardForDozing) && !wakeAndUnlocking && !isWakingAndOccluded; @@ -2923,7 +2923,6 @@ public class CentralSurfaces extends CoreStartable implements public void showKeyguardImpl() { Trace.beginSection("CentralSurfaces#showKeyguard"); - mIsKeyguard = true; // In case we're locking while a smartspace transition is in progress, reset it. mKeyguardUnlockAnimationController.resetSmartspaceTransition(); if (mKeyguardStateController.isLaunchTransitionFadingAway()) { @@ -3044,7 +3043,6 @@ public class CentralSurfaces extends CoreStartable implements * @return true if we would like to stay in the shade, false if it should go away entirely */ public boolean hideKeyguardImpl(boolean forceStateChange) { - mIsKeyguard = false; Trace.beginSection("CentralSurfaces#hideKeyguard"); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); int previousState = mStatusBarStateController.getState(); @@ -3771,7 +3769,7 @@ public class CentralSurfaces extends CoreStartable implements }); } else if (mDozing && !unlocking) { mScrimController.transitionTo(ScrimState.AOD); - } else if (mIsKeyguard && !unlocking) { + } else if (mKeyguardStateController.isShowing() && !unlocking) { mScrimController.transitionTo(ScrimState.KEYGUARD); } else { mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java index 953a330d2e65c..3810783d4f768 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesTest.java @@ -846,6 +846,7 @@ public class CentralSurfacesTest extends SysuiTestCase { @Test public void testTransitionLaunch_noPreview_doesntGoUnlocked() { mCentralSurfaces.setBarStateForTest(StatusBarState.KEYGUARD); + when(mKeyguardStateController.isShowing()).thenReturn(true); mCentralSurfaces.showKeyguardImpl(); // Starting a pulse should change the scrim controller to the pulsing state @@ -868,6 +869,7 @@ public class CentralSurfacesTest extends SysuiTestCase { @Test public void testPulseWhileDozing_updatesScrimController() { mCentralSurfaces.setBarStateForTest(StatusBarState.KEYGUARD); + when(mKeyguardStateController.isShowing()).thenReturn(true); mCentralSurfaces.showKeyguardImpl(); // Starting a pulse should change the scrim controller to the pulsing state From 31a1892fdaaa8bc2857fd1e909066e961bff25b0 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Thu, 3 Mar 2022 08:50:59 -0500 Subject: [PATCH 2/2] Remove temp user creation activity Supervised user creation required a temporary activity until it could be properly implemented. Bug: 209659998 Test: Add supervised user Change-Id: I3aae23a5782f8c58ed137e0fc96dd41bdebe2784 --- .../systemui/statusbar/policy/UserSwitcherController.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index d1c9b3f1c2c50..dd9982ba20d69 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -584,13 +584,6 @@ public class UserSwitcherController implements Dumpable { .setPackage(mCreateSupervisedUserPackage) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - // TODO(b/209659998): [to-be-removed] fallback activity for supervised user creation. - if (mContext.getPackageManager().resolveActivity(intent, 0) == null) { - intent.setPackage(null) - .setClassName("com.android.settings", - "com.android.settings.users.AddSupervisedUserActivity"); - } - mContext.startActivity(intent); }