diff options
| author | 2009-09-20 18:06:23 -0400 | |
|---|---|---|
| committer | 2009-09-20 18:06:23 -0400 | |
| commit | 238dc72f742efd8b9d87dc66c38c304cd6e0399c (patch) | |
| tree | 08b59ec919fc8b7b4ff4a584176c7feeb0bcf7e1 | |
| parent | f1871e273e1bf49d72a7f2ef51a4ef377d8f3112 (diff) | |
| parent | 6cca1599f78549716ef120245e54fa1961976dda (diff) | |
Merge change 26004 into eclair
* changes:
Fix issue #1862317: Browser does not appear to honor anchors (#es) in links
| -rw-r--r-- | core/java/android/content/Intent.java | 21 | ||||
| -rw-r--r-- | libs/utils/ResourceTypes.cpp | 12 |
2 files changed, 26 insertions, 7 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index c1b9f28d3b8e..7366b8bff41c 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2531,6 +2531,7 @@ public class Intent implements Parcelable { * * @param uri The URI to turn into an Intent. * @param flags Additional processing flags. Either 0 or + * {@link #URI_INTENT_SCHEME}. * * @return Intent The newly created Intent object. * @@ -2664,24 +2665,24 @@ public class Intent implements Parcelable { int i = uri.lastIndexOf('#'); if (i >= 0) { - Uri data = null; String action = null; - if (i > 0) { - data = Uri.parse(uri.substring(0, i)); - } + final int intentFragmentStart = i; + boolean isIntentFragment = false; i++; if (uri.regionMatches(i, "action(", 0, 7)) { + isIntentFragment = true; i += 7; int j = uri.indexOf(')', i); action = uri.substring(i, j); i = j + 1; } - intent = new Intent(action, data); + intent = new Intent(action); if (uri.regionMatches(i, "categories(", 0, 11)) { + isIntentFragment = true; i += 11; int j = uri.indexOf(')', i); while (i < j) { @@ -2696,6 +2697,7 @@ public class Intent implements Parcelable { } if (uri.regionMatches(i, "type(", 0, 5)) { + isIntentFragment = true; i += 5; int j = uri.indexOf(')', i); intent.mType = uri.substring(i, j); @@ -2703,6 +2705,7 @@ public class Intent implements Parcelable { } if (uri.regionMatches(i, "launchFlags(", 0, 12)) { + isIntentFragment = true; i += 12; int j = uri.indexOf(')', i); intent.mFlags = Integer.decode(uri.substring(i, j)).intValue(); @@ -2710,6 +2713,7 @@ public class Intent implements Parcelable { } if (uri.regionMatches(i, "component(", 0, 10)) { + isIntentFragment = true; i += 10; int j = uri.indexOf(')', i); int sep = uri.indexOf('!', i); @@ -2722,6 +2726,7 @@ public class Intent implements Parcelable { } if (uri.regionMatches(i, "extras(", 0, 7)) { + isIntentFragment = true; i += 7; final int closeParen = uri.indexOf(')', i); @@ -2793,6 +2798,12 @@ public class Intent implements Parcelable { } } + if (isIntentFragment) { + intent.mData = Uri.parse(uri.substring(0, intentFragmentStart)); + } else { + intent.mData = Uri.parse(uri); + } + if (intent.mAction == null) { // By default, if no action is specified, then use VIEW. intent.mAction = ACTION_VIEW; diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index f80843d8dc9e..a5a8cc953e61 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -1740,7 +1740,11 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const const int e = Res_GETENTRY(resID); if (p < 0) { - LOGW("No package identifier when getting name for resource number 0x%08x", resID); + if (Res_GETPACKAGE(resID)+1 == 0) { + LOGW("No package identifier when getting name for resource number 0x%08x", resID); + } else { + LOGW("Resources don't contain pacakge for resource number 0x%08x", resID); + } return false; } if (t < 0) { @@ -1786,7 +1790,11 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag const int e = Res_GETENTRY(resID); if (p < 0) { - LOGW("No package identifier when getting value for resource number 0x%08x", resID); + if (Res_GETPACKAGE(resID)+1 == 0) { + LOGW("No package identifier when getting name for resource number 0x%08x", resID); + } else { + LOGW("Resources don't contain pacakge for resource number 0x%08x", resID); + } return BAD_INDEX; } if (t < 0) { |