Merge "Fix sharing bugreports from lockscreen"
This commit is contained in:
@@ -84,6 +84,14 @@ import java.util.List;
|
||||
public class ChooserActivity extends ResolverActivity {
|
||||
private static final String TAG = "ChooserActivity";
|
||||
|
||||
/**
|
||||
* Boolean extra to change the following behavior: Normally, ChooserActivity finishes itself
|
||||
* in onStop when launched in a new task. If this extra is set to true, we do not finish
|
||||
* ourselves when onStop gets called.
|
||||
*/
|
||||
public static final String EXTRA_PRIVATE_RETAIN_IN_ON_STOP
|
||||
= "com.android.internal.app.ChooserActivity.EXTRA_PRIVATE_RETAIN_IN_ON_STOP";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final int QUERY_TARGET_SERVICE_LIMIT = 5;
|
||||
@@ -260,6 +268,7 @@ public class ChooserActivity extends ResolverActivity {
|
||||
}
|
||||
|
||||
mPinnedSharedPrefs = getPinnedSharedPrefs(this);
|
||||
setRetainInOnStop(intent.getBooleanExtra(EXTRA_PRIVATE_RETAIN_IN_ON_STOP, false));
|
||||
super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents,
|
||||
null, false);
|
||||
|
||||
|
||||
@@ -116,6 +116,10 @@ public class ResolverActivity extends Activity {
|
||||
private Runnable mPostListReadyRunnable;
|
||||
|
||||
private boolean mRegistered;
|
||||
|
||||
/** See {@link #setRetainInOnStop}. */
|
||||
private boolean mRetainInOnStop;
|
||||
|
||||
private final PackageMonitor mPackageMonitor = new PackageMonitor() {
|
||||
@Override public void onSomePackagesChanged() {
|
||||
mAdapter.handlePackagesChanged();
|
||||
@@ -502,7 +506,7 @@ public class ResolverActivity extends Activity {
|
||||
}
|
||||
final Intent intent = getIntent();
|
||||
if ((intent.getFlags() & FLAG_ACTIVITY_NEW_TASK) != 0 && !isVoiceInteraction()
|
||||
&& !mResolvingHome) {
|
||||
&& !mResolvingHome && !mRetainInOnStop) {
|
||||
// This resolver is in the unusual situation where it has been
|
||||
// launched at the top of a new task. We don't let it be added
|
||||
// to the recent tasks shown to the user, and we need to make sure
|
||||
@@ -1028,6 +1032,14 @@ public class ResolverActivity extends Activity {
|
||||
return mSupportsAlwaysUseOption && mAdapter.hasFilteredItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@code retainInOnStop} is set to true, we will not finish ourselves when onStop gets
|
||||
* called and we are launched in a new task.
|
||||
*/
|
||||
protected void setRetainInOnStop(boolean retainInOnStop) {
|
||||
mRetainInOnStop = retainInOnStop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a simple match for the component of two ResolveInfos.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user