Skip to content

Commit 37e800d

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Update ShareActionProvider to clear the sharing activity when the task is reset."
2 parents 15a7bc6 + 314419c commit 37e800d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

core/java/android/widget/ActivityChooserView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
545545
position = mAdapter.getShowDefaultActivity() ? position : position + 1;
546546
Intent launchIntent = mAdapter.getDataModel().chooseActivity(position);
547547
if (launchIntent != null) {
548+
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
548549
mContext.startActivity(launchIntent);
549550
}
550551
}
@@ -562,6 +563,7 @@ public void onClick(View view) {
562563
final int index = mAdapter.getDataModel().getActivityIndex(defaultActivity);
563564
Intent launchIntent = mAdapter.getDataModel().chooseActivity(index);
564565
if (launchIntent != null) {
566+
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
565567
mContext.startActivity(launchIntent);
566568
}
567569
} else if (view == mExpandActivityOverflowButton) {

core/java/android/widget/ShareActionProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ public boolean onMenuItemClick(MenuItem item) {
279279
final int itemId = item.getItemId();
280280
Intent launchIntent = dataModel.chooseActivity(itemId);
281281
if (launchIntent != null) {
282+
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
282283
mContext.startActivity(launchIntent);
283284
}
284285
return true;

0 commit comments

Comments
 (0)