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

Commit 45c5f941 authored by Ricky Wai's avatar Ricky Wai Committed by android-build-merger
Browse files

Merge "Do not get device owner admin info when device owner is null" into nyc-dev am: 21f98459

am: 3c570f9a

* commit '3c570f9a':
  Do not get device owner admin info when device owner is null

Change-Id: Iaa58b141c72bb4a419bc40fd8091dd28b239ddbc
parents c87bf0ad 3c570f9a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -3810,12 +3810,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            // If caller has PO (or DO) it can change the password, so see if that's the case first.
            ActiveAdmin admin = getActiveAdminWithPolicyForUidLocked(
                    null, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER, callingUid);
            final boolean preN = getTargetSdk(admin.info.getPackageName(),
            final boolean preN;
            if (admin != null) {
                preN = getTargetSdk(admin.info.getPackageName(),
                        userHandle) <= android.os.Build.VERSION_CODES.M;
            if (admin == null) {
            } else {
                // Otherwise, make sure the caller has any active admin with the right policy.
                admin = getActiveAdminForCallerLocked(null,
                        DeviceAdminInfo.USES_POLICY_RESET_PASSWORD);
                preN = getTargetSdk(admin.info.getPackageName(),
                        userHandle) <= android.os.Build.VERSION_CODES.M;

                // As of N, password resetting to empty/null is not allowed anymore.
                // TODO Should we allow DO/PO to set an empty password?