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

Commit a269c5d5 authored by Lenka Trochtova's avatar Lenka Trochtova Committed by Android (Google) Code Review
Browse files

Merge "Add a flag for creating an ephemeral user with DevicePolicyManager#createAndManageUser."

parents 7a96413b c8202c8d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4206,6 +4206,13 @@ public class DevicePolicyManager {
      */
    public static final int SKIP_SETUP_WIZARD = 0x0001;

    /**
     * Flag used by {@link #createAndManageUser} to specify that the user should be created
     * ephemeral.
     * @hide
     */
    public static final int MAKE_USER_EPHEMERAL = 0x0002;

    /**
     * Called by a device owner to create a user with the specified name and a given component of
     * the calling package as profile owner. The UserHandle returned by this method should not be
+5 −1
Original line number Diff line number Diff line
@@ -6525,7 +6525,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {

            final long id = mInjector.binderClearCallingIdentity();
            try {
                UserInfo userInfo = mUserManager.createUser(name, 0 /* flags */);
                int userInfoFlags = 0;
                if ((flags & DevicePolicyManager.MAKE_USER_EPHEMERAL) != 0) {
                    userInfoFlags |= UserInfo.FLAG_EPHEMERAL;
                }
                UserInfo userInfo = mUserManager.createUser(name, userInfoFlags);
                if (userInfo != null) {
                    user = userInfo.getUserHandle();
                }