Merge "Revert^2 "Show bouncer after user switch"" into udc-qpr-dev

This commit is contained in:
Andreas Miko
2023-06-30 09:30:54 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 22 deletions

View File

@@ -544,7 +544,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
public void setOnDismissAction(ActivityStarter.OnDismissAction action, Runnable cancelAction) { public void setOnDismissAction(ActivityStarter.OnDismissAction action, Runnable cancelAction) {
if (mCancelAction != null) { if (mCancelAction != null) {
mCancelAction.run(); mCancelAction.run();
mCancelAction = null;
} }
mDismissAction = action; mDismissAction = action;
mCancelAction = cancelAction; mCancelAction = cancelAction;

View File

@@ -585,17 +585,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
@Override @Override
public void onUserSwitching(int userId) { public void onUserSwitching(int userId) {
if (DEBUG) Log.d(TAG, String.format("onUserSwitching %d", userId)); if (DEBUG) Log.d(TAG, String.format("onUserSwitching %d", userId));
// Note that the mLockPatternUtils user has already been updated from setCurrentUser.
// We need to force a reset of the views, since lockNow (called by
// ActivityManagerService) will not reconstruct the keyguard if it is already showing.
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
resetKeyguardDonePendingLocked(); resetKeyguardDonePendingLocked();
if (mLockPatternUtils.isLockScreenDisabled(userId)) { dismiss(null /* callback */, null /* message */);
// If we are switching to a user that has keyguard disabled, dismiss keyguard.
dismiss(null /* callback */, null /* message */);
} else {
resetStateLocked();
}
adjustStatusBarLocked(); adjustStatusBarLocked();
} }
} }
@@ -603,16 +595,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
@Override @Override
public void onUserSwitchComplete(int userId) { public void onUserSwitchComplete(int userId) {
if (DEBUG) Log.d(TAG, String.format("onUserSwitchComplete %d", userId)); if (DEBUG) Log.d(TAG, String.format("onUserSwitchComplete %d", userId));
if (userId != UserHandle.USER_SYSTEM) { // We are calling dismiss again and with a delay as there are race conditions
UserInfo info = UserManager.get(mContext).getUserInfo(userId); // in some scenarios caused by async layout listeners
// Don't try to dismiss if the user has Pin/Pattern/Password set mHandler.postDelayed(() -> dismiss(null /* callback */, null /* message */), 500);
if (info == null || mLockPatternUtils.isSecure(userId)) {
return;
} else if (info.isGuest() || info.isDemo()) {
// If we just switched to a guest, try to dismiss keyguard.
dismiss(null /* callback */, null /* message */);
}
}
} }
@Override @Override
@@ -2402,58 +2387,72 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
private Handler mHandler = new Handler(Looper.myLooper(), null, true /*async*/) { private Handler mHandler = new Handler(Looper.myLooper(), null, true /*async*/) {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
String message = "";
switch (msg.what) { switch (msg.what) {
case SHOW: case SHOW:
message = "SHOW";
handleShow((Bundle) msg.obj); handleShow((Bundle) msg.obj);
break; break;
case HIDE: case HIDE:
message = "HIDE";
handleHide(); handleHide();
break; break;
case RESET: case RESET:
message = "RESET";
handleReset(msg.arg1 != 0); handleReset(msg.arg1 != 0);
break; break;
case VERIFY_UNLOCK: case VERIFY_UNLOCK:
message = "VERIFY_UNLOCK";
Trace.beginSection("KeyguardViewMediator#handleMessage VERIFY_UNLOCK"); Trace.beginSection("KeyguardViewMediator#handleMessage VERIFY_UNLOCK");
handleVerifyUnlock(); handleVerifyUnlock();
Trace.endSection(); Trace.endSection();
break; break;
case NOTIFY_STARTED_GOING_TO_SLEEP: case NOTIFY_STARTED_GOING_TO_SLEEP:
message = "NOTIFY_STARTED_GOING_TO_SLEEP";
handleNotifyStartedGoingToSleep(); handleNotifyStartedGoingToSleep();
break; break;
case NOTIFY_FINISHED_GOING_TO_SLEEP: case NOTIFY_FINISHED_GOING_TO_SLEEP:
message = "NOTIFY_FINISHED_GOING_TO_SLEEP";
handleNotifyFinishedGoingToSleep(); handleNotifyFinishedGoingToSleep();
break; break;
case NOTIFY_STARTED_WAKING_UP: case NOTIFY_STARTED_WAKING_UP:
message = "NOTIFY_STARTED_WAKING_UP";
Trace.beginSection( Trace.beginSection(
"KeyguardViewMediator#handleMessage NOTIFY_STARTED_WAKING_UP"); "KeyguardViewMediator#handleMessage NOTIFY_STARTED_WAKING_UP");
handleNotifyStartedWakingUp(); handleNotifyStartedWakingUp();
Trace.endSection(); Trace.endSection();
break; break;
case KEYGUARD_DONE: case KEYGUARD_DONE:
message = "KEYGUARD_DONE";
Trace.beginSection("KeyguardViewMediator#handleMessage KEYGUARD_DONE"); Trace.beginSection("KeyguardViewMediator#handleMessage KEYGUARD_DONE");
handleKeyguardDone(); handleKeyguardDone();
Trace.endSection(); Trace.endSection();
break; break;
case KEYGUARD_DONE_DRAWING: case KEYGUARD_DONE_DRAWING:
message = "KEYGUARD_DONE_DRAWING";
Trace.beginSection("KeyguardViewMediator#handleMessage KEYGUARD_DONE_DRAWING"); Trace.beginSection("KeyguardViewMediator#handleMessage KEYGUARD_DONE_DRAWING");
handleKeyguardDoneDrawing(); handleKeyguardDoneDrawing();
Trace.endSection(); Trace.endSection();
break; break;
case SET_OCCLUDED: case SET_OCCLUDED:
message = "SET_OCCLUDED";
Trace.beginSection("KeyguardViewMediator#handleMessage SET_OCCLUDED"); Trace.beginSection("KeyguardViewMediator#handleMessage SET_OCCLUDED");
handleSetOccluded(msg.arg1 != 0, msg.arg2 != 0); handleSetOccluded(msg.arg1 != 0, msg.arg2 != 0);
Trace.endSection(); Trace.endSection();
break; break;
case KEYGUARD_TIMEOUT: case KEYGUARD_TIMEOUT:
message = "KEYGUARD_TIMEOUT";
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
doKeyguardLocked((Bundle) msg.obj); doKeyguardLocked((Bundle) msg.obj);
} }
break; break;
case DISMISS: case DISMISS:
final DismissMessage message = (DismissMessage) msg.obj; message = "DISMISS";
handleDismiss(message.getCallback(), message.getMessage()); final DismissMessage dismissMsg = (DismissMessage) msg.obj;
handleDismiss(dismissMsg.getCallback(), dismissMsg.getMessage());
break; break;
case START_KEYGUARD_EXIT_ANIM: case START_KEYGUARD_EXIT_ANIM:
message = "START_KEYGUARD_EXIT_ANIM";
Trace.beginSection( Trace.beginSection(
"KeyguardViewMediator#handleMessage START_KEYGUARD_EXIT_ANIM"); "KeyguardViewMediator#handleMessage START_KEYGUARD_EXIT_ANIM");
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
@@ -2471,21 +2470,25 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
Trace.endSection(); Trace.endSection();
break; break;
case CANCEL_KEYGUARD_EXIT_ANIM: case CANCEL_KEYGUARD_EXIT_ANIM:
message = "CANCEL_KEYGUARD_EXIT_ANIM";
Trace.beginSection( Trace.beginSection(
"KeyguardViewMediator#handleMessage CANCEL_KEYGUARD_EXIT_ANIM"); "KeyguardViewMediator#handleMessage CANCEL_KEYGUARD_EXIT_ANIM");
handleCancelKeyguardExitAnimation(); handleCancelKeyguardExitAnimation();
Trace.endSection(); Trace.endSection();
break; break;
case KEYGUARD_DONE_PENDING_TIMEOUT: case KEYGUARD_DONE_PENDING_TIMEOUT:
message = "KEYGUARD_DONE_PENDING_TIMEOUT";
Trace.beginSection("KeyguardViewMediator#handleMessage" Trace.beginSection("KeyguardViewMediator#handleMessage"
+ " KEYGUARD_DONE_PENDING_TIMEOUT"); + " KEYGUARD_DONE_PENDING_TIMEOUT");
Log.w(TAG, "Timeout while waiting for activity drawn!"); Log.w(TAG, "Timeout while waiting for activity drawn!");
Trace.endSection(); Trace.endSection();
break; break;
case SYSTEM_READY: case SYSTEM_READY:
message = "SYSTEM_READY";
handleSystemReady(); handleSystemReady();
break; break;
} }
Log.d(TAG, "KeyguardViewMediator queue processing message: " + message);
} }
}; };