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

Commit a2108705 authored by Pavel Grafov's avatar Pavel Grafov Committed by Android (Google) Code Review
Browse files

Merge "Add COPE related metric."

parents 595316bb e878706d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -159,4 +159,7 @@ enum EventId {
  ALLOW_MODIFICATION_OF_ADMIN_CONFIGURED_NETWORKS = 132;
  SET_TIME = 133;
  SET_TIME_ZONE = 134;
  SET_PERSONAL_APPS_SUSPENDED = 135;
  SET_MANAGED_PROFILE_MAXIMUM_TIME_OFF = 136;
  COMP_TO_ORG_OWNED_PO_MIGRATED = 137;
}
+21 −3
Original line number Diff line number Diff line
@@ -2542,7 +2542,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
     * corporate owned device.
     */
    @GuardedBy("getLockObject()")
    private void maybeMigrateToProfileOnOrganizationOwnedDeviceLocked() {
    private void migrateToProfileOnOrganizationOwnedDeviceIfCompLocked() {
        logIfVerbose("Checking whether we need to migrate COMP ");
        final int doUserId = mOwners.getDeviceOwnerUserId();
        if (doUserId == UserHandle.USER_NULL) {
@@ -2605,6 +2605,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        // Note: KeyChain keys are not removed and will remain accessible for the apps that have
        // been given grants to use them.
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.COMP_TO_ORG_OWNED_PO_MIGRATED)
                .setAdmin(poAdminComponent)
                .write();
    }
    private void moveDoPoliciesToProfileParentAdmin(ActiveAdmin doAdmin, ActiveAdmin parentAdmin) {
@@ -3865,7 +3870,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            case SystemService.PHASE_ACTIVITY_MANAGER_READY:
                maybeStartSecurityLogMonitorOnActivityManagerReady();
                synchronized (getLockObject()) {
                    maybeMigrateToProfileOnOrganizationOwnedDeviceLocked();
                    migrateToProfileOnOrganizationOwnedDeviceIfCompLocked();
                }
                final int userId = getManagedUserId(UserHandle.USER_SYSTEM);
                if (userId >= 0) {
@@ -15551,6 +15556,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        mInjector.binderWithCleanCallingIdentity(
                () -> applyPersonalAppsSuspension(callingUserId, suspended));
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PERSONAL_APPS_SUSPENDED)
                .setAdmin(who)
                .setBoolean(suspended)
                .write();
    }
    /**
@@ -15722,9 +15733,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        mInjector.binderWithCleanCallingIdentity(
                () -> updatePersonalAppSuspension(userId, mUserManager.isUserUnlocked()));
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_MANAGED_PROFILE_MAXIMUM_TIME_OFF)
                .setAdmin(who)
                .setTimePeriod(timeoutMs)
                .write();
    }
    void enforceHandlesCheckPolicyComplianceIntent(@UserIdInt int userId, String packageName) {
    private void enforceHandlesCheckPolicyComplianceIntent(
            @UserIdInt int userId, String packageName) {
        mInjector.binderWithCleanCallingIdentity(() -> {
            final Intent intent = new Intent(DevicePolicyManager.ACTION_CHECK_POLICY_COMPLIANCE);
            intent.setPackage(packageName);