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

Commit 098e2391 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move position of System user pre-condition check in CreateAndManageUser method" into main

parents 94b47803 a795fa44
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -12303,9 +12303,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        }
        final CallerIdentity caller = getCallerIdentity(admin);
        final CallerIdentity caller = getCallerIdentity(admin);
        // Only allow the system user to use this method
        Preconditions.checkCallAuthorization(caller.getUserHandle().isSystem(),
                "createAndManageUser was called from non-system user");
        Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller));
        Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller));
        checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_CREATE_AND_MANAGE_USER);
        checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_CREATE_AND_MANAGE_USER);
@@ -12316,6 +12313,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    "createAndManageUser was called while in headless single user mode");
                    "createAndManageUser was called while in headless single user mode");
        }
        }
        // Only allow the system user to use this method
        Preconditions.checkCallAuthorization(caller.getUserHandle().isSystem(),
                "createAndManageUser was called from non-system user");
        final boolean ephemeral = (flags & DevicePolicyManager.MAKE_USER_EPHEMERAL) != 0;
        final boolean ephemeral = (flags & DevicePolicyManager.MAKE_USER_EPHEMERAL) != 0;
        final boolean demo = (flags & DevicePolicyManager.MAKE_USER_DEMO) != 0
        final boolean demo = (flags & DevicePolicyManager.MAKE_USER_DEMO) != 0
                && UserManager.isDeviceInDemoMode(mContext);
                && UserManager.isDeviceInDemoMode(mContext);