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

Commit 9f174a05 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8470411 from 9aa75da8 to tm-qpr1-release

Change-Id: I0b2f5266608bca8f8ca5673e84abbe60c39de9c7
parents 89c05da2 9aa75da8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1857,7 +1857,6 @@ package android.os {
    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 @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle);
    method public static boolean isGuestUserEphemeral();
    method public static boolean isSplitSystemUser();
    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;
  }
+18 −1
Original line number Diff line number Diff line
@@ -141,6 +141,22 @@ public class UserInfo implements Parcelable {
     */
    public static final int FLAG_PROFILE = 0x00001000;

    /**
     * Indicates that this user is created in ephemeral mode via
     * {@link IUserManager} create user.
     *
     * When a user is created with {@link #FLAG_EPHEMERAL}, {@link #FLAG_EPHEMERAL_ON_CREATE}
     * is set internally within the user manager.
     *
     * When {@link #FLAG_EPHEMERAL_ON_CREATE} is set {@link IUserManager.setUserEphemeral}
     * has no effect because a user that was created ephemeral can never be made non-ephemeral.
     *
     * {@link #FLAG_EPHEMERAL_ON_CREATE} should NOT be set by client's of user manager
     *
     * @hide
     */
    public static final int FLAG_EPHEMERAL_ON_CREATE = 0x00002000;

    /**
     * @hide
     */
@@ -157,7 +173,8 @@ public class UserInfo implements Parcelable {
            FLAG_DEMO,
            FLAG_FULL,
            FLAG_SYSTEM,
            FLAG_PROFILE
            FLAG_PROFILE,
            FLAG_EPHEMERAL_ON_CREATE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface UserInfoFlag {
+1 −0
Original line number Diff line number Diff line
@@ -131,4 +131,5 @@ interface IUserManager {
    String getUserName();
    long getUserStartRealtime();
    long getUserUnlockRealtime();
    boolean setUserEphemeral(int userId, boolean enableEphemeral);
}
+50 −2
Original line number Diff line number Diff line
@@ -1997,12 +1997,21 @@ public class UserManager {
     * @return Whether guest user is always ephemeral
     * @hide
     */
    @TestApi
    public static boolean isGuestUserEphemeral() {
    public static boolean isGuestUserAlwaysEphemeral() {
        return Resources.getSystem()
                .getBoolean(com.android.internal.R.bool.config_guestUserEphemeral);
    }

    /**
     * @return true, when we want to enable user manager API and UX to allow
     *           guest user ephemeral state change based on user input
     * @hide
     */
    public static boolean isGuestUserAllowEphemeralStateChange() {
        return Resources.getSystem()
                .getBoolean(com.android.internal.R.bool.config_guestUserAllowEphemeralStateChange);
    }

    /**
     * Checks whether the device is running in a headless system user mode.
     *
@@ -3424,6 +3433,20 @@ public class UserManager {
            if (guest != null) {
                Settings.Secure.putStringForUser(context.getContentResolver(),
                        Settings.Secure.SKIP_FIRST_USE_HINTS, "1", guest.id);

                if (UserManager.isGuestUserAllowEphemeralStateChange()) {
                    // Mark guest as (changeably) ephemeral if REMOVE_GUEST_ON_EXIT is 1
                    // This is done so that a user via a UI controller can choose to
                    // make a guest as ephemeral or not.
                    // Settings.Global.REMOVE_GUEST_ON_EXIT holds the choice on what the guest state
                    // should be, with default being ephemeral.
                    boolean resetGuestOnExit = Settings.Global.getInt(context.getContentResolver(),
                                                 Settings.Global.REMOVE_GUEST_ON_EXIT, 1) == 1;

                    if (resetGuestOnExit && !guest.isEphemeral()) {
                        setUserEphemeral(guest.id, true);
                    }
                }
            }
            return guest;
        } catch (ServiceSpecificException e) {
@@ -4940,6 +4963,31 @@ public class UserManager {
        }
    }

    /**
     * Set the user as ephemeral or non-ephemeral.
     *
     * If the user was initially created as ephemeral then this
     * method has no effect and false is returned.
     *
     * @param userId the user's integer id
     * @param enableEphemeral true: change user state to ephemeral,
     *                        false: change user state to non-ephemeral
     * @return true: user now has the desired ephemeral state,
     *         false: desired user ephemeral state could not be set
     *
     * @hide
     */
    @RequiresPermission(anyOf = {
            android.Manifest.permission.MANAGE_USERS,
            android.Manifest.permission.CREATE_USERS})
    public boolean setUserEphemeral(@UserIdInt int userId, boolean enableEphemeral) {
        try {
            return mService.setUserEphemeral(userId, enableEphemeral);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Updates the context user's name.
     *
+31 −0
Original line number Diff line number Diff line
@@ -2012,6 +2012,15 @@ public final class Settings {
    public static final String ACTION_ALL_APPS_NOTIFICATION_SETTINGS =
            "android.settings.ALL_APPS_NOTIFICATION_SETTINGS";
    /**
     * Activity Action: Show app settings specifically for sending notifications. Same as
     * ALL_APPS_NOTIFICATION_SETTINGS but meant for internal use.
     * @hide
     */
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW =
            "android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW";
    /**
     * Activity Action: Show notification settings for a single app.
     * <p>
@@ -7669,6 +7678,20 @@ public final class Settings {
        public static final String ZEN_SETTINGS_SUGGESTION_VIEWED =
                "zen_settings_suggestion_viewed";
        /**
         * State of whether review notification permissions notification needs to
         * be shown the user, and whether the user has interacted.
         *
         * Valid values:
         *   -1 = UNKNOWN
         *    0 = SHOULD_SHOW
         *    1 = USER_INTERACTED
         *    2 = DISMISSED
         * @hide
         */
        public static final String REVIEW_PERMISSIONS_NOTIFICATION_STATE =
                "review_permissions_notification_state";
        /**
         * Whether the in call notification is enabled to play sound during calls.  The value is
         * boolean (1 or 0).
@@ -10897,6 +10920,14 @@ public final class Settings {
        @Readable
        public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
        /**
         * Whether guest user should be removed on exit from guest mode.
         * <p>
         * Type: int
         * @hide
         */
        public static final String REMOVE_GUEST_ON_EXIT = "remove_guest_on_exit";
        /**
         * Whether applying ramping ringer on incoming phone call ringtone.
         * <p>1 = apply ramping ringer
Loading