Skip to content

Commit 0a19dba

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Present a one-time chooser when sharing screenshots." into jb-dev
2 parents 6acca24 + 046fddf commit 0a19dba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,16 @@ protected SaveImageInBackgroundData doInBackground(SaveImageInBackgroundData...
188188
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
189189
sharingIntent.setType("image/png");
190190
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
191-
sharingIntent.setFlags(Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS);
191+
192+
Intent chooserIntent = Intent.createChooser(sharingIntent, null);
193+
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS
194+
| Intent.FLAG_ACTIVITY_CLEAR_TASK
195+
| Intent.FLAG_ACTIVITY_NEW_TASK);
196+
192197
mNotificationBuilder.addAction(R.drawable.ic_menu_share,
193198
r.getString(com.android.internal.R.string.share),
194-
PendingIntent.getActivity(context, 0, sharingIntent, 0));
199+
PendingIntent.getActivity(context, 0, chooserIntent,
200+
PendingIntent.FLAG_CANCEL_CURRENT));
195201

196202
OutputStream out = resolver.openOutputStream(uri);
197203
image.compress(Bitmap.CompressFormat.PNG, 100, out);

0 commit comments

Comments
 (0)