Minor fixes handling START_USER_SWITCH_UI_MSG:

- It was using the wrong handler.
- It would never show the UserController UI on automotive.

Test: manual verification
Fixes: 161935091

Change-Id: I4ab764ee0ad02eb4aa5de3e651b866972db293d5
This commit is contained in:
felipeal
2020-07-23 08:13:41 -07:00
committed by Felipe Leme
parent 679825e9ea
commit e55688d450

View File

@@ -1630,7 +1630,7 @@ class UserController implements Handler.Callback {
UserInfo currentUserInfo = getUserInfo(currentUserId);
Pair<UserInfo, UserInfo> userNames = new Pair<>(currentUserInfo, targetUserInfo);
mUiHandler.removeMessages(START_USER_SWITCH_UI_MSG);
mUiHandler.sendMessage(mHandler.obtainMessage(
mUiHandler.sendMessage(mUiHandler.obtainMessage(
START_USER_SWITCH_UI_MSG, userNames));
} else {
mHandler.removeMessages(START_USER_SWITCH_FG_MSG);
@@ -2887,13 +2887,18 @@ class UserController implements Handler.Callback {
void showUserSwitchingDialog(UserInfo fromUser, UserInfo toUser,
String switchingFromSystemUserMessage, String switchingToSystemUserMessage) {
if (!mService.mContext.getPackageManager()
if (mService.mContext.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
final Dialog d = new UserSwitchingDialog(mService, mService.mContext, fromUser,
toUser, true /* above system */, switchingFromSystemUserMessage,
switchingToSystemUserMessage);
d.show();
// config_customUserSwitchUi is set to true on Automotive as CarSystemUI is
// responsible to show the UI; OEMs should not change that, but if they do, we
// should at least warn the user...
Slog.w(TAG, "Showing user switch dialog on UserController, it could cause a race "
+ "condition if it's shown by CarSystemUI as well");
}
final Dialog d = new UserSwitchingDialog(mService, mService.mContext, fromUser,
toUser, true /* above system */, switchingFromSystemUserMessage,
switchingToSystemUserMessage);
d.show();
}
void reportGlobalUsageEventLocked(int event) {