Allow system to retrieve keyguardDisabledFeatures for an admin
Bug: 279692817 Test: manual Test: btest a.d.c.KeyguardTest Change-Id: Iea6baeb8b775ceacc8e75b73c5cc5a5fd21e1d10
This commit is contained in:
@@ -9425,12 +9425,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
synchronized (getLockObject()) {
|
||||
if (who != null) {
|
||||
if (isPermissionCheckFlagEnabled()) {
|
||||
EnforcingAdmin admin = getEnforcingAdminForCaller(
|
||||
who, who.getPackageName());
|
||||
EnforcingAdmin admin = getEnforcingAdminForPackage(
|
||||
who, who.getPackageName(), userHandle);
|
||||
Integer features = mDevicePolicyEngine.getLocalPolicySetByAdmin(
|
||||
PolicyDefinition.KEYGUARD_DISABLED_FEATURES,
|
||||
admin,
|
||||
affectedUserId);
|
||||
|
||||
return features == null ? 0 : features;
|
||||
} else {
|
||||
ActiveAdmin admin = getActiveAdminUncheckedLocked(who, userHandle, parent);
|
||||
@@ -23566,6 +23567,30 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
return EnforcingAdmin.createEnforcingAdmin(caller.getPackageName(), userId, admin);
|
||||
}
|
||||
|
||||
private EnforcingAdmin getEnforcingAdminForPackage(@Nullable ComponentName who,
|
||||
String packageName, int userId) {
|
||||
ActiveAdmin admin;
|
||||
if (who != null) {
|
||||
if (isDeviceOwner(who, userId) || isProfileOwner(who, userId)) {
|
||||
synchronized (getLockObject()) {
|
||||
admin = getActiveAdminUncheckedLocked(who, userId);
|
||||
}
|
||||
if (admin != null) {
|
||||
return EnforcingAdmin.createEnterpriseEnforcingAdmin(who, userId, admin);
|
||||
}
|
||||
} else {
|
||||
// Check for non-DPC active admins.
|
||||
admin = getActiveAdminUncheckedLocked(who, userId);
|
||||
if (admin != null) {
|
||||
return EnforcingAdmin.createDeviceAdminEnforcingAdmin(who, userId, admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
admin = getUserData(userId).createOrGetPermissionBasedAdmin(userId);
|
||||
return EnforcingAdmin.createEnforcingAdmin(packageName, userId, admin);
|
||||
}
|
||||
|
||||
private int getAffectedUser(boolean calledOnParent) {
|
||||
int callingUserId = mInjector.userHandleGetCallingUserId();
|
||||
return calledOnParent ? getProfileParentId(callingUserId) : callingUserId;
|
||||
|
||||
Reference in New Issue
Block a user