Add metrics for DevicePolicyManagerService methods (Part 1)

CTS tests will be added in a later CL.

Bug: 119911940
Test: Manual
Change-Id: I040deec232e40b223821a5c521661310f78e6cba
This commit is contained in:
arangelov
2018-11-22 15:01:39 +00:00
parent 1476826d99
commit 37a6217e5b
2 changed files with 134 additions and 6 deletions

View File

@@ -16,6 +16,8 @@
package android.app.admin;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.stats.devicepolicy.nano.StringList;
import android.util.StatsLog;
@@ -34,7 +36,7 @@ import com.android.internal.util.Preconditions;
*
* DevicePolicyEventLogger
* .createEvent(DevicePolicyEnums.USER_RESTRICTION_CHANGED)
* .setAdminPackageName(who)
* .setAdmin(who)
* .setString(key)
* .setBoolean(enabledFromThisOwner)
* .write();
@@ -170,11 +172,19 @@ public final class DevicePolicyEventLogger {
/**
* Sets the package name of the admin application.
*/
public DevicePolicyEventLogger setAdminPackageName(String packageName) {
public DevicePolicyEventLogger setAdmin(@Nullable String packageName) {
mAdminPackageName = packageName;
return this;
}
/**
* Retrieves the package name of the admin application from the {@link ComponentName}.
*/
public DevicePolicyEventLogger setAdmin(@Nullable ComponentName componentName) {
mAdminPackageName = (componentName != null ? componentName.getPackageName() : null);
return this;
}
/**
* Returns the package name of the admin application.
*/