OSDN Git Service

Revert "Only keep user switcher bitmaps if needed"
authorAdrian Roos <roosa@google.com>
Fri, 21 Nov 2014 13:54:04 +0000 (13:54 +0000)
committerAdrian Roos <roosa@google.com>
Fri, 21 Nov 2014 13:59:42 +0000 (13:59 +0000)
This reverts commit cba0faadbe1c8cf7c6b264b761d747f7381a2f93
with change id I416beb82156787e61ee1f59b6726fd702f135f68.

It keeps the fix preventing us from reclipping already loaded
bitmaps.

Bug: 18350670
Change-Id: I0562d38d2a6eb0b715adcd4ca77512f2cbedd320

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java

index f5c994a..3f99630 100644 (file)
@@ -860,10 +860,6 @@ 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
@@ -2130,9 +2126,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
 
     public void setQsExpanded(boolean expanded) {
         mStatusBarWindowManager.setQsExpanded(expanded);
-        if (mUserSwitcherController != null) {
-            mUserSwitcherController.setQsExpanded(expanded);
-        }
     }
 
     public boolean isGoingToNotificationShade() {
index 0392e0d..7ee1fc5 100644 (file)
@@ -227,10 +227,6 @@ public class KeyguardUserSwitcher {
         }
     };
 
-    public boolean isEnabled() {
-        return mUserSwitcherContainer != null;
-    }
-
     public static class Adapter extends UserSwitcherController.BaseUserAdapter implements
             View.OnClickListener {
 
index 5f6c399..e5b357a 100644 (file)
@@ -78,9 +78,6 @@ 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);
@@ -119,18 +116,16 @@ public class UserSwitcherController {
      */
     @SuppressWarnings("unchecked")
     private void refreshUsers(int forcePictureLoadForId) {
-        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);
-                if (r == null || r.info == null
-                        || r.info.id == forcePictureLoadForId || r.picture == null) {
-                    continue;
-                }
-                bitmaps.put(r.info.id, r.picture);
+
+        SparseArray<Bitmap> bitmaps = new SparseArray<>(mUsers.size());
+        final int N = mUsers.size();
+        for (int i = 0; i < N; i++) {
+            UserRecord r = mUsers.get(i);
+            if (r == null || r.info == null
+                    || r.info.id == forcePictureLoadForId || r.picture == null) {
+                continue;
             }
+            bitmaps.put(r.info.id, r.picture);
         }
 
         final boolean addUsersWhenLocked = mAddUsersWhenLocked;
@@ -156,14 +151,13 @@ public class UserSwitcherController {
                                 true /* isGuest */, isCurrent, false /* isAddUser */,
                                 false /* isRestricted */);
                     } else if (info.supportsSwitchTo()) {
-                        Bitmap picture = bitmaps != null ? bitmaps.get(info.id) : null;
-                        if (picture == null && allowCachingOfBitmaps()) {
-                            Bitmap loadedPicture = mUserManager.getUserIcon(info.id);
+                        Bitmap picture = bitmaps.get(info.id);
+                        if (picture == null) {
+                            picture = mUserManager.getUserIcon(info.id);
 
-                            if (loadedPicture != null) {
+                            if (picture != null) {
                                 picture = BitmapHelper.createCircularClip(
-                                        loadedPicture, avatarSize, avatarSize);
-                                loadedPicture.recycle();
+                                        picture, avatarSize, avatarSize);
                             }
                         }
                         int index = isCurrent ? 0 : records.size();
@@ -559,32 +553,6 @@ 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 {