diff options
| author | 2017-02-24 13:49:47 +0100 | |
|---|---|---|
| committer | 2017-02-24 17:37:08 +0000 | |
| commit | f631ef769ad718f9ce52955d67623fa67a942cd5 (patch) | |
| tree | 71b02c758333bf6426d6d0d5d93a23bdf4f9deea /packages/Shell/src | |
| parent | 38a65f6c56f78fd5102bf21f34691a86e642bd26 (diff) | |
Fix sharing bugreports from lockscreen
When launching ChooserActivity from lockscreen, we will start it
in stopped state because lockscreen is still showing, meaning that
the activity goes through start -> resume -> pause -> stop
immediately after it was launched, and will be later resumed once
Keyguard actually goes away.
However, ResolverActivity finished itself in onStop. We add a
private extra to change this behavior for sharing bugreports.
Test: Take bugreport, double tap on it on lockscreen
Test: com.android.shell.BugreportReceiverTest$1
Bug: 33009364
Change-Id: I973b2c71587950499b7c88b16af9cf1387795e17
Diffstat (limited to 'packages/Shell/src')
| -rw-r--r-- | packages/Shell/src/com/android/shell/BugreportProgressService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 12d0c0306e61..1df626ff9a2f 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -44,6 +44,7 @@ import java.util.zip.ZipOutputStream; import libcore.io.Streams; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.app.ChooserActivity; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.util.FastPrintWriter; @@ -943,8 +944,13 @@ public class BugreportProgressService extends Service { } static void sendShareIntent(Context context, Intent intent) { - context.startActivity(Intent.createChooser(intent, - context.getResources().getText(R.string.bugreport_intent_chooser_title))); + final Intent chooserIntent = Intent.createChooser(intent, + context.getResources().getText(R.string.bugreport_intent_chooser_title)); + + // Since we may be launched behind lockscreen, make sure that ChooserActivity doesn't finish + // itself in onStop. + chooserIntent.putExtra(ChooserActivity.EXTRA_PRIVATE_RETAIN_IN_ON_STOP, true); + context.startActivity(chooserIntent); } /** |