OSDN Git Service

Remove Limited users category if empty
authorAmith Yamasani <yamasani@google.com>
Sat, 30 Mar 2013 03:28:28 +0000 (20:28 -0700)
committerAmith Yamasani <yamasani@google.com>
Sat, 30 Mar 2013 03:28:28 +0000 (20:28 -0700)
If there are no users under limited category, in a secondary user,
remove the subheading completely.

Change-Id: I0397b6198c8cfc147e9e7dc30a92a7cb2f5860e3

src/com/android/settings/users/UserSettings.java

index 872d144..5830184 100644 (file)
@@ -501,6 +501,12 @@ public class UserSettings extends SettingsPreferenceFragment
         boolean moreUsers = mUserManager.getMaxSupportedUsers() > users.size();
         mAddRestrictedUser.setEnabled(moreUsers);
         mAddTrustedUser.setEnabled(moreUsers);
+        // Remove the limited users category if there aren't other limited users.
+        if (!mIsOwner) {
+            if (mLimitedUserListCategory.getPreferenceCount() == 0) {
+                removePreference(KEY_LIMITED_USER_LIST);
+            }
+        }
     }
 
     private void loadIconsAsync(List<Integer> missingIcons) {