diff options
author | Bjorn Bringert <bringert@android.com> | 2009-07-30 13:58:23 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-07-30 13:58:23 +0100 |
commit | 83dba19a8e9d5be6f18a4c9e2e254386c25c66fe (patch) | |
tree | effab7af5428703232d410038823cc92ed817dbc /core | |
parent | 73139aead7203c22f3a4abb5e9fd8abd5ef249b1 (diff) | |
download | frameworks_base-83dba19a8e9d5be6f18a4c9e2e254386c25c66fe.zip frameworks_base-83dba19a8e9d5be6f18a4c9e2e254386c25c66fe.tar.gz frameworks_base-83dba19a8e9d5be6f18a4c9e2e254386c25c66fe.tar.bz2 |
Fix in-app search shortcut icons
When the suggstion provider is in a different package from the searchable
activity, the icons stored for shortcuts used the package of the
activity instead of the provider.
Fixes http://b/issue?id=2023993
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/SearchDialog.java | 9 | ||||
-rw-r--r-- | core/java/android/server/search/SearchableInfo.java | 8 |
2 files changed, 12 insertions, 5 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 4dd2433..ea3d762 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1238,11 +1238,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // ensure the icons will work for global search cv.put(SearchManager.SUGGEST_COLUMN_ICON_1, wrapIconForPackage( - source, + mSearchable.getSuggestPackage(), getColumnString(c, SearchManager.SUGGEST_COLUMN_ICON_1))); cv.put(SearchManager.SUGGEST_COLUMN_ICON_2, wrapIconForPackage( - source, + mSearchable.getSuggestPackage(), getColumnString(c, SearchManager.SUGGEST_COLUMN_ICON_2))); // the rest can be passed through directly @@ -1281,11 +1281,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS * Wraps an icon for a particular package. If the icon is a resource id, it is converted into * an android.resource:// URI. * - * @param source The source of the icon + * @param packageName The source of the icon * @param icon The icon retrieved from a suggestion column * @return An icon string appropriate for the package. */ - private String wrapIconForPackage(ComponentName source, String icon) { + private String wrapIconForPackage(String packageName, String icon) { if (icon == null || icon.length() == 0 || "0".equals(icon)) { // SearchManager specifies that null or zero can be returned to indicate // no icon. We also allow empty string. @@ -1293,7 +1293,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS } else if (!Character.isDigit(icon.charAt(0))){ return icon; } else { - String packageName = source.getPackageName(); return new Uri.Builder() .scheme(ContentResolver.SCHEME_ANDROID_RESOURCE) .authority(packageName) diff --git a/core/java/android/server/search/SearchableInfo.java b/core/java/android/server/search/SearchableInfo.java index 045b0c2..69ef98c 100644 --- a/core/java/android/server/search/SearchableInfo.java +++ b/core/java/android/server/search/SearchableInfo.java @@ -103,6 +103,14 @@ public final class SearchableInfo implements Parcelable { } /** + * Gets the name of the package where the suggestion provider lives, + * or {@code null}. + */ + public String getSuggestPackage() { + return mSuggestProviderPackage; + } + + /** * Gets the component name of the searchable activity. */ public ComponentName getSearchActivity() { |