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

Commit 2b9d7322 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by android-build-merger
Browse files

Merge "Add "identifier" concept to Intent." into qt-dev

am: 91ada88e

Change-Id: I5947a082ddda914d34b82a728715933c8eab20fd
parents efeff3ba 91ada88e
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -734,6 +734,7 @@ package android {
    field public static final int iconTintMode = 16844127; // 0x101055f
    field public static final int iconTintMode = 16844127; // 0x101055f
    field public static final int iconifiedByDefault = 16843514; // 0x10102fa
    field public static final int iconifiedByDefault = 16843514; // 0x10102fa
    field public static final int id = 16842960; // 0x10100d0
    field public static final int id = 16842960; // 0x10100d0
    field public static final int identifier = 16844204; // 0x10105ac
    field public static final int ignoreGravity = 16843263; // 0x10101ff
    field public static final int ignoreGravity = 16843263; // 0x10101ff
    field public static final int imageButtonStyle = 16842866; // 0x1010072
    field public static final int imageButtonStyle = 16842866; // 0x1010072
    field public static final int imageWellStyle = 16842867; // 0x1010073
    field public static final int imageWellStyle = 16842867; // 0x1010073
@@ -10085,6 +10086,7 @@ package android.content {
    method public int getFlags();
    method public int getFlags();
    method @Nullable public float[] getFloatArrayExtra(String);
    method @Nullable public float[] getFloatArrayExtra(String);
    method public float getFloatExtra(String, float);
    method public float getFloatExtra(String, float);
    method @Nullable public String getIdentifier();
    method @Nullable public int[] getIntArrayExtra(String);
    method @Nullable public int[] getIntArrayExtra(String);
    method public int getIntExtra(String, int);
    method public int getIntExtra(String, int);
    method @Nullable public java.util.ArrayList<java.lang.Integer> getIntegerArrayListExtra(String);
    method @Nullable public java.util.ArrayList<java.lang.Integer> getIntegerArrayListExtra(String);
@@ -10168,6 +10170,7 @@ package android.content {
    method @NonNull public android.content.Intent setDataAndTypeAndNormalize(@NonNull android.net.Uri, @Nullable String);
    method @NonNull public android.content.Intent setDataAndTypeAndNormalize(@NonNull android.net.Uri, @Nullable String);
    method public void setExtrasClassLoader(@Nullable ClassLoader);
    method public void setExtrasClassLoader(@Nullable ClassLoader);
    method @NonNull public android.content.Intent setFlags(int);
    method @NonNull public android.content.Intent setFlags(int);
    method @NonNull public android.content.Intent setIdentifier(@Nullable String);
    method @NonNull public android.content.Intent setPackage(@Nullable String);
    method @NonNull public android.content.Intent setPackage(@Nullable String);
    method public void setSelector(@Nullable android.content.Intent);
    method public void setSelector(@Nullable android.content.Intent);
    method public void setSourceBounds(@Nullable android.graphics.Rect);
    method public void setSourceBounds(@Nullable android.graphics.Rect);
@@ -10428,6 +10431,7 @@ package android.content {
    field public static final int FILL_IN_CLIP_DATA = 128; // 0x80
    field public static final int FILL_IN_CLIP_DATA = 128; // 0x80
    field public static final int FILL_IN_COMPONENT = 8; // 0x8
    field public static final int FILL_IN_COMPONENT = 8; // 0x8
    field public static final int FILL_IN_DATA = 2; // 0x2
    field public static final int FILL_IN_DATA = 2; // 0x2
    field public static final int FILL_IN_IDENTIFIER = 256; // 0x100
    field public static final int FILL_IN_PACKAGE = 16; // 0x10
    field public static final int FILL_IN_PACKAGE = 16; // 0x10
    field public static final int FILL_IN_SELECTOR = 64; // 0x40
    field public static final int FILL_IN_SELECTOR = 64; // 0x40
    field public static final int FILL_IN_SOURCE_BOUNDS = 32; // 0x20
    field public static final int FILL_IN_SOURCE_BOUNDS = 32; // 0x20
+90 −5
Original line number Original line Diff line number Diff line
@@ -643,6 +643,7 @@ public class Intent implements Parcelable, Cloneable {
    private static final String ATTR_CATEGORY = "category";
    private static final String ATTR_CATEGORY = "category";
    private static final String TAG_EXTRA = "extra";
    private static final String TAG_EXTRA = "extra";
    private static final String ATTR_TYPE = "type";
    private static final String ATTR_TYPE = "type";
    private static final String ATTR_IDENTIFIER = "ident";
    private static final String ATTR_COMPONENT = "component";
    private static final String ATTR_COMPONENT = "component";
    private static final String ATTR_DATA = "data";
    private static final String ATTR_DATA = "data";
    private static final String ATTR_FLAGS = "flags";
    private static final String ATTR_FLAGS = "flags";
@@ -6314,6 +6315,7 @@ public class Intent implements Parcelable, Cloneable {
    private String mAction;
    private String mAction;
    private Uri mData;
    private Uri mData;
    private String mType;
    private String mType;
    private String mIdentifier;
    private String mPackage;
    private String mPackage;
    private ComponentName mComponent;
    private ComponentName mComponent;
    private int mFlags;
    private int mFlags;
@@ -6359,6 +6361,7 @@ public class Intent implements Parcelable, Cloneable {
        this.mAction = o.mAction;
        this.mAction = o.mAction;
        this.mData = o.mData;
        this.mData = o.mData;
        this.mType = o.mType;
        this.mType = o.mType;
        this.mIdentifier = o.mIdentifier;
        this.mPackage = o.mPackage;
        this.mPackage = o.mPackage;
        this.mComponent = o.mComponent;
        this.mComponent = o.mComponent;


@@ -6678,6 +6681,11 @@ public class Intent implements Parcelable, Cloneable {
                    intent.mType = value;
                    intent.mType = value;
                }
                }


                // identifier
                else if (uri.startsWith("identifier=", i)) {
                    intent.mIdentifier = value;
                }

                // launch flags
                // launch flags
                else if (uri.startsWith("launchFlags=", i)) {
                else if (uri.startsWith("launchFlags=", i)) {
                    intent.mFlags = Integer.decode(value).intValue();
                    intent.mFlags = Integer.decode(value).intValue();
@@ -7017,6 +7025,12 @@ public class Intent implements Parcelable, Cloneable {
                        hasIntentInfo = true;
                        hasIntentInfo = true;
                    }
                    }
                    break;
                    break;
                case "-i":
                    intent.setIdentifier(cmd.getNextArgRequired());
                    if (intent == baseIntent) {
                        hasIntentInfo = true;
                    }
                    break;
                case "-c":
                case "-c":
                    intent.addCategory(cmd.getNextArgRequired());
                    intent.addCategory(cmd.getNextArgRequired());
                    if (intent == baseIntent) {
                    if (intent == baseIntent) {
@@ -7375,7 +7389,7 @@ public class Intent implements Parcelable, Cloneable {
    public static void printIntentArgsHelp(PrintWriter pw, String prefix) {
    public static void printIntentArgsHelp(PrintWriter pw, String prefix) {
        final String[] lines = new String[] {
        final String[] lines = new String[] {
                "<INTENT> specifications include these flags and arguments:",
                "<INTENT> specifications include these flags and arguments:",
                "    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]",
                "    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>] [-i <IDENTIFIER>]",
                "    [-c <CATEGORY> [-c <CATEGORY>] ...]",
                "    [-c <CATEGORY> [-c <CATEGORY>] ...]",
                "    [-n <COMPONENT_NAME>]",
                "    [-n <COMPONENT_NAME>]",
                "    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]",
                "    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]",
@@ -7556,6 +7570,18 @@ public class Intent implements Parcelable, Cloneable {
        return resolveType(resolver);
        return resolveType(resolver);
    }
    }


    /**
     * Retrieve the identifier for this Intent.  If non-null, this is an arbitrary identity
     * of the Intent to distinguish it from other Intents.
     *
     * @return The identifier of this intent or null if none is specified.
     *
     * @see #setIdentifier
     */
    public @Nullable String getIdentifier() {
        return mIdentifier;
    }

    /**
    /**
     * Check if a category exists in the intent.
     * Check if a category exists in the intent.
     *
     *
@@ -8575,6 +8601,28 @@ public class Intent implements Parcelable, Cloneable {
        return setDataAndType(data.normalizeScheme(), normalizeMimeType(type));
        return setDataAndType(data.normalizeScheme(), normalizeMimeType(type));
    }
    }


    /**
     * Set an identifier for this Intent.  If set, this provides a unique identity for this Intent,
     * allowing it to be unique from other Intents that would otherwise look the same.  In
     * particular, this will be used by {@link #filterEquals(Intent)} to determine if two
     * Intents are the same as with other fields like {@link #setAction}.  However, unlike those
     * fields, the identifier is <em>never</em> used for matching against an {@link IntentFilter};
     * it is as if the identifier has not been set on the Intent.
     *
     * @param identifier The identifier for this Intent.  The contents of the string have no
     *                   meaning to the system, except whether they are exactly the same as
     *                   another identifier.
     *
     * @return Returns the same Intent object, for chaining multiple calls
     * into a single statement.
     *
     * @see #getIdentifier
     */
    public @NonNull Intent setIdentifier(@Nullable String identifier) {
        mIdentifier = identifier;
        return this;
    }

    /**
    /**
     * Add a new category to the intent.  Categories provide additional detail
     * Add a new category to the intent.  Categories provide additional detail
     * about the action the intent performs.  When resolving an intent, only
     * about the action the intent performs.  When resolving an intent, only
@@ -9692,6 +9740,12 @@ public class Intent implements Parcelable, Cloneable {
     */
     */
    public static final int FILL_IN_CLIP_DATA = 1<<7;
    public static final int FILL_IN_CLIP_DATA = 1<<7;


    /**
     * Use with {@link #fillIn} to allow the current identifier value to be
     * overwritten, even if it is already set.
     */
    public static final int FILL_IN_IDENTIFIER = 1<<8;

    /**
    /**
     * Copy the contents of <var>other</var> in to this object, but only
     * Copy the contents of <var>other</var> in to this object, but only
     * where fields are not defined by this object.  For purposes of a field
     * where fields are not defined by this object.  For purposes of a field
@@ -9702,6 +9756,7 @@ public class Intent implements Parcelable, Cloneable {
     * <li> action, as set by {@link #setAction}.
     * <li> action, as set by {@link #setAction}.
     * <li> data Uri and MIME type, as set by {@link #setData(Uri)},
     * <li> data Uri and MIME type, as set by {@link #setData(Uri)},
     * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}.
     * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}.
     * <li> identifier, as set by {@link #setIdentifier}.
     * <li> categories, as set by {@link #addCategory}.
     * <li> categories, as set by {@link #addCategory}.
     * <li> package, as set by {@link #setPackage}.
     * <li> package, as set by {@link #setPackage}.
     * <li> component, as set by {@link #setComponent(ComponentName)} or
     * <li> component, as set by {@link #setComponent(ComponentName)} or
@@ -9713,8 +9768,8 @@ public class Intent implements Parcelable, Cloneable {
     * </ul>
     * </ul>
     *
     *
     * <p>In addition, you can use the {@link #FILL_IN_ACTION},
     * <p>In addition, you can use the {@link #FILL_IN_ACTION},
     * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
     * {@link #FILL_IN_DATA}, {@link #FILL_IN_IDENTIFIER}, {@link #FILL_IN_CATEGORIES},
     * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS},
     * {@link #FILL_IN_PACKAGE}, {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS},
     * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override
     * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override
     * the restriction where the corresponding field will not be replaced if
     * the restriction where the corresponding field will not be replaced if
     * it is already set.
     * it is already set.
@@ -9758,6 +9813,11 @@ public class Intent implements Parcelable, Cloneable {
            changes |= FILL_IN_DATA;
            changes |= FILL_IN_DATA;
            mayHaveCopiedUris = true;
            mayHaveCopiedUris = true;
        }
        }
        if (other.mIdentifier != null
                && (mIdentifier == null || (flags&FILL_IN_IDENTIFIER) != 0)) {
            mIdentifier = other.mIdentifier;
            changes |= FILL_IN_IDENTIFIER;
        }
        if (other.mCategories != null
        if (other.mCategories != null
                && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) {
                && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) {
            if (other.mCategories != null) {
            if (other.mCategories != null) {
@@ -9871,9 +9931,11 @@ public class Intent implements Parcelable, Cloneable {


    /**
    /**
     * Determine if two intents are the same for the purposes of intent
     * Determine if two intents are the same for the purposes of intent
     * resolution (filtering). That is, if their action, data, type,
     * resolution (filtering). That is, if their action, data, type, identity,
     * class, and categories are the same.  This does <em>not</em> compare
     * class, and categories are the same.  This does <em>not</em> compare
     * any extra data included in the intents.
     * any extra data included in the intents.  Note that technically when actually
     * matching against an {@link IntentFilter} the identifier is ignored, while here
     * it is directly compared for equality like the other fields.
     *
     *
     * @param other The other Intent to compare against.
     * @param other The other Intent to compare against.
     *
     *
@@ -9887,6 +9949,7 @@ public class Intent implements Parcelable, Cloneable {
        if (!Objects.equals(this.mAction, other.mAction)) return false;
        if (!Objects.equals(this.mAction, other.mAction)) return false;
        if (!Objects.equals(this.mData, other.mData)) return false;
        if (!Objects.equals(this.mData, other.mData)) return false;
        if (!Objects.equals(this.mType, other.mType)) return false;
        if (!Objects.equals(this.mType, other.mType)) return false;
        if (!Objects.equals(this.mIdentifier, other.mIdentifier)) return false;
        if (!Objects.equals(this.mPackage, other.mPackage)) return false;
        if (!Objects.equals(this.mPackage, other.mPackage)) return false;
        if (!Objects.equals(this.mComponent, other.mComponent)) return false;
        if (!Objects.equals(this.mComponent, other.mComponent)) return false;
        if (!Objects.equals(this.mCategories, other.mCategories)) return false;
        if (!Objects.equals(this.mCategories, other.mCategories)) return false;
@@ -9913,6 +9976,9 @@ public class Intent implements Parcelable, Cloneable {
        if (mType != null) {
        if (mType != null) {
            code += mType.hashCode();
            code += mType.hashCode();
        }
        }
        if (mIdentifier != null) {
            code += mIdentifier.hashCode();
        }
        if (mPackage != null) {
        if (mPackage != null) {
            code += mPackage.hashCode();
            code += mPackage.hashCode();
        }
        }
@@ -10005,6 +10071,13 @@ public class Intent implements Parcelable, Cloneable {
            first = false;
            first = false;
            b.append("typ=").append(mType);
            b.append("typ=").append(mType);
        }
        }
        if (mIdentifier != null) {
            if (!first) {
                b.append(' ');
            }
            first = false;
            b.append("id=").append(mIdentifier);
        }
        if (mFlags != 0) {
        if (mFlags != 0) {
            if (!first) {
            if (!first) {
                b.append(' ');
                b.append(' ');
@@ -10276,6 +10349,9 @@ public class Intent implements Parcelable, Cloneable {
        if (mType != null) {
        if (mType != null) {
            uri.append("type=").append(Uri.encode(mType, "/")).append(';');
            uri.append("type=").append(Uri.encode(mType, "/")).append(';');
        }
        }
        if (mIdentifier != null) {
            uri.append("identifier=").append(Uri.encode(mIdentifier, "/")).append(';');
        }
        if (mFlags != 0) {
        if (mFlags != 0) {
            uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';');
            uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';');
        }
        }
@@ -10326,6 +10402,7 @@ public class Intent implements Parcelable, Cloneable {
        out.writeString(mAction);
        out.writeString(mAction);
        Uri.writeToParcel(out, mData);
        Uri.writeToParcel(out, mData);
        out.writeString(mType);
        out.writeString(mType);
        out.writeString(mIdentifier);
        out.writeInt(mFlags);
        out.writeInt(mFlags);
        out.writeString(mPackage);
        out.writeString(mPackage);
        ComponentName.writeToParcel(mComponent, out);
        ComponentName.writeToParcel(mComponent, out);
@@ -10383,6 +10460,7 @@ public class Intent implements Parcelable, Cloneable {
        setAction(in.readString());
        setAction(in.readString());
        mData = Uri.CREATOR.createFromParcel(in);
        mData = Uri.CREATOR.createFromParcel(in);
        mType = in.readString();
        mType = in.readString();
        mIdentifier = in.readString();
        mFlags = in.readInt();
        mFlags = in.readInt();
        mPackage = in.readString();
        mPackage = in.readString();
        mComponent = ComponentName.readFromParcel(in);
        mComponent = ComponentName.readFromParcel(in);
@@ -10445,6 +10523,8 @@ public class Intent implements Parcelable, Cloneable {
        String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType);
        String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType);
        intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType);
        intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType);


        intent.setIdentifier(sa.getString(com.android.internal.R.styleable.Intent_identifier));

        String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage);
        String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage);
        String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass);
        String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass);
        if (packageName != null && className != null) {
        if (packageName != null && className != null) {
@@ -10499,6 +10579,9 @@ public class Intent implements Parcelable, Cloneable {
        if (mType != null) {
        if (mType != null) {
            out.attribute(null, ATTR_TYPE, mType);
            out.attribute(null, ATTR_TYPE, mType);
        }
        }
        if (mIdentifier != null) {
            out.attribute(null, ATTR_IDENTIFIER, mIdentifier);
        }
        if (mComponent != null) {
        if (mComponent != null) {
            out.attribute(null, ATTR_COMPONENT, mComponent.flattenToShortString());
            out.attribute(null, ATTR_COMPONENT, mComponent.flattenToShortString());
        }
        }
@@ -10529,6 +10612,8 @@ public class Intent implements Parcelable, Cloneable {
                intent.setData(Uri.parse(attrValue));
                intent.setData(Uri.parse(attrValue));
            } else if (ATTR_TYPE.equals(attrName)) {
            } else if (ATTR_TYPE.equals(attrName)) {
                intent.setType(attrValue);
                intent.setType(attrValue);
            } else if (ATTR_IDENTIFIER.equals(attrName)) {
                intent.setIdentifier(attrValue);
            } else if (ATTR_COMPONENT.equals(attrName)) {
            } else if (ATTR_COMPONENT.equals(attrName)) {
                intent.setComponent(ComponentName.unflattenFromString(attrValue));
                intent.setComponent(ComponentName.unflattenFromString(attrValue));
            } else if (ATTR_FLAGS.equals(attrName)) {
            } else if (ATTR_FLAGS.equals(attrName)) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -2814,6 +2814,9 @@
            case-sensitive, unlike formal RFC MIME types.  As a result,
            case-sensitive, unlike formal RFC MIME types.  As a result,
            MIME types here should always use lower case letters.</em></p> -->
            MIME types here should always use lower case letters.</em></p> -->
        <attr name="mimeType" />
        <attr name="mimeType" />
        <!-- The identifier to assign to the intent, as per
            {@link android.content.Intent#setIdentifier Intent.setIdentifier()}. -->
        <attr name="identifier" format="string" />
        <!-- The package part of the ComponentName to assign to the Intent, as per
        <!-- The package part of the ComponentName to assign to the Intent, as per
            {@link android.content.Intent#setComponent Intent.setComponent()}. -->
            {@link android.content.Intent#setComponent Intent.setComponent()}. -->
        <attr name="targetPackage" />
        <attr name="targetPackage" />
+1 −0
Original line number Original line Diff line number Diff line
@@ -2945,6 +2945,7 @@
        <public name="allowExternalStorageSandbox"/>
        <public name="allowExternalStorageSandbox"/>
        <public name="ensuringStatusBarContrastWhenTransparent" />
        <public name="ensuringStatusBarContrastWhenTransparent" />
        <public name="ensuringNavigationBarContrastWhenTransparent" />
        <public name="ensuringNavigationBarContrastWhenTransparent" />
        <public name="identifier" />
    </public-group>
    </public-group>


    <public-group type="drawable" first-id="0x010800b4">
    <public-group type="drawable" first-id="0x010800b4">