Resetting shade state when unfolding on keyguard

When we know we're changing fold state and on keyguard we want to make sure shade state is reset - by making sure QS are closed.
Then keyguard is brought back to its default state with shade closed.

Fixes: 201537421
Test: In folded state in keyguard expand QS -> unfold device -> you should see keyguard and not expanded QS
Change-Id: Idf33920759c4825ad8fbda0115071d7785ec7223
This commit is contained in:
Michal Brzezinski
2022-01-10 14:37:57 +00:00
parent 0eebf348e4
commit a7dc64adc1
2 changed files with 21 additions and 6 deletions

View File

@@ -618,6 +618,8 @@ public class StatusBar extends CoreStartable implements
protected boolean mDozing;
private boolean mIsFullscreen;
boolean mCloseQsBeforeScreenOff;
private final NotificationMediaManager mMediaManager;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final NotificationRemoteInputManager mRemoteInputManager;
@@ -1123,6 +1125,15 @@ public class StatusBar extends CoreStartable implements
}
if (leaveOpen) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(true);
if (mIsKeyguard) {
// 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
// that causes incorrect UI rendering, especially when changing state with QS
// expanded. To prevent that we can close QS which resets QS and some parts of
// the shade to its default state. Read more in b/201537421
mCloseQsBeforeScreenOff = true;
}
}
}
@@ -2908,10 +2919,10 @@ public class StatusBar extends CoreStartable implements
}
boolean updateIsKeyguard() {
return updateIsKeyguard(false /* force */);
return updateIsKeyguard(false /* forceStateChange */);
}
boolean updateIsKeyguard(boolean force) {
boolean updateIsKeyguard(boolean forceStateChange) {
boolean wakeAndUnlocking = mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
@@ -2944,7 +2955,7 @@ public class StatusBar extends CoreStartable implements
// as the animation could prepare 'fake AOD' interface (without actually
// transitioning to keyguard state) and this might reset the view states
if (!mScreenOffAnimationController.isKeyguardHideDelayed()) {
return hideKeyguardImpl(force);
return hideKeyguardImpl(forceStateChange);
}
}
return false;
@@ -3072,12 +3083,12 @@ public class StatusBar 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 force) {
public boolean hideKeyguardImpl(boolean forceStateChange) {
mIsKeyguard = false;
Trace.beginSection("StatusBar#hideKeyguard");
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
int previousState = mStatusBarStateController.getState();
if (!(mStatusBarStateController.setState(StatusBarState.SHADE, force))) {
if (!(mStatusBarStateController.setState(StatusBarState.SHADE, forceStateChange))) {
//TODO: StatusBarStateController should probably know about hiding the keyguard and
// notify listeners.
@@ -3627,6 +3638,10 @@ public class StatusBar extends CoreStartable implements
public void onScreenTurnedOff() {
mFalsingCollector.onScreenOff();
mScrimController.onScreenTurnedOff();
if (mCloseQsBeforeScreenOff) {
mNotificationPanelViewController.closeQs();
mCloseQsBeforeScreenOff = false;
}
updateIsKeyguard();
}
};

View File

@@ -218,7 +218,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
// even if we're going from SHADE to SHADE or KEYGUARD to KEYGUARD, since we might have
// changed parts of the UI (such as showing AOD in the shade) without actually changing
// the StatusBarState. This ensures that the UI definitely reflects the desired state.
statusBar.updateIsKeyguard(true /* force */)
statusBar.updateIsKeyguard(true /* forceStateChange */)
}
}