Fix problems with bookmarks
- Fixed incorrect detection of non-bookmarked pages showing
as bookmarked.
- Changed bookmarks to allow any scheme the engine can support
- Changed bookmarks to only look for page url not title
when looking up or adding bookmarks
- Bookmarks will now use new apis to "fix" urls. These are the
same api's the engine uses. This ensures that the bookmarks
db treats urls exactly like the rest of the browser
- Fixed crashes when launching bookmarks via an intent
with wrong parameters
Change-Id: I18d1f5b55c65e6fecf731128cef6d02222fd68a9
diff --git a/src/com/android/browser/UrlUtils.java b/src/com/android/browser/UrlUtils.java
index 4d3dee4..e110160 100755
--- a/src/com/android/browser/UrlUtils.java
+++ b/src/com/android/browser/UrlUtils.java
@@ -17,9 +17,12 @@
package com.android.browser;
import android.net.Uri;
+import android.text.TextUtils;
import android.util.Patterns;
import android.webkit.URLUtil;
+import org.codeaurora.swe.util.SWEUrlUtils;
+
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.HashSet;
@@ -30,6 +33,11 @@
* Utility methods for Url manipulation
*/
public class UrlUtils {
+ // Urls defined by the browser should not be "fixedup" via the engine
+ // Urls are only handled by the browser
+ private static final String BROWSER_URLS[] = {
+ "about:debug",
+ };
public static final String[] DOWNLOADABLE_SCHEMES_VALUES = new String[]
{ "data", "filesystem", "http", "https" };
@@ -171,6 +179,19 @@
return null;
}
+ public static String fixUpUrl(String url){
+ if (TextUtils.isEmpty(url))
+ return url;
+
+ for (String preDefined: BROWSER_URLS){
+ if (url.contains(preDefined)) {
+ return url;
+ }
+ }
+ return SWEUrlUtils.fixUpUrl(url);
+ }
+
+ @Deprecated // Use fixUpUrl instead
public static String fixUrl(String inUrl) {
// FIXME: Converting the url to lower case
// duplicates functionality in smartUrlFilter().