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

Commit 822b72ef authored by Jesse Wilson's avatar Jesse Wilson Committed by Android (Google) Code Review
Browse files

Merge "Rename Uri.normalize() to Uri.normalizeScheme()." into jb-dev

parents a1dc761c abc43ddd
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -12487,7 +12487,7 @@ package android.net {
    method public abstract boolean isHierarchical();
    method public abstract boolean isHierarchical();
    method public boolean isOpaque();
    method public boolean isOpaque();
    method public abstract boolean isRelative();
    method public abstract boolean isRelative();
    method public android.net.Uri normalize();
    method public android.net.Uri normalizeScheme();
    method public static android.net.Uri parse(java.lang.String);
    method public static android.net.Uri parse(java.lang.String);
    method public abstract java.lang.String toString();
    method public abstract java.lang.String toString();
    method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String);
    method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String);
+9 −9
Original line number Original line Diff line number Diff line
@@ -4573,7 +4573,7 @@ public class Intent implements Parcelable, Cloneable {
     * <p><em>Note: scheme matching in the Android framework is
     * <p><em>Note: scheme matching in the Android framework is
     * case-sensitive, unlike the formal RFC. As a result,
     * case-sensitive, unlike the formal RFC. As a result,
     * you should always write your Uri with a lower case scheme,
     * you should always write your Uri with a lower case scheme,
     * or use {@link Uri#normalize} or
     * or use {@link Uri#normalizeScheme} or
     * {@link #setDataAndNormalize}
     * {@link #setDataAndNormalize}
     * to ensure that the scheme is converted to lower case.</em>
     * to ensure that the scheme is converted to lower case.</em>
     *
     *
@@ -4599,7 +4599,7 @@ public class Intent implements Parcelable, Cloneable {
     * previously set (for example, by {@link #setType}).
     * previously set (for example, by {@link #setType}).
     *
     *
     * <p>The data Uri is normalized using
     * <p>The data Uri is normalized using
     * {@link android.net.Uri#normalize} before it is set,
     * {@link android.net.Uri#normalizeScheme} before it is set,
     * so really this is just a convenience method for
     * so really this is just a convenience method for
     * <pre>
     * <pre>
     * setData(data.normalize())
     * setData(data.normalize())
@@ -4612,10 +4612,10 @@ public class Intent implements Parcelable, Cloneable {
     *
     *
     * @see #getData
     * @see #getData
     * @see #setType
     * @see #setType
     * @see android.net.Uri#normalize
     * @see android.net.Uri#normalizeScheme
     */
     */
    public Intent setDataAndNormalize(Uri data) {
    public Intent setDataAndNormalize(Uri data) {
        return setData(data.normalize());
        return setData(data.normalizeScheme());
    }
    }


    /**
    /**
@@ -4687,7 +4687,7 @@ public class Intent implements Parcelable, Cloneable {
     * <p><em>Note: MIME type and Uri scheme matching in the
     * <p><em>Note: MIME type and Uri scheme matching in the
     * Android framework is case-sensitive, unlike the formal RFC definitions.
     * Android framework is case-sensitive, unlike the formal RFC definitions.
     * As a result, you should always write these elements with lower case letters,
     * As a result, you should always write these elements with lower case letters,
     * or use {@link #normalizeMimeType} or {@link android.net.Uri#normalize} or
     * or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or
     * {@link #setDataAndTypeAndNormalize}
     * {@link #setDataAndTypeAndNormalize}
     * to ensure that they are converted to lower case.</em>
     * to ensure that they are converted to lower case.</em>
     *
     *
@@ -4700,7 +4700,7 @@ public class Intent implements Parcelable, Cloneable {
     * @see #setType
     * @see #setType
     * @see #setData
     * @see #setData
     * @see #normalizeMimeType
     * @see #normalizeMimeType
     * @see android.net.Uri#normalize
     * @see android.net.Uri#normalizeScheme
     * @see #setDataAndTypeAndNormalize
     * @see #setDataAndTypeAndNormalize
     */
     */
    public Intent setDataAndType(Uri data, String type) {
    public Intent setDataAndType(Uri data, String type) {
@@ -4716,7 +4716,7 @@ public class Intent implements Parcelable, Cloneable {
     * data with your own type given here.
     * data with your own type given here.
     *
     *
     * <p>The data Uri and the MIME type are normalize using
     * <p>The data Uri and the MIME type are normalize using
     * {@link android.net.Uri#normalize} and {@link #normalizeMimeType}
     * {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType}
     * before they are set, so really this is just a convenience method for
     * before they are set, so really this is just a convenience method for
     * <pre>
     * <pre>
     * setDataAndType(data.normalize(), Intent.normalizeMimeType(type))
     * setDataAndType(data.normalize(), Intent.normalizeMimeType(type))
@@ -4732,10 +4732,10 @@ public class Intent implements Parcelable, Cloneable {
     * @see #setData
     * @see #setData
     * @see #setDataAndType
     * @see #setDataAndType
     * @see #normalizeMimeType
     * @see #normalizeMimeType
     * @see android.net.Uri#normalize
     * @see android.net.Uri#normalizeScheme
     */
     */
    public Intent setDataAndTypeAndNormalize(Uri data, String type) {
    public Intent setDataAndTypeAndNormalize(Uri data, String type) {
        return setDataAndType(data.normalize(), normalizeMimeType(type));
        return setDataAndType(data.normalizeScheme(), normalizeMimeType(type));
    }
    }


    /**
    /**
+2 −4
Original line number Original line Diff line number Diff line
@@ -1718,9 +1718,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
    }
    }


    /**
    /**
     * Return a normalized representation of this Uri.
     * Return an equivalent URI with a lowercase scheme component.
     *
     * <p>A normalized Uri has a lowercase scheme component.
     * This aligns the Uri with Android best practices for
     * This aligns the Uri with Android best practices for
     * intent filtering.
     * intent filtering.
     *
     *
@@ -1740,7 +1738,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
     * @see {@link android.content.Intent#setData}
     * @see {@link android.content.Intent#setData}
     * @see {@link #setNormalizedData}
     * @see {@link #setNormalizedData}
     */
     */
    public Uri normalize() {
    public Uri normalizeScheme() {
        String scheme = getScheme();
        String scheme = getScheme();
        if (scheme == null) return this;  // give up
        if (scheme == null) return this;  // give up
        String lowerScheme = scheme.toLowerCase(Locale.US);
        String lowerScheme = scheme.toLowerCase(Locale.US);
+6 −6
Original line number Original line Diff line number Diff line
@@ -321,7 +321,7 @@ public final class NdefRecord implements Parcelable {
     * and {@link #RTD_URI}. This is the most efficient encoding
     * and {@link #RTD_URI}. This is the most efficient encoding
     * of a URI into NDEF.<p>
     * of a URI into NDEF.<p>
     * The uri parameter will be normalized with
     * The uri parameter will be normalized with
     * {@link Uri#normalize} to set the scheme to lower case to
     * {@link Uri#normalizeScheme} to set the scheme to lower case to
     * follow Android best practices for intent filtering.
     * follow Android best practices for intent filtering.
     * However the unchecked exception
     * However the unchecked exception
     * {@link IllegalArgumentException} may be thrown if the uri
     * {@link IllegalArgumentException} may be thrown if the uri
@@ -338,7 +338,7 @@ public final class NdefRecord implements Parcelable {
    public static NdefRecord createUri(Uri uri) {
    public static NdefRecord createUri(Uri uri) {
        if (uri == null) throw new NullPointerException("uri is null");
        if (uri == null) throw new NullPointerException("uri is null");


        uri = uri.normalize();
        uri = uri.normalizeScheme();
        String uriString = uri.toString();
        String uriString = uri.toString();
        if (uriString.length() == 0) throw new IllegalArgumentException("uri is empty");
        if (uriString.length() == 0) throw new IllegalArgumentException("uri is empty");


@@ -364,7 +364,7 @@ public final class NdefRecord implements Parcelable {
     * and {@link #RTD_URI}. This is the most efficient encoding
     * and {@link #RTD_URI}. This is the most efficient encoding
     * of a URI into NDEF.<p>
     * of a URI into NDEF.<p>
      * The uriString parameter will be normalized with
      * The uriString parameter will be normalized with
     * {@link Uri#normalize} to set the scheme to lower case to
     * {@link Uri#normalizeScheme} to set the scheme to lower case to
     * follow Android best practices for intent filtering.
     * follow Android best practices for intent filtering.
     * However the unchecked exception
     * However the unchecked exception
     * {@link IllegalArgumentException} may be thrown if the uriString
     * {@link IllegalArgumentException} may be thrown if the uriString
@@ -665,7 +665,7 @@ public final class NdefRecord implements Parcelable {
     * actually valid: it always attempts to create and return a URI if
     * actually valid: it always attempts to create and return a URI if
     * this record appears to be a URI record by the above rules.<p>
     * this record appears to be a URI record by the above rules.<p>
     * The returned URI will be normalized to have a lower case scheme
     * The returned URI will be normalized to have a lower case scheme
     * using {@link Uri#normalize}.<p>
     * using {@link Uri#normalizeScheme}.<p>
     *
     *
     * @return URI, or null if this is not a URI record
     * @return URI, or null if this is not a URI record
     */
     */
@@ -688,13 +688,13 @@ public final class NdefRecord implements Parcelable {
                        }
                        }
                    } catch (FormatException e) {  }
                    } catch (FormatException e) {  }
                } else if (Arrays.equals(mType, RTD_URI)) {
                } else if (Arrays.equals(mType, RTD_URI)) {
                    return parseWktUri().normalize();
                    return parseWktUri().normalizeScheme();
                }
                }
                break;
                break;


            case TNF_ABSOLUTE_URI:
            case TNF_ABSOLUTE_URI:
                Uri uri = Uri.parse(new String(mType, Charsets.UTF_8));
                Uri uri = Uri.parse(new String(mType, Charsets.UTF_8));
                return uri.normalize();
                return uri.normalizeScheme();


            case TNF_EXTERNAL_TYPE:
            case TNF_EXTERNAL_TYPE:
                if (inSmartPoster) {
                if (inSmartPoster) {