[Bouncer] Update userswitcher upon reset
Ensure that user icon and name is reloaded everytime we show the bouncer as the state of the user can change. Bug: 228901381 Test: Manual on device Change-Id: I46e6c08170b5ee067c58cda8c5bb254f512285eb
This commit is contained in:
@@ -700,6 +700,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
mViewMode.reset();
|
||||
mDisappearAnimRunning = false;
|
||||
}
|
||||
|
||||
@@ -798,9 +799,6 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
mUserSwitcherViewGroup = mView.findViewById(R.id.keyguard_bouncer_user_switcher);
|
||||
}
|
||||
|
||||
Drawable userIcon = findUserIcon(KeyguardUpdateMonitor.getCurrentUser());
|
||||
((ImageView) mView.findViewById(R.id.user_icon)).setImageDrawable(userIcon);
|
||||
|
||||
updateSecurityViewLocation();
|
||||
|
||||
mUserSwitcher = mView.findViewById(R.id.user_switcher_header);
|
||||
@@ -813,6 +811,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
mPopup.dismiss();
|
||||
mPopup = null;
|
||||
}
|
||||
setupUserSwitcher();
|
||||
}
|
||||
|
||||
private Drawable findUserIcon(int userId) {
|
||||
@@ -858,6 +857,12 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
|
||||
private void setupUserSwitcher() {
|
||||
final UserRecord currentUser = mUserSwitcherController.getCurrentUserRecord();
|
||||
if (currentUser == null) {
|
||||
Log.wtf(TAG, "Current user in user switcher is null.");
|
||||
return;
|
||||
}
|
||||
Drawable userIcon = findUserIcon(currentUser.info.id);
|
||||
((ImageView) mView.findViewById(R.id.user_icon)).setImageDrawable(userIcon);
|
||||
mUserSwitcher.setText(mUserSwitcherController.getCurrentUserName());
|
||||
|
||||
ViewGroup anchor = mView.findViewById(R.id.user_switcher_anchor);
|
||||
|
||||
@@ -291,7 +291,9 @@ public class KeyguardSecurityContainerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testTwoOrMoreUsersDoesAllowDropDown() {
|
||||
// GIVEN one user has been setup
|
||||
when(mUserSwitcherController.getUsers()).thenReturn(buildUserRecords(2));
|
||||
ArrayList<UserRecord> records = buildUserRecords(2);
|
||||
when(mUserSwitcherController.getCurrentUserRecord()).thenReturn(records.get(0));
|
||||
when(mUserSwitcherController.getUsers()).thenReturn(records);
|
||||
|
||||
// WHEN UserSwitcherViewMode is initialized
|
||||
setupUserSwitcher();
|
||||
|
||||
Reference in New Issue
Block a user