Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24c4ec9b authored by BK Choi's avatar BK Choi Committed by Automerger Merge Worker
Browse files

Merge "Deprecate user pre-creation methods in UserManager." into udc-dev am: 0394f5cf

parents 5e9e73ac 0394f5cf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2277,12 +2277,12 @@ package android.os {
    method public int getMainDisplayIdAssignedToUser();
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.Set<java.lang.String> getPreInstallableSystemPackages(@NonNull String);
    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS, android.Manifest.permission.QUERY_USERS}) public String getUserType();
    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean);
    method @Deprecated @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean isUserTypeEnabled(@NonNull String);
    method public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported();
    method public boolean isVisibleBackgroundUsersSupported();
    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException;
    method @Deprecated @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException;
  }

  public final class VibrationAttributes implements android.os.Parcelable {
+9 −3
Original line number Diff line number Diff line
@@ -261,14 +261,17 @@ public class UserInfo implements Parcelable {
    public boolean guestToRemove;

    /**
     * This is used to optimize the creation of an user, i.e. OEMs might choose to pre-create a
     * This is used to optimize the creation of a user, i.e. OEMs might choose to pre-create a
     * number of users at the first boot, so the actual creation later is faster.
     *
     * <p>A {@code preCreated} user is not a real user yet, so it should not show up on regular
     * user operations (other than user creation per se).
     *
     * <p>Once the pre-created is used to create a "real" user later on, {@code preCreate} is set to
     * {@code false}.
     * <p>Once the pre-created is used to create a "real" user later on, {@code preCreated} is set
     * to {@code false}.
     *
     * <p><b>NOTE: Pre-created users are deprecated. This field remains to be able to recognize
     * pre-created users in older versions, but will eventually be removed.
     */
    public boolean preCreated;

@@ -277,6 +280,9 @@ public class UserInfo implements Parcelable {
     * user.
     *
     * <p><b>NOTE: </b>only used for debugging purposes, it's not set when marshalled to a parcel.
     *
     * <p><b>NOTE: Pre-created users are deprecated. This field remains to be able to recognize
     * pre-created users in older versions, but will eventually ve removed.
     */
    public boolean convertedFromPreCreated;

+11 −0
Original line number Diff line number Diff line
@@ -3706,17 +3706,24 @@ public class UserManager {
     * {@link android.Manifest.permission#CREATE_USERS} suffices if flags are in
     * com.android.server.pm.UserManagerService#ALLOWED_FLAGS_FOR_CREATE_USERS_PERMISSION.
     *
     *
     * @param userType the type of user, such as {@link UserManager#USER_TYPE_FULL_GUEST}.
     * @return the {@link UserInfo} object for the created user.
     *
     * @throws UserOperationException if the user could not be created.
     *
     * @deprecated Pre-created users are deprecated. This method should no longer be used, and will
     *             be removed once all the callers are removed.
     *
     * @hide
     */
    @Deprecated
    @TestApi
    @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS,
            Manifest.permission.CREATE_USERS})
    public @NonNull UserInfo preCreateUser(@NonNull String userType)
            throws UserOperationException {
        Log.w(TAG, "preCreateUser(): Pre-created user is deprecated.");
        try {
            return mService.preCreateUserWithThrow(userType);
        } catch (ServiceSpecificException e) {
@@ -4296,8 +4303,12 @@ public class UserManager {
    /**
     * Returns information for all users on this device, based on the filtering parameters.
     *
     * @deprecated Pre-created users are deprecated and no longer supported.
     *             Use {@link #getUsers()}, {@link #getUsers(boolean)}, or {@link #getAliveUsers()}
     *             instead.
     * @hide
     */
    @Deprecated
    @TestApi
    @RequiresPermission(anyOf = {
            android.Manifest.permission.MANAGE_USERS,