summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-10-01 10:32:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-01 10:32:35 -0700
commitc56e5600501a5c376dc13e6a99fcec7782fc8718 (patch)
treee7a84b030f994b13e90d8b7f39ff6a5050395981 /core/java
parentbfbf6e1232013a999f4776f7fdf7cf6fb577f89b (diff)
parentd56b4d1db34bd6928f599e7e9a7321c2a81cb995 (diff)
downloadframeworks_base-c56e5600501a5c376dc13e6a99fcec7782fc8718.zip
frameworks_base-c56e5600501a5c376dc13e6a99fcec7782fc8718.tar.gz
frameworks_base-c56e5600501a5c376dc13e6a99fcec7782fc8718.tar.bz2
Merge "Construct a task stack for picking a wifi network from notification" into jb-mr1-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/PendingIntent.java25
-rw-r--r--core/java/android/app/TaskStackBuilder.java14
2 files changed, 39 insertions, 0 deletions
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 9d57467..d36d99d 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -395,6 +395,31 @@ public final class PendingIntent implements Parcelable {
}
/**
+ * @hide
+ * Note that UserHandle.CURRENT will be interpreted at the time the
+ * activity is started, not when the pending intent is created.
+ */
+ public static PendingIntent getActivitiesAsUser(Context context, int requestCode,
+ Intent[] intents, int flags, Bundle options, UserHandle user) {
+ String packageName = context.getPackageName();
+ String[] resolvedTypes = new String[intents.length];
+ for (int i=0; i<intents.length; i++) {
+ intents[i].setAllowFds(false);
+ resolvedTypes[i] = intents[i].resolveTypeIfNeeded(context.getContentResolver());
+ }
+ try {
+ IIntentSender target =
+ ActivityManagerNative.getDefault().getIntentSender(
+ ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
+ null, null, requestCode, intents, resolvedTypes,
+ flags, options, user.getIdentifier());
+ return target != null ? new PendingIntent(target) : null;
+ } catch (RemoteException e) {
+ }
+ return null;
+ }
+
+ /**
* Retrieve a PendingIntent that will perform a broadcast, like calling
* {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}.
*
diff --git a/core/java/android/app/TaskStackBuilder.java b/core/java/android/app/TaskStackBuilder.java
index 9d5bcc6..3e0ac7e 100644
--- a/core/java/android/app/TaskStackBuilder.java
+++ b/core/java/android/app/TaskStackBuilder.java
@@ -274,6 +274,20 @@ public class TaskStackBuilder {
}
/**
+ * @hide
+ */
+ public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options,
+ UserHandle user) {
+ if (mIntents.isEmpty()) {
+ throw new IllegalStateException(
+ "No intents added to TaskStackBuilder; cannot getPendingIntent");
+ }
+
+ return PendingIntent.getActivitiesAsUser(mSourceContext, requestCode, getIntents(), flags,
+ options, user);
+ }
+
+ /**
* Return an array containing the intents added to this builder. The intent at the
* root of the task stack will appear as the first item in the array and the
* intent at the top of the stack will appear as the last item.