Add metrics logging for setTime and setTimeZone

Bug: 148841428
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetTime
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetTimeZone

Change-Id: I9588d1259026f7a4c655a10407fbc90dbef309ca
This commit is contained in:
Alex Johnston
2020-02-06 12:31:03 +00:00
parent eb241932c7
commit feff951d37
2 changed files with 12 additions and 0 deletions

View File

@@ -157,4 +157,6 @@ enum EventId {
SET_FACTORY_RESET_PROTECTION = 130;
SET_COMMON_CRITERIA_MODE = 131;
ALLOW_MODIFICATION_OF_ADMIN_CONFIGURED_NETWORKS = 132;
SET_TIME = 133;
SET_TIME_ZONE = 134;
}

View File

@@ -11583,6 +11583,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
millis, "DevicePolicyManagerService: setTime");
mInjector.binderWithCleanCallingIdentity(
() -> mInjector.getTimeDetector().suggestManualTime(manualTimeSuggestion));
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_TIME)
.setAdmin(who)
.write();
return true;
}
@@ -11599,6 +11604,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
timeZone, "DevicePolicyManagerService: setTimeZone");
mInjector.binderWithCleanCallingIdentity(() ->
mInjector.getTimeZoneDetector().suggestManualTimeZone(manualTimeZoneSuggestion));
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_TIME_ZONE)
.setAdmin(who)
.write();
return true;
}