Merge changes from topic "user_templates" into qt-qpr1-dev

am: 8959c2dd6b

Change-Id: Ifef51d385f3a998ae958214bb8a51c285d7f5d78
This commit is contained in:
Felipe Leme
2019-10-18 13:08:03 -07:00
committed by android-build-merger
3 changed files with 26 additions and 20 deletions

View File

@@ -54,7 +54,7 @@ interface IUserManager {
void setUserIcon(int userHandle, in Bitmap icon);
ParcelFileDescriptor getUserIcon(int userHandle);
UserInfo getPrimaryUser();
List<UserInfo> getUsers(boolean excludeDying);
List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated);
List<UserInfo> getProfiles(int userHandle, boolean enabledOnly);
int[] getProfileIds(int userId, boolean enabledOnly);
boolean canAddMoreManagedProfiles(int userHandle, boolean allowedToRemoveOne);

View File

@@ -2379,15 +2379,26 @@ public class UserManager {
/**
* Returns information for all users on this device, including ones marked for deletion.
* To retrieve only users that are alive, use {@link #getUsers(boolean)}.
* <p>
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
*
* @return the list of users that exist on the device.
* @hide
*/
@UnsupportedAppUsage
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public List<UserInfo> getUsers() {
return getUsers(/* excludeDying= */ false);
}
/**
* Returns information for all users on this device, based on the filtering parameters.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying,
boolean excludePreCreated) {
try {
return mService.getUsers(false);
return mService.getUsers(excludePartial, excludeDying, excludePreCreated);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
@@ -2403,16 +2414,12 @@ public class UserManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public long[] getSerialNumbersOfUsers(boolean excludeDying) {
try {
List<UserInfo> users = mService.getUsers(excludeDying);
long[] result = new long[users.size()];
for (int i = 0; i < result.length; i++) {
result[i] = users.get(i).serialNumber;
}
return result;
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
List<UserInfo> users = getUsers(excludeDying);
long[] result = new long[users.size()];
for (int i = 0; i < result.length; i++) {
result[i] = users.get(i).serialNumber;
}
return result;
}
/**
@@ -2798,11 +2805,8 @@ public class UserManager {
*/
@UnsupportedAppUsage
public @NonNull List<UserInfo> getUsers(boolean excludeDying) {
try {
return mService.getUsers(excludeDying);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
return getUsers(/*excludePartial= */ true, excludeDying,
/* excludePreCreated= */ true);
}
/**

View File

@@ -650,12 +650,12 @@ public class UserManagerService extends IUserManager.Stub {
return null;
}
@Override
public @NonNull List<UserInfo> getUsers(boolean excludeDying) {
return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */ true);
}
private @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying,
@Override
public @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying,
boolean excludePreCreated) {
checkManageOrCreateUsersPermission("query users");
synchronized (mUsersLock) {
@@ -2700,6 +2700,8 @@ public class UserManagerService extends IUserManager.Stub {
Preconditions.checkArgument(!UserInfo.isManagedProfile(flags),
"cannot pre-create managed profiles");
Slog.i(LOG_TAG, "Pre-creating user with flags " + UserInfo.flagsToString(flags));
return createUserInternalUnchecked(/* name= */ null, flags,
/* parentId= */ UserHandle.USER_NULL, /* preCreate= */ true,
/* disallowedPackages= */ null);