Send a public broadcast when the device owner is set.
Make it a protected broadcast.
BUG: 22623518
Change-Id: Ia36e8f0b80a6301d7d8e0461476842c78762b5e8
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 33cbc9d..b2b1727 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -690,7 +690,7 @@
= "android.app.extra.PROFILE_OWNER_NAME";
/**
- * Activity action: send when any policy admin changes a policy.
+ * Broadcast action: send when any policy admin changes a policy.
* This is generally used to find out when a new policy is in effect.
*
* @hide
@@ -699,6 +699,16 @@
= "android.app.action.DEVICE_POLICY_MANAGER_STATE_CHANGED";
/**
+ * Broadcast action: sent when the device owner is set or changed.
+ *
+ * This broadcast is sent only to the primary user.
+ * @see #ACTION_PROVISION_MANAGED_DEVICE
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_DEVICE_OWNER_CHANGED
+ = "android.app.action.DEVICE_OWNER_CHANGED";
+
+ /**
* The ComponentName of the administrator component.
*
* @see #ACTION_ADD_DEVICE_ADMIN
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 3e22e09..1f49929 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -319,6 +319,7 @@
<protected-broadcast android:name="android.internal.policy.action.BURN_IN_PROTECTION" />
<protected-broadcast android:name="android.app.action.SYSTEM_UPDATE_POLICY_CHANGED" />
+ <protected-broadcast android:name="android.app.action.DEVICE_OWNER_CHANGED" />
<!-- ====================================================================== -->
<!-- RUNTIME PERMISSIONS -->
<!-- ====================================================================== -->