diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-08-29 18:32:08 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-08-30 14:33:22 -0700 |
commit | 5ac72a29593ab9a20337a2225df52bdf4754be02 (patch) | |
tree | dc5310e556b3662cb5f097b30e700a26d50a4db5 /services/java/com/android/server/DevicePolicyManagerService.java | |
parent | e217ee4d7a8223289a1af7363627c69956c46d41 (diff) | |
download | frameworks_base-5ac72a29593ab9a20337a2225df52bdf4754be02.zip frameworks_base-5ac72a29593ab9a20337a2225df52bdf4754be02.tar.gz frameworks_base-5ac72a29593ab9a20337a2225df52bdf4754be02.tar.bz2 |
Improve multi-user broadcasts.
You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.
Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.
New Context APIs for more kinds of sending broadcasts as users.
Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.
Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.
Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
Diffstat (limited to 'services/java/com/android/server/DevicePolicyManagerService.java')
-rw-r--r-- | services/java/com/android/server/DevicePolicyManagerService.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java index f966a33..77b062c 100644 --- a/services/java/com/android/server/DevicePolicyManagerService.java +++ b/services/java/com/android/server/DevicePolicyManagerService.java @@ -55,6 +55,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; +import android.os.UserHandle; import android.provider.Settings; import android.util.PrintWriterPrinter; import android.util.Printer; @@ -570,10 +571,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { intent.putExtra("expiration", admin.passwordExpirationDate); } if (result != null) { - mContext.sendOrderedBroadcast(intent, null, result, mHandler, - Activity.RESULT_OK, null, null); + mContext.sendOrderedBroadcastAsUser(intent, UserHandle.OWNER, + null, result, mHandler, Activity.RESULT_OK, null, null); } else { - mContext.sendBroadcast(intent); + mContext.sendBroadcastAsUser(intent, UserHandle.OWNER); } } @@ -712,7 +713,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private void sendChangedNotification() { Intent intent = new Intent(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); intent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); - mContext.sendBroadcast(intent); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } private void loadSettingsLocked() { @@ -1734,7 +1735,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } Intent intent = new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_DISABLE_REQUESTED); intent.setComponent(admin.info.getComponent()); - mContext.sendOrderedBroadcast(intent, null, new BroadcastReceiver() { + mContext.sendOrderedBroadcastAsUser(intent, UserHandle.OWNER, + null, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { try { |