diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java index 187a3bdec13fc..4f90527098703 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java @@ -59,6 +59,7 @@ public class UserDetailView extends PseudoGridView { private final Context mContext; protected UserSwitcherController mController; + private View mCurrentUserView; public Adapter(Context context, UserSwitcherController controller) { super(controller); @@ -89,6 +90,9 @@ public class UserDetailView extends PseudoGridView { v.bind(name, item.picture, item.info.id); } v.setActivated(item.isCurrent); + if (item.isCurrent) { + mCurrentUserView = v; + } v.setDisabledByAdmin(item.isDisabledByAdmin); if (!item.isSwitchToEnabled) { v.setEnabled(false); @@ -107,6 +111,12 @@ public class UserDetailView extends PseudoGridView { mController.startActivity(intent); } else if (tag.isSwitchToEnabled) { MetricsLogger.action(mContext, MetricsEvent.QS_SWITCH_USER); + if (!tag.isAddUser && !tag.isRestricted && !tag.isDisabledByAdmin) { + if (mCurrentUserView != null) { + mCurrentUserView.setActivated(false); + } + view.setActivated(true); + } switchTo(tag); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java index ba55f2ddcf131..c404cf69f1a8f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java @@ -74,6 +74,12 @@ public class UserAvatarView extends View { this(context, null); } + @Override + public void setActivated(boolean activated) { + super.setActivated(activated); + mDrawable.invalidateSelf(); + } + /** * @deprecated use {@link #setAvatar(Bitmap)} instead. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java index d28a66994e1d8..2abae3e260134 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java @@ -257,6 +257,7 @@ public class KeyguardUserSwitcher { private Context mContext; private KeyguardUserSwitcher mKeyguardUserSwitcher; + private View mCurrentUserView; public Adapter(Context context, UserSwitcherController controller, KeyguardUserSwitcher kgu) { @@ -285,6 +286,9 @@ public class KeyguardUserSwitcher { // Disable the icon if switching is disabled v.setAvatarEnabled(item.isSwitchToEnabled); convertView.setActivated(item.isCurrent); + if (item.isCurrent) { + mCurrentUserView = convertView; + } convertView.setTag(item); return convertView; } @@ -297,6 +301,12 @@ public class KeyguardUserSwitcher { // tapping the guest user while it's current clears the session. mKeyguardUserSwitcher.hideIfNotSimple(true /* animate */); } else if (user.isSwitchToEnabled) { + if (!user.isAddUser && !user.isRestricted && !user.isDisabledByAdmin) { + if (mCurrentUserView != null) { + mCurrentUserView.setActivated(false); + } + v.setActivated(true); + } switchTo(user); } } 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 8dfcb0ac215da..9ce31d030c43e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -236,8 +236,7 @@ public class UserSwitcherController implements Dumpable { picture, avatarSize, avatarSize, true); } } - int index = isCurrent ? 0 : records.size(); - records.add(index, new UserRecord(info, picture, false /* isGuest */, + records.add(new UserRecord(info, picture, false /* isGuest */, isCurrent, false /* isAddUser */, false /* isRestricted */, switchToEnabled)); } @@ -269,8 +268,7 @@ public class UserSwitcherController implements Dumpable { records.add(guestRecord); } } else { - int index = guestRecord.isCurrent ? 0 : records.size(); - records.add(index, guestRecord); + records.add(guestRecord); } if (canCreateUser) {