Skip to content

Commit 314419c

Browse files
committed
Update ShareActionProvider to clear the sharing activity when the task
is reset. As per platform guidelines, when launching a sharing activity the Intent flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET should be used. Change-Id: I30bd3d20eb75aee7943b681dc2d9c7f44a04e919
1 parent 629c676 commit 314419c

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
@@ -547,6 +547,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
547547
position = mAdapter.getShowDefaultActivity() ? position : position + 1;
548548
Intent launchIntent = mAdapter.getDataModel().chooseActivity(position);
549549
if (launchIntent != null) {
550+
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
550551
mContext.startActivity(launchIntent);
551552
}
552553
}
@@ -564,6 +565,7 @@ public void onClick(View view) {
564565
final int index = mAdapter.getDataModel().getActivityIndex(defaultActivity);
565566
Intent launchIntent = mAdapter.getDataModel().chooseActivity(index);
566567
if (launchIntent != null) {
568+
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
567569
mContext.startActivity(launchIntent);
568570
}
569571
} 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)