Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5bfd737 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adding an Extra field for Intents so chooser show up even if one app."

parents 6c6cb168 145b0cad
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4195,6 +4195,16 @@ public class Intent implements Parcelable, Cloneable {
    public static final String EXTRA_MEDIA_RESOURCE_TYPE =
            "android.intent.extra.MEDIA_RESOURCE_TYPE";

    /**
     * Used as a boolean extra field in {@link #ACTION_CHOOSER} intents to specify
     * whether to show the chooser or not when there is only one application available
     * to choose from.
     *
     * @hide
     */
    public static final String EXTRA_AUTO_LAUNCH_SINGLE_CHOICE =
            "android.intent.extra.AUTO_LAUNCH_SINGLE_CHOICE";

    /**
     * Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE}
     * to represent that a video codec is allowed to use.
+7 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import com.android.internal.R;
import com.android.internal.app.ResolverActivity.TargetInfo;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.google.android.collect.Lists;
@@ -344,6 +345,12 @@ public class ChooserActivity extends ResolverActivity {
        return true;
    }

    @Override
    public boolean shouldAutoLaunchSingleChoice(TargetInfo target) {
        return getIntent().getBooleanExtra(Intent.EXTRA_AUTO_LAUNCH_SINGLE_CHOICE,
                super.shouldAutoLaunchSingleChoice(target));
    }

    @Override
    public void showTargetDetails(ResolveInfo ri) {
        ComponentName name = ri.activityInfo.getComponentName();