Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67fb5728 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 9147 into donut

* changes:
  Fix in-app search shortcut icons
parents 4598d149 83dba19a
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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)
+8 −0
Original line number Diff line number Diff line
@@ -102,6 +102,14 @@ public final class SearchableInfo implements Parcelable {
        return mSuggestAuthority;
    }

    /**
     * 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.
     */