diff options
| author | John Reck <jreck@google.com> | 2011-06-29 11:31:24 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2011-06-29 13:28:03 -0700 |
| commit | db22ec4ee014900988062d910bc810172a07df56 (patch) | |
| tree | 317dd31937a995619e36882d3b2571adf55a7916 /src/com/android/browser/BookmarkUtils.java | |
| parent | 749b93662b6c3152899d91dbd80139224dc46961 (diff) | |
| download | packages_apps_Browser-db22ec4ee014900988062d910bc810172a07df56.tar.gz packages_apps_Browser-db22ec4ee014900988062d910bc810172a07df56.tar.bz2 packages_apps_Browser-db22ec4ee014900988062d910bc810172a07df56.zip | |
Fix IntentHandler behavior
Bug: 4473779
Plus, TESTS! Huzzah!
Change-Id: I043e100d99d4653b7fb7885217d7fb305930a137
Diffstat (limited to 'src/com/android/browser/BookmarkUtils.java')
| -rw-r--r-- | src/com/android/browser/BookmarkUtils.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/browser/BookmarkUtils.java b/src/com/android/browser/BookmarkUtils.java index 491c16c17..23765f4d3 100644 --- a/src/com/android/browser/BookmarkUtils.java +++ b/src/com/android/browser/BookmarkUtils.java @@ -115,10 +115,7 @@ public class BookmarkUtils { static Intent createAddToHomeIntent(Context context, String url, String title, Bitmap touchIcon, Bitmap favicon) { Intent i = new Intent(INSTALL_SHORTCUT); - Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - long urlHash = url.hashCode(); - long uniqueId = (urlHash << 32) | shortcutIntent.hashCode(); - shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId)); + Intent shortcutIntent = createShortcutIntent(url); i.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); i.putExtra(Intent.EXTRA_SHORTCUT_NAME, title); i.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(context, touchIcon, favicon, @@ -129,6 +126,14 @@ public class BookmarkUtils { return i; } + static Intent createShortcutIntent(String url) { + Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + long urlHash = url.hashCode(); + long uniqueId = (urlHash << 32) | shortcutIntent.hashCode(); + shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId)); + return shortcutIntent; + } + private static Bitmap getIconBackground(Context context, BookmarkIconType type, int density) { if (type == BookmarkIconType.ICON_HOME_SHORTCUT) { // Want to create a shortcut icon on the homescreen, so the icon |
