OSDN Git Service

Adjust Uri host parsing to use last instead of first @.
[android-x86/frameworks-base.git] / core / java / android / net / Uri.java
index 4a8dfbc..a84f74a 100644 (file)
@@ -1065,7 +1065,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                 return null;
             }
 
-            int end = authority.indexOf('@');
+            int end = authority.lastIndexOf('@');
             return end == NOT_FOUND ? null : authority.substring(0, end);
         }
 
@@ -1089,7 +1089,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
             }
 
             // Parse out user info and then port.
-            int userInfoSeparator = authority.indexOf('@');
+            int userInfoSeparator = authority.lastIndexOf('@');
             int portSeparator = authority.indexOf(':', userInfoSeparator);
 
             String encodedHost = portSeparator == NOT_FOUND
@@ -1115,7 +1115,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
 
             // Make sure we look for the port separtor *after* the user info
             // separator. We have URLs with a ':' in the user info.
-            int userInfoSeparator = authority.indexOf('@');
+            int userInfoSeparator = authority.lastIndexOf('@');
             int portSeparator = authority.indexOf(':', userInfoSeparator);
 
             if (portSeparator == NOT_FOUND) {
@@ -1746,8 +1746,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
      * begin with and a scheme component cannot be found.
      *
      * @return normalized Uri (never null)
-     * @see {@link android.content.Intent#setData}
-     * @see {@link android.content.Intent#setDataAndNormalize}
+     * @see android.content.Intent#setData
+     * @see android.content.Intent#setDataAndNormalize
      */
     public Uri normalizeScheme() {
         String scheme = getScheme();
@@ -2342,8 +2342,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
      * @hide
      */
     public void checkFileUriExposed(String location) {
-        if ("file".equals(getScheme())) {
-            StrictMode.onFileUriExposed(location);
+        if ("file".equals(getScheme()) && !getPath().startsWith("/system/")) {
+            StrictMode.onFileUriExposed(this, location);
         }
     }