Fix lock task logging for permission based admins
Fixes: 278061827 Test: btest a.d.c.LockTaskTest#startLockTask_recordsMetric* Change-Id: If591dd6cf5bf1bc3a2f2f4232a2edc54665a3018
This commit is contained in:
@@ -15156,6 +15156,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
for (ActiveAdmin admin : policy.mAdminList) {
|
||||
final boolean ownsDevice = isDeviceOwner(admin.info.getComponent(), userHandle);
|
||||
final boolean ownsProfile = isProfileOwner(admin.info.getComponent(), userHandle);
|
||||
// TODO(b/281738975): Should we be logging this for all admins?
|
||||
if (ownsDevice || ownsProfile) {
|
||||
if (isEnabled) {
|
||||
sendAdminCommandLocked(admin, DeviceAdminReceiver.ACTION_LOCK_TASK_ENTERING,
|
||||
@@ -15172,6 +15173,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO(b/281738975): Should we be logging this for all admins?
|
||||
for(EnforcingAdmin admin : mDevicePolicyEngine.getLocalPoliciesSetByAdmins(
|
||||
PolicyDefinition.LOCK_TASK, userHandle).keySet()) {
|
||||
if (admin.hasAuthority(EnforcingAdmin.DPC_AUTHORITY)) {
|
||||
// already handled above
|
||||
continue;
|
||||
}
|
||||
DevicePolicyEventLogger
|
||||
.createEvent(DevicePolicyEnums.SET_LOCKTASK_MODE_ENABLED)
|
||||
.setAdmin(admin.getPackageName())
|
||||
.setBoolean(isEnabled)
|
||||
.setStrings(pkg)
|
||||
.write();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user