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

Commit 3d43f56f authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5956190 from 2811abbe to qt-qpr2-release

Change-Id: I25f4a2243caff9c2d13a6227e4e8419842c72129
parents 91a35d35 2811abbe
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -390,6 +390,8 @@ public class SliceManager {
            }
            Bundle extras = new Bundle();
            extras.putParcelable(SliceProvider.EXTRA_INTENT, intent);
            extras.putParcelableArrayList(SliceProvider.EXTRA_SUPPORTED_SPECS,
                    new ArrayList<>(supportedSpecs));
            final Bundle res = provider.call(SliceProvider.METHOD_MAP_INTENT, null, extras);
            if (res == null) {
                return null;
+73 −4
Original line number Diff line number Diff line
@@ -16,12 +16,17 @@

package android.content.pm;

import android.annotation.IntDef;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.DebugUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Per-user information.
@@ -94,6 +99,25 @@ public class UserInfo implements Parcelable {
     */
    public static final int FLAG_DEMO = 0x00000200;

    /**
     * @hide
     */
    @IntDef(flag = true, prefix = "FLAG_", value = {
            FLAG_PRIMARY,
            FLAG_ADMIN,
            FLAG_GUEST,
            FLAG_RESTRICTED,
            FLAG_INITIALIZED,
            FLAG_MANAGED_PROFILE,
            FLAG_DISABLED,
            FLAG_QUIET_MODE,
            FLAG_EPHEMERAL,
            FLAG_DEMO
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface UserInfoFlag {
    }

    public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL;

    @UnsupportedAppUsage
@@ -128,6 +152,18 @@ public class UserInfo implements Parcelable {
    @UnsupportedAppUsage
    public boolean guestToRemove;

    /**
     * This is used to optimize the creation of an 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}.
     */
    public boolean preCreated;

    @UnsupportedAppUsage
    public UserInfo(int id, String name, int flags) {
        this(id, name, null, flags);
@@ -155,6 +191,13 @@ public class UserInfo implements Parcelable {

    @UnsupportedAppUsage
    public boolean isGuest() {
        return isGuest(flags);
    }

    /**
     * Checks if the flag denotes a guest user.
     */
    public static boolean isGuest(@UserInfoFlag int flags) {
        return (flags & FLAG_GUEST) == FLAG_GUEST;
    }

@@ -165,6 +208,13 @@ public class UserInfo implements Parcelable {

    @UnsupportedAppUsage
    public boolean isManagedProfile() {
        return isManagedProfile(flags);
    }

    /**
     * Checks if the flag denotes a managed profile.
     */
    public static boolean isManagedProfile(@UserInfoFlag int flags) {
        return (flags & FLAG_MANAGED_PROFILE) == FLAG_MANAGED_PROFILE;
    }

@@ -252,6 +302,7 @@ public class UserInfo implements Parcelable {
        lastLoggedInTime = orig.lastLoggedInTime;
        lastLoggedInFingerprint = orig.lastLoggedInFingerprint;
        partial = orig.partial;
        preCreated = orig.preCreated;
        profileGroupId = orig.profileGroupId;
        restrictedProfileParentId = orig.restrictedProfileParentId;
        guestToRemove = orig.guestToRemove;
@@ -268,6 +319,22 @@ public class UserInfo implements Parcelable {
        return "UserInfo{" + id + ":" + name + ":" + Integer.toHexString(flags) + "}";
    }

    /** @hide */
    public String toFullString() {
        return "UserInfo[id=" + id
                + ", name=" + name
                + ", flags=" + flagsToString(flags)
                + (preCreated ? " (pre-created)" : "")
                + (partial ? " (partial)" : "")
                + "]";
    }

    /** @hide */
    public static String flagsToString(int flags) {
        return DebugUtils.flagsToString(UserInfo.class, "FLAG_", flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }
@@ -281,9 +348,10 @@ public class UserInfo implements Parcelable {
        dest.writeLong(creationTime);
        dest.writeLong(lastLoggedInTime);
        dest.writeString(lastLoggedInFingerprint);
        dest.writeInt(partial ? 1 : 0);
        dest.writeBoolean(partial);
        dest.writeBoolean(preCreated);
        dest.writeInt(profileGroupId);
        dest.writeInt(guestToRemove ? 1 : 0);
        dest.writeBoolean(guestToRemove);
        dest.writeInt(restrictedProfileParentId);
        dest.writeInt(profileBadge);
    }
@@ -308,9 +376,10 @@ public class UserInfo implements Parcelable {
        creationTime = source.readLong();
        lastLoggedInTime = source.readLong();
        lastLoggedInFingerprint = source.readString();
        partial = source.readInt() != 0;
        partial = source.readBoolean();
        preCreated = source.readBoolean();
        profileGroupId = source.readInt();
        guestToRemove = source.readInt() != 0;
        guestToRemove = source.readBoolean();
        restrictedProfileParentId = source.readInt();
        profileBadge = source.readInt();
    }
+3 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ interface IUserManager {
     */

    UserInfo createUser(in String name, int flags);
    UserInfo preCreateUser(int flags);
    UserInfo createProfileForUser(in String name, int flags, int userHandle,
            in String[] disallowedPackages);
    UserInfo createRestrictedProfile(String name, int parentUserHandle);
@@ -53,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);
@@ -92,6 +93,7 @@ interface IUserManager {
    boolean someUserHasSeedAccount(in String accountName, in String accountType);
    boolean isManagedProfile(int userId);
    boolean isDemoUser(int userId);
    boolean isPreCreated(int userId);
    UserInfo createProfileForUserEvenWhenDisallowed(in String name, int flags, int userHandle,
            in String[] disallowedPackages);
    boolean isUserUnlockingOrUnlocked(int userId);
+59 −22
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.UserInfo;
import android.content.pm.UserInfo.UserInfoFlag;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -2003,18 +2004,20 @@ public class UserManager {

    /**
     * Creates a user with the specified name and options. For non-admin users, default user
     * restrictions are going to be applied.
     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
     * restrictions will be applied.
     *
     * <p>Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
     *
     * @param name the user's name
     * @param flags flags that identify the type of user and other properties.
     * @param flags UserInfo flags that identify the type of user and other properties.
     * @see UserInfo
     *
     * @return the UserInfo object for the created user, or null if the user could not be created.
     * @return the UserInfo object for the created user, or {@code null} if the user could not be
     * created.
     * @hide
     */
    @UnsupportedAppUsage
    public UserInfo createUser(String name, int flags) {
    public @Nullable UserInfo createUser(@Nullable String name, @UserInfoFlag int flags) {
        UserInfo user = null;
        try {
            user = mService.createUser(name, flags);
@@ -2030,6 +2033,36 @@ public class UserManager {
        return user;
    }

    /**
     * Pre-creates a user with the specified name and options. For non-admin users, default user
     * restrictions will be applied.
     *
     * <p>This method can be used by OEMs to "warm" up the user creation by pre-creating some users
     * at the first boot, so they when the "real" user is created (for example,
     * by {@link #createUser(String, int)} or {@link #createGuest(Context, String)}), it takes
     * less time.
     *
     * <p>Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
     *
     * @param flags UserInfo flags that identify the type of user and other properties.
     * @see UserInfo
     *
     * @return the UserInfo object for the created user, or {@code null} if the user could not be
     * created.
     *
     * @throw {@link IllegalArgumentException} if {@code flags} contains
     * {@link UserInfo#FLAG_MANAGED_PROFILE}.
     *
     * @hide
     */
    public @Nullable UserInfo preCreateUser(@UserInfoFlag int flags) {
        try {
            return mService.preCreateUser(flags);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Creates a guest user and configures it.
     * @param context an application context
@@ -2346,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();
        }
@@ -2370,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);
        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;
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
@@ -2765,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);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@
    <string name="permgrouprequest_sms" msgid="7168124215838204719">"Laat &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toe om SMS\'e te stuur en te bekyk?"</string>
    <string name="permgrouplab_storage" msgid="1971118770546336966">"Berging"</string>
    <string name="permgroupdesc_storage" msgid="637758554581589203">"toegang te verkry tot foto\'s, media en lêers op jou toestel"</string>
    <string name="permgrouprequest_storage" msgid="7885942926944299560">"Gee &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang tot jou foto\'s, media en lêers op jou toestel?"</string>
    <string name="permgrouprequest_storage" msgid="7885942926944299560">"Gee vir &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang tot jou foto\'s, media en lêers op jou toestel?"</string>
    <string name="permgrouplab_microphone" msgid="171539900250043464">"Mikrofoon"</string>
    <string name="permgroupdesc_microphone" msgid="4988812113943554584">"oudio op te neem"</string>
    <string name="permgrouprequest_microphone" msgid="9167492350681916038">"Laat &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toe om oudio op te neem?"</string>
Loading