Merge "Send a public broadcast when the device owner is set." into mnc-dev

This commit is contained in:
Nicolas Prévot
2015-07-29 16:59:46 +00:00
committed by Android (Google) Code Review
5 changed files with 22 additions and 1 deletions

View File

@@ -5697,6 +5697,7 @@ package android.app.admin {
method public void uninstallCaCert(android.content.ComponentName, byte[]);
method public void wipeData(int);
field public static final java.lang.String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN";
field public static final java.lang.String ACTION_DEVICE_OWNER_CHANGED = "android.app.action.DEVICE_OWNER_CHANGED";
field public static final java.lang.String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED";
field public static final java.lang.String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE";
field public static final java.lang.String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE";

View File

@@ -5829,6 +5829,7 @@ package android.app.admin {
method public void uninstallCaCert(android.content.ComponentName, byte[]);
method public void wipeData(int);
field public static final java.lang.String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN";
field public static final java.lang.String ACTION_DEVICE_OWNER_CHANGED = "android.app.action.DEVICE_OWNER_CHANGED";
field public static final java.lang.String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED";
field public static final java.lang.String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE";
field public static final java.lang.String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE";

View File

@@ -690,7 +690,7 @@ public class DevicePolicyManager {
= "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
@@ -698,6 +698,16 @@ public class DevicePolicyManager {
public static final String ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
= "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.
*

View File

@@ -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 -->
<!-- ====================================================================== -->

View File

@@ -4140,6 +4140,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
mDeviceOwner.writeOwnerFile();
updateDeviceOwnerLocked();
Intent intent = new Intent(DevicePolicyManager.ACTION_DEVICE_OWNER_CHANGED);
ident = Binder.clearCallingIdentity();
try {
mContext.sendBroadcastAsUser(intent, UserHandle.OWNER);
} finally {
Binder.restoreCallingIdentity(ident);
}
return true;
}
}