Merge "Add a new broadcast to notify when dpm constants change" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b9f9e6fbac
@@ -429,6 +429,7 @@ package android.app.admin {
|
||||
method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public boolean setDeviceOwner(@NonNull android.content.ComponentName, @Nullable String, int);
|
||||
method @RequiresPermission("android.permission.MANAGE_DEVICE_ADMINS") public void setNextOperationSafety(int, int);
|
||||
field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
|
||||
field public static final String ACTION_DEVICE_POLICY_CONSTANTS_CHANGED = "android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED";
|
||||
field public static final int CODE_ACCOUNTS_NOT_EMPTY = 6; // 0x6
|
||||
field public static final int CODE_CANNOT_ADD_MANAGED_PROFILE = 11; // 0xb
|
||||
field public static final int CODE_DEVICE_ADMIN_NOT_SUPPORTED = 13; // 0xd
|
||||
|
||||
@@ -1765,6 +1765,16 @@ public class DevicePolicyManager {
|
||||
public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED =
|
||||
"android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
|
||||
|
||||
/**
|
||||
* Broadcast action: notify that a value of {@link Settings.Global#DEVICE_POLICY_CONSTANTS}
|
||||
* has been changed.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||
public static final String ACTION_DEVICE_POLICY_CONSTANTS_CHANGED =
|
||||
"android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED";
|
||||
|
||||
/**
|
||||
* Permission policy to prompt user for new permission requests for runtime permissions.
|
||||
* Already granted or denied permissions are not affected by this.
|
||||
|
||||
@@ -694,6 +694,7 @@
|
||||
|
||||
<!-- Added in S -->
|
||||
<protected-broadcast android:name="android.intent.action.REBOOT_READY" />
|
||||
<protected-broadcast android:name="android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED" />
|
||||
|
||||
<!-- ====================================================================== -->
|
||||
<!-- RUNTIME PERMISSIONS -->
|
||||
|
||||
@@ -12127,6 +12127,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
@Override
|
||||
public void onChange(boolean selfChange, Uri uri, int userId) {
|
||||
mConstants = loadConstants();
|
||||
|
||||
mInjector.binderWithCleanCallingIdentity(() -> {
|
||||
final Intent intent = new Intent(
|
||||
DevicePolicyManager.ACTION_DEVICE_POLICY_CONSTANTS_CHANGED);
|
||||
intent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
||||
final List<UserInfo> users = mUserManager.getAliveUsers();
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
mContext.sendBroadcastAsUser(intent, UserHandle.of(users.get(i).id));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user