Support Private profile in profile modal selector
Profile selector modal with work profile https://screenshot.googleplex.com/8ugpsT7nZA75VPa Modal without work profile https://screenshot.googleplex.com/9bPFbFG2DKBHhvS Bug: 309635228 Test: manual Change-Id: Id7533f101d2b5693c419c9591d59751925a4b7ce
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.dashboard.profileselector;
|
||||
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.PERSONAL_CATEGORY_HEADER;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_CATEGORY_HEADER;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
@@ -51,11 +50,13 @@ public class UserAdapter extends BaseAdapter {
|
||||
/** Holder for user details */
|
||||
public static class UserDetails {
|
||||
private final UserHandle mUserHandle;
|
||||
private final UserManager mUserManager;
|
||||
private final Drawable mIcon;
|
||||
private final String mTitle;
|
||||
|
||||
public UserDetails(UserHandle userHandle, UserManager um, Context context) {
|
||||
mUserHandle = userHandle;
|
||||
mUserManager = um;
|
||||
UserInfo userInfo = um.getUserInfo(mUserHandle.getIdentifier());
|
||||
int tintColor = Utils.getColorAttrDefaultColor(context,
|
||||
com.android.internal.R.attr.materialColorPrimaryContainer);
|
||||
@@ -73,16 +74,13 @@ public class UserAdapter extends BaseAdapter {
|
||||
DevicePolicyManager devicePolicyManager =
|
||||
Objects.requireNonNull(context.getSystemService(DevicePolicyManager.class));
|
||||
DevicePolicyResourcesManager resources = devicePolicyManager.getResources();
|
||||
int userHandle = mUserHandle.getIdentifier();
|
||||
if (userHandle == UserHandle.USER_CURRENT
|
||||
|| userHandle == ActivityManager.getCurrentUser()) {
|
||||
int userId = mUserHandle.getIdentifier();
|
||||
if (userId == UserHandle.USER_CURRENT || userId == ActivityManager.getCurrentUser()) {
|
||||
return resources.getString(PERSONAL_CATEGORY_HEADER,
|
||||
() -> context.getString(
|
||||
com.android.settingslib.R.string.category_personal));
|
||||
} else {
|
||||
return resources.getString(WORK_CATEGORY_HEADER,
|
||||
() -> context.getString(com.android.settingslib.R.string.category_work));
|
||||
}
|
||||
return (String) mUserManager.getBadgedLabelForUser(/* label= */ "", mUserHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user