Merge "Add metrics to CrossProfileApps methods." into qt-dev
diff --git a/core/proto/android/stats/devicepolicy/device_policy_enums.proto b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
index 0db7424..0821d14 100644
--- a/core/proto/android/stats/devicepolicy/device_policy_enums.proto
+++ b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
@@ -149,4 +149,6 @@
PROVISIONING_PREPARE_STARTED = 122;
PROVISIONING_PREPARE_COMPLETED = 123;
PROVISIONING_FLOW_TYPE = 124;
+ CROSS_PROFILE_APPS_GET_TARGET_USER_PROFILES = 125;
+ CROSS_PROFILE_APPS_START_ACTIVITY_AS_USER = 126;
}
diff --git a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
index 3a7919a..d6108b7c 100644
--- a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
+++ b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
@@ -24,6 +24,7 @@
import android.app.ActivityOptions;
import android.app.AppOpsManager;
import android.app.IApplicationThread;
+import android.app.admin.DevicePolicyEventLogger;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -37,6 +38,7 @@
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
+import android.stats.devicepolicy.DevicePolicyEnums;
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
@@ -69,6 +71,11 @@
verifyCallingPackage(callingPackage);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.CROSS_PROFILE_APPS_GET_TARGET_USER_PROFILES)
+ .setStrings(new String[] {callingPackage})
+ .write();
+
return getTargetUserProfilesUnchecked(
callingPackage, mInjector.getCallingUserId());
}
@@ -85,6 +92,11 @@
verifyCallingPackage(callingPackage);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.CROSS_PROFILE_APPS_START_ACTIVITY_AS_USER)
+ .setStrings(new String[] {callingPackage})
+ .write();
+
final int callerUserId = mInjector.getCallingUserId();
final int callingUid = mInjector.getCallingUid();