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

Commit d5163938 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by android-build-merger
Browse files

Merge "Set label for links to resolver activities." into nyc-dev

am: d1b8d6d3

* commit 'd1b8d6d3':
  Set label for links to resolver activities.

Change-Id: Iaf7e59bdca4a25b347661bed7b927b8100dcac96
parents d848ebb7 d1b8d6d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ public final class MediaStore {
     *
     * <p>Note: if you app targets {@link android.os.Build.VERSION_CODES#M M} and above
     * and declares as using the {@link android.Manifest.permission#CAMERA} permission which
     * is not granted, then atempting to use this action will result in a {@link
     * is not granted, then attempting to use this action will result in a {@link
     * java.lang.SecurityException}.
     *
     *  @see #EXTRA_OUTPUT
+36 −8
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.internal.app;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.app.Activity;
import android.app.ActivityThread;
import android.app.VoiceInteractor.PickOptionRequest;
@@ -24,6 +26,7 @@ import android.app.VoiceInteractor.PickOptionRequest.Option;
import android.app.VoiceInteractor.Prompt;
import android.content.pm.ComponentInfo;
import android.os.AsyncTask;
import android.provider.MediaStore;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;
@@ -119,37 +122,62 @@ public class ResolverActivity extends Activity {
        }
    };

    /**
     * Get the string resource to be used as a label for the link to the resolver activity for an
     * action.
     *
     * @param action The action to resolve
     *
     * @return The string resource to be used as a label
     */
    public static @StringRes int getLabelRes(String action) {
        return ActionTitle.forAction(action).labelRes;
    }

    private enum ActionTitle {
        VIEW(Intent.ACTION_VIEW,
                com.android.internal.R.string.whichViewApplication,
                com.android.internal.R.string.whichViewApplicationNamed),
                com.android.internal.R.string.whichViewApplicationNamed,
                com.android.internal.R.string.whichViewApplicationLabel),
        EDIT(Intent.ACTION_EDIT,
                com.android.internal.R.string.whichEditApplication,
                com.android.internal.R.string.whichEditApplicationNamed),
                com.android.internal.R.string.whichEditApplicationNamed,
                com.android.internal.R.string.whichEditApplicationLabel),
        SEND(Intent.ACTION_SEND,
                com.android.internal.R.string.whichSendApplication,
                com.android.internal.R.string.whichSendApplicationNamed),
                com.android.internal.R.string.whichSendApplicationNamed,
                com.android.internal.R.string.whichSendApplicationLabel),
        SENDTO(Intent.ACTION_SENDTO,
                com.android.internal.R.string.whichSendToApplication,
                com.android.internal.R.string.whichSendToApplicationNamed),
                com.android.internal.R.string.whichSendToApplicationNamed,
                com.android.internal.R.string.whichSendToApplicationLabel),
        SEND_MULTIPLE(Intent.ACTION_SEND_MULTIPLE,
                com.android.internal.R.string.whichSendApplication,
                com.android.internal.R.string.whichSendApplicationNamed),
                com.android.internal.R.string.whichSendApplicationNamed,
                com.android.internal.R.string.whichSendApplicationLabel),
        CAPTURE_IMAGE(MediaStore.ACTION_IMAGE_CAPTURE,
                com.android.internal.R.string.whichImageCaptureApplication,
                com.android.internal.R.string.whichImageCaptureApplicationNamed,
                com.android.internal.R.string.whichImageCaptureApplicationLabel),
        DEFAULT(null,
                com.android.internal.R.string.whichApplication,
                com.android.internal.R.string.whichApplicationNamed),
                com.android.internal.R.string.whichApplicationNamed,
                com.android.internal.R.string.whichApplicationLabel),
        HOME(Intent.ACTION_MAIN,
                com.android.internal.R.string.whichHomeApplication,
                com.android.internal.R.string.whichHomeApplicationNamed);
                com.android.internal.R.string.whichHomeApplicationNamed,
                com.android.internal.R.string.whichHomeApplicationLabel);

        public final String action;
        public final int titleRes;
        public final int namedTitleRes;
        public final @StringRes int labelRes;

        ActionTitle(String action, int titleRes, int namedTitleRes) {
        ActionTitle(String action, int titleRes, int namedTitleRes, @StringRes int labelRes) {
            this.action = action;
            this.titleRes = titleRes;
            this.namedTitleRes = namedTitleRes;
            this.labelRes = labelRes;
        }

        public static ActionTitle forAction(String action) {
+20 −0
Original line number Diff line number Diff line
@@ -2552,21 +2552,29 @@
    <!-- Title of intent resolver dialog when selecting an application to run
         and a previously used application is known. -->
    <string name="whichApplicationNamed">Complete action using %1$s</string>
    <!-- Generic label for a link to a intent resolver. -->
    <string name="whichApplicationLabel">Complete action</string>
    <!-- Title of intent resolver dialog when selecting a viewer application to run. -->
    <string name="whichViewApplication">Open with</string>
    <!-- Title of intent resolver dialog when selecting a viewer application to run
         and a previously used application is known. -->
    <string name="whichViewApplicationNamed">Open with %1$s</string>
    <!-- Label for a link to a intent resolver dialog to view something -->
    <string name="whichViewApplicationLabel">Open</string>
    <!-- Title of intent resolver dialog when selecting an editor application to run. -->
    <string name="whichEditApplication">Edit with</string>
    <!-- Title of intent resolver dialog when selecting an editor application to run
         and a previously used application is known. -->
    <string name="whichEditApplicationNamed">Edit with %1$s</string>
    <!-- Label for a link to a intent resolver dialog when selecting an editor application -->
    <string name="whichEditApplicationLabel">Edit</string>
    <!-- Title of intent resolver dialog when selecting a sharing application to run. -->
    <string name="whichSendApplication">Share with</string>
    <!-- Title of intent resolver dialog when selecting a sharing application to run
         and a previously used application is known. -->
    <string name="whichSendApplicationNamed">Share with %1$s</string>
    <!-- Label for a link to a intent resolver dialog to sharing something -->
    <string name="whichSendApplicationLabel">Share</string>
    <!-- Title of intent resolver dialog when selecting an application to run to
         send content to a specific recipient. Often used for email. -->
    <string name="whichSendToApplication">Send using</string>
@@ -2574,11 +2582,23 @@
         send content to a specific recipient and a previously used application is known.
         Often used for email. -->
    <string name="whichSendToApplicationNamed">Send using %1$s</string>
    <!-- Label for a link to a intent resolver dialog to send content to a specific recipient. -->
    <string name="whichSendToApplicationLabel">Send</string>
    <!-- Title of intent resolver dialog when selecting a HOME application to run. -->
    <string name="whichHomeApplication">Select a Home app</string>
    <!-- Title of intent resolver dialog when selecting a HOME application to run
         and a previously used application is known. -->
    <string name="whichHomeApplicationNamed">Use %1$s as Home</string>
    <!-- Label for a link to a intent resolver dialog when selecting a HOME -->
    <string name="whichHomeApplicationLabel">Capture image</string>
    <!-- Option to always use the selected application resolution in the future. See the "Complete action using" dialog title-->
    <!-- Title of intent resolver dialog when capturing an image. -->
    <string name="whichImageCaptureApplication">Capture image with</string>
    <!-- Title of intent resolver dialog when capturing an image
         and a previously used application is known. -->
    <string name="whichImageCaptureApplicationNamed">Capture image with %1$s</string>
    <!-- Label for a link to a intent resolver dialog when capturing an image -->
    <string name="whichImageCaptureApplicationLabel">Capture image</string>
    <!-- Option to always use the selected application resolution in the future. See the "Complete action using" dialog title-->
    <string name="alwaysUse">Use by default for this action.</string>
    <!-- Title of the list of alternate options to complete an action shown when the
+9 −0
Original line number Diff line number Diff line
@@ -2198,14 +2198,22 @@
  <java-symbol type="attr" name="touchscreenBlocksFocus" />
  <java-symbol type="layout" name="resolver_list_with_default" />
  <java-symbol type="string" name="whichApplicationNamed" />
  <java-symbol type="string" name="whichApplicationLabel" />
  <java-symbol type="string" name="whichViewApplication" />
  <java-symbol type="string" name="whichViewApplicationNamed" />
  <java-symbol type="string" name="whichViewApplicationLabel" />
  <java-symbol type="string" name="whichEditApplication" />
  <java-symbol type="string" name="whichEditApplicationNamed" />
  <java-symbol type="string" name="whichEditApplicationLabel" />
  <java-symbol type="string" name="whichSendApplication" />
  <java-symbol type="string" name="whichSendApplicationNamed" />
  <java-symbol type="string" name="whichSendApplicationLabel" />
  <java-symbol type="string" name="whichSendToApplication" />
  <java-symbol type="string" name="whichSendToApplicationNamed" />
  <java-symbol type="string" name="whichSendToApplicationLabel" />
  <java-symbol type="string" name="whichImageCaptureApplication" />
  <java-symbol type="string" name="whichImageCaptureApplicationNamed" />
  <java-symbol type="string" name="whichImageCaptureApplicationLabel" />
  <java-symbol type="attr" name="lightY" />
  <java-symbol type="attr" name="lightZ" />
  <java-symbol type="attr" name="lightRadius" />
@@ -2235,6 +2243,7 @@
  <java-symbol type="array" name="networks_not_clear_data" />
  <java-symbol type="bool" name="config_switch_phone_on_voice_reg_state_change" />
  <java-symbol type="string" name="whichHomeApplicationNamed" />
  <java-symbol type="string" name="whichHomeApplicationLabel" />
  <java-symbol type="bool" name="config_sms_force_7bit_encoding" />
  <java-symbol type="bool" name="config_defaultWindowFeatureOptionsPanel" />
  <java-symbol type="bool" name="config_defaultWindowFeatureContextMenu" />
+1 −0
Original line number Diff line number Diff line
@@ -4928,6 +4928,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                }
                ri = new ResolveInfo(mResolveInfo);
                ri.activityInfo = new ActivityInfo(ri.activityInfo);
                ri.activityInfo.labelRes = ResolverActivity.getLabelRes(intent.getAction());
                ri.activityInfo.applicationInfo = new ApplicationInfo(
                        ri.activityInfo.applicationInfo);
                if (userId != 0) {