Loading core/java/android/app/PendingIntent.java +25 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,31 @@ public final class PendingIntent implements Parcelable { return null; } /** * @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()}. Loading core/java/android/app/TaskStackBuilder.java +14 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,20 @@ public class TaskStackBuilder { flags, options); } /** * @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 Loading services/java/com/android/server/WifiService.java +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ContentResolver; Loading Loading @@ -1766,9 +1767,10 @@ public class WifiService extends IWifiManager.Stub { mNotification.when = 0; mNotification.icon = ICON_NETWORKS_AVAILABLE; mNotification.flags = Notification.FLAG_AUTO_CANCEL; mNotification.contentIntent = PendingIntent.getActivityAsUser(mContext, 0, new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK), 0, null, UserHandle.CURRENT); mNotification.contentIntent = TaskStackBuilder.create(mContext) .addNextIntentWithParentStack( new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)) .getPendingIntent(0, 0, null, UserHandle.CURRENT); } CharSequence title = mContext.getResources().getQuantityText( Loading Loading
core/java/android/app/PendingIntent.java +25 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,31 @@ public final class PendingIntent implements Parcelable { return null; } /** * @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()}. Loading
core/java/android/app/TaskStackBuilder.java +14 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,20 @@ public class TaskStackBuilder { flags, options); } /** * @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 Loading
services/java/com/android/server/WifiService.java +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ContentResolver; Loading Loading @@ -1766,9 +1767,10 @@ public class WifiService extends IWifiManager.Stub { mNotification.when = 0; mNotification.icon = ICON_NETWORKS_AVAILABLE; mNotification.flags = Notification.FLAG_AUTO_CANCEL; mNotification.contentIntent = PendingIntent.getActivityAsUser(mContext, 0, new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK), 0, null, UserHandle.CURRENT); mNotification.contentIntent = TaskStackBuilder.create(mContext) .addNextIntentWithParentStack( new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)) .getPendingIntent(0, 0, null, UserHandle.CURRENT); } CharSequence title = mContext.getResources().getQuantityText( Loading