summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-06-06 14:31:37 -0700
committerAmith Yamasani <yamasani@google.com>2014-06-06 14:31:37 -0700
commit4093e40e18f2e8d395ca467f54aef6e763c394f6 (patch)
tree2879be164f4f5bcb9767c03abe9958928967a67a
parentb76de1d4fabf8381d73df22439e6fac839bd33e7 (diff)
downloadpackages_apps_Settings-4093e40e18f2e8d395ca467f54aef6e763c394f6.tar.gz
packages_apps_Settings-4093e40e18f2e8d395ca467f54aef6e763c394f6.tar.bz2
packages_apps_Settings-4093e40e18f2e8d395ca467f54aef6e763c394f6.zip
Show user management UI if a managed profile exists
Show UI even if flags to show multiuser UI are off, if there's a second user on the device. This way there's an affordance to remove the user. Don't show the "Add user" item though. Bug: 15447068 Change-Id: I40273005d6d8d66aed486328615acdab71d51fa4
-rw-r--r--src/com/android/settings/SettingsActivity.java6
-rw-r--r--src/com/android/settings/users/UserSettings.java7
2 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 6ba79ccb2..7dcdfbc7a 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -1043,8 +1043,12 @@ public class SettingsActivity extends Activity
category.removeTile(n);
}
} else if (id == R.id.user_settings) {
+ boolean hasMultipleUsers =
+ ((UserManager) getSystemService(Context.USER_SERVICE))
+ .getUserCount() > 1;
if (!UserHandle.MU_ENABLED
- || !UserManager.supportsMultipleUsers()
+ || (!UserManager.supportsMultipleUsers()
+ && !hasMultipleUsers)
|| Utils.isMonkeyRunning()) {
category.removeTile(n);
}
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index a05aaa955..901ee50d9 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -186,7 +186,9 @@ public class UserSettings extends RestrictedSettingsFragment
}
final Context context = getActivity();
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- if (!mUserManager.supportsMultipleUsers() || Utils.isMonkeyRunning()) {
+ boolean hasMultipleUsers = mUserManager.getUserCount() > 1;
+ if ((!UserManager.supportsMultipleUsers() && !hasMultipleUsers)
+ || Utils.isMonkeyRunning()) {
mEnabled = false;
return;
}
@@ -201,7 +203,8 @@ public class UserSettings extends RestrictedSettingsFragment
mMePreference.setSummary(R.string.user_owner);
}
mAddUser = findPreference(KEY_ADD_USER);
- if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2) {
+ if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2
+ || !UserManager.supportsMultipleUsers()) {
removePreference(KEY_ADD_USER);
} else {
mAddUser.setOnPreferenceClickListener(this);