Fix a bug in TaskStackBuilder where task stack PendingIntents would
not clear tasks properly. Change-Id: I5a7918fa5e400c160409a45d3e00b32f6f4809aa
This commit is contained in:
@@ -206,7 +206,15 @@ public class TaskStackBuilder implements Iterable<Intent> {
|
||||
* @return The obtained PendingIntent
|
||||
*/
|
||||
public PendingIntent getPendingIntent(int requestCode, int flags) {
|
||||
if (mIntents.isEmpty()) {
|
||||
throw new IllegalStateException(
|
||||
"No intents added to TaskStackBuilder; cannot getPendingIntent");
|
||||
}
|
||||
|
||||
Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]);
|
||||
intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TASK |
|
||||
Intent.FLAG_ACTIVITY_TASK_ON_HOME);
|
||||
return PendingIntent.getActivities(mSourceContext, requestCode, intents, flags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user