Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -860,6 +860,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardUserSwitcher = new KeyguardUserSwitcher(mContext, (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_user_switcher), mKeyguardStatusBar, mNotificationPanel, mUserSwitcherController); if (mUserSwitcherController != null) { mUserSwitcherController.setKeyguardUserSwitcherAvailable( mKeyguardUserSwitcher.isEnabled()); } // Set up the quick settings tile panel Loading Loading @@ -2126,6 +2130,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void setQsExpanded(boolean expanded) { mStatusBarWindowManager.setQsExpanded(expanded); if (mUserSwitcherController != null) { mUserSwitcherController.setQsExpanded(expanded); } } public boolean isGoingToNotificationShade() { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java +4 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,10 @@ public class KeyguardUserSwitcher { } }; public boolean isEnabled() { return mUserSwitcherContainer != null; } public static class Adapter extends UserSwitcherController.BaseUserAdapter implements View.OnClickListener { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +49 −16 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ public class UserSwitcherController { private boolean mSimpleUserSwitcher; private boolean mAddUsersWhenLocked; private boolean mKeyguardUserSwitcherAvailable; private boolean mQsExpanded; public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor) { mContext = context; mGuestResumeSessionReceiver.register(context); Loading Loading @@ -116,8 +119,9 @@ public class UserSwitcherController { */ @SuppressWarnings("unchecked") private void refreshUsers(int forcePictureLoadForId) { SparseArray<Bitmap> bitmaps = new SparseArray<>(mUsers.size()); SparseArray<Bitmap> bitmaps = null; if (allowCachingOfBitmaps()) { bitmaps = new SparseArray<>(mUsers.size()); final int N = mUsers.size(); for (int i = 0; i < N; i++) { UserRecord r = mUsers.get(i); Loading @@ -127,6 +131,7 @@ public class UserSwitcherController { } bitmaps.put(r.info.id, r.picture); } } final boolean addUsersWhenLocked = mAddUsersWhenLocked; new AsyncTask<SparseArray<Bitmap>, Void, ArrayList<UserRecord>>() { Loading @@ -151,13 +156,15 @@ public class UserSwitcherController { true /* isGuest */, isCurrent, false /* isAddUser */, false /* isRestricted */); } else if (info.supportsSwitchTo()) { Bitmap picture = bitmaps.get(info.id); if (picture == null) { picture = mUserManager.getUserIcon(info.id); } if (picture != null) { Bitmap picture = bitmaps != null ? bitmaps.get(info.id) : null; if (picture == null && allowCachingOfBitmaps()) { Bitmap loadedPicture = mUserManager.getUserIcon(info.id); if (loadedPicture != null) { picture = BitmapHelper.createCircularClip( picture, avatarSize, avatarSize); loadedPicture, avatarSize, avatarSize); loadedPicture.recycle(); } } int index = isCurrent ? 0 : records.size(); records.add(index, new UserRecord(info, picture, false /* isGuest */, Loading Loading @@ -552,6 +559,32 @@ public class UserSwitcherController { } } /** * Notify if the keyguard user switcher is available. */ public void setKeyguardUserSwitcherAvailable(boolean available) { boolean oldShouldCacheBitmaps = allowCachingOfBitmaps(); mKeyguardUserSwitcherAvailable = available; if (allowCachingOfBitmaps() != oldShouldCacheBitmaps) { refreshUsers(UserHandle.USER_NULL); } } /** * Notify if the quick settings are expanded. */ public void setQsExpanded(boolean qsExpanded) { boolean oldShouldCacheBitmaps = allowCachingOfBitmaps(); mQsExpanded = qsExpanded; if (allowCachingOfBitmaps() != oldShouldCacheBitmaps) { refreshUsers(UserHandle.USER_NULL); } } private boolean allowCachingOfBitmaps() { return mQsExpanded || mKeyguardUserSwitcherAvailable; } private final class AddUserDialog extends SystemUIDialog implements DialogInterface.OnClickListener { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -860,6 +860,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardUserSwitcher = new KeyguardUserSwitcher(mContext, (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_user_switcher), mKeyguardStatusBar, mNotificationPanel, mUserSwitcherController); if (mUserSwitcherController != null) { mUserSwitcherController.setKeyguardUserSwitcherAvailable( mKeyguardUserSwitcher.isEnabled()); } // Set up the quick settings tile panel Loading Loading @@ -2126,6 +2130,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void setQsExpanded(boolean expanded) { mStatusBarWindowManager.setQsExpanded(expanded); if (mUserSwitcherController != null) { mUserSwitcherController.setQsExpanded(expanded); } } public boolean isGoingToNotificationShade() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java +4 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,10 @@ public class KeyguardUserSwitcher { } }; public boolean isEnabled() { return mUserSwitcherContainer != null; } public static class Adapter extends UserSwitcherController.BaseUserAdapter implements View.OnClickListener { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +49 −16 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ public class UserSwitcherController { private boolean mSimpleUserSwitcher; private boolean mAddUsersWhenLocked; private boolean mKeyguardUserSwitcherAvailable; private boolean mQsExpanded; public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor) { mContext = context; mGuestResumeSessionReceiver.register(context); Loading Loading @@ -116,8 +119,9 @@ public class UserSwitcherController { */ @SuppressWarnings("unchecked") private void refreshUsers(int forcePictureLoadForId) { SparseArray<Bitmap> bitmaps = new SparseArray<>(mUsers.size()); SparseArray<Bitmap> bitmaps = null; if (allowCachingOfBitmaps()) { bitmaps = new SparseArray<>(mUsers.size()); final int N = mUsers.size(); for (int i = 0; i < N; i++) { UserRecord r = mUsers.get(i); Loading @@ -127,6 +131,7 @@ public class UserSwitcherController { } bitmaps.put(r.info.id, r.picture); } } final boolean addUsersWhenLocked = mAddUsersWhenLocked; new AsyncTask<SparseArray<Bitmap>, Void, ArrayList<UserRecord>>() { Loading @@ -151,13 +156,15 @@ public class UserSwitcherController { true /* isGuest */, isCurrent, false /* isAddUser */, false /* isRestricted */); } else if (info.supportsSwitchTo()) { Bitmap picture = bitmaps.get(info.id); if (picture == null) { picture = mUserManager.getUserIcon(info.id); } if (picture != null) { Bitmap picture = bitmaps != null ? bitmaps.get(info.id) : null; if (picture == null && allowCachingOfBitmaps()) { Bitmap loadedPicture = mUserManager.getUserIcon(info.id); if (loadedPicture != null) { picture = BitmapHelper.createCircularClip( picture, avatarSize, avatarSize); loadedPicture, avatarSize, avatarSize); loadedPicture.recycle(); } } int index = isCurrent ? 0 : records.size(); records.add(index, new UserRecord(info, picture, false /* isGuest */, Loading Loading @@ -552,6 +559,32 @@ public class UserSwitcherController { } } /** * Notify if the keyguard user switcher is available. */ public void setKeyguardUserSwitcherAvailable(boolean available) { boolean oldShouldCacheBitmaps = allowCachingOfBitmaps(); mKeyguardUserSwitcherAvailable = available; if (allowCachingOfBitmaps() != oldShouldCacheBitmaps) { refreshUsers(UserHandle.USER_NULL); } } /** * Notify if the quick settings are expanded. */ public void setQsExpanded(boolean qsExpanded) { boolean oldShouldCacheBitmaps = allowCachingOfBitmaps(); mQsExpanded = qsExpanded; if (allowCachingOfBitmaps() != oldShouldCacheBitmaps) { refreshUsers(UserHandle.USER_NULL); } } private boolean allowCachingOfBitmaps() { return mQsExpanded || mKeyguardUserSwitcherAvailable; } private final class AddUserDialog extends SystemUIDialog implements DialogInterface.OnClickListener { Loading