summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-08-29 18:32:08 -0700
committerDianne Hackborn <hackbod@google.com>2012-08-30 14:33:22 -0700
commit5ac72a29593ab9a20337a2225df52bdf4754be02 (patch)
treedc5310e556b3662cb5f097b30e700a26d50a4db5 /core/tests
parente217ee4d7a8223289a1af7363627c69956c46d41 (diff)
downloadframeworks_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 'core/tests')
-rw-r--r--core/tests/coretests/src/android/app/activity/BroadcastTest.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/tests/coretests/src/android/app/activity/BroadcastTest.java b/core/tests/coretests/src/android/app/activity/BroadcastTest.java
index d527c0d..7f551b0 100644
--- a/core/tests/coretests/src/android/app/activity/BroadcastTest.java
+++ b/core/tests/coretests/src/android/app/activity/BroadcastTest.java
@@ -26,6 +26,7 @@ import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
+import android.os.UserHandle;
import android.test.FlakyTest;
import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
@@ -306,7 +307,7 @@ public class BroadcastTest extends ActivityTestsBase {
ActivityManagerNative.getDefault().unbroadcastIntent(null, intent,
Binder.getOrigCallingUser());
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
addIntermediate("finished-broadcast");
IntentFilter filter = new IntentFilter(LaunchpadActivity.BROADCAST_STICKY1);
@@ -318,7 +319,7 @@ public class BroadcastTest extends ActivityTestsBase {
public void testClearSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
ActivityManagerNative.getDefault().unbroadcastIntent(
null, new Intent(LaunchpadActivity.BROADCAST_STICKY1, null),
@@ -333,10 +334,10 @@ public class BroadcastTest extends ActivityTestsBase {
public void testReplaceSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
intent.putExtra("test", LaunchpadActivity.DATA_2);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
addIntermediate("finished-broadcast");
IntentFilter filter = new IntentFilter(LaunchpadActivity.BROADCAST_STICKY1);
@@ -350,7 +351,7 @@ public class BroadcastTest extends ActivityTestsBase {
public void testReceiveSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY1);
}
@@ -360,10 +361,10 @@ public class BroadcastTest extends ActivityTestsBase {
public void testReceive2Sticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
intent = new Intent(LaunchpadActivity.BROADCAST_STICKY2, null);
intent.putExtra("test", LaunchpadActivity.DATA_2);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY2);
}