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

am: 21f98459b7

* commit '21f98459b7740f57f6fd0415298cb5f5c0c7e0ae':
  Do not get device owner admin info when device owner is null

Change-Id: I8bca370306be7cafe536dc57d1b1d53dd0f50297
This commit is contained in:
Ricky Wai
2016-05-31 17:30:54 +00:00
committed by android-build-merger

View File

@@ -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. // If caller has PO (or DO) it can change the password, so see if that's the case first.
ActiveAdmin admin = getActiveAdminWithPolicyForUidLocked( ActiveAdmin admin = getActiveAdminWithPolicyForUidLocked(
null, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER, callingUid); null, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER, callingUid);
final boolean preN = getTargetSdk(admin.info.getPackageName(), final boolean preN;
userHandle) <= android.os.Build.VERSION_CODES.M; if (admin != null) {
if (admin == null) { preN = getTargetSdk(admin.info.getPackageName(),
userHandle) <= android.os.Build.VERSION_CODES.M;
} else {
// Otherwise, make sure the caller has any active admin with the right policy. // Otherwise, make sure the caller has any active admin with the right policy.
admin = getActiveAdminForCallerLocked(null, admin = getActiveAdminForCallerLocked(null,
DeviceAdminInfo.USES_POLICY_RESET_PASSWORD); 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. // As of N, password resetting to empty/null is not allowed anymore.
// TODO Should we allow DO/PO to set an empty password? // TODO Should we allow DO/PO to set an empty password?