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

Commit 23897c16 authored by Bjorn Bringert's avatar Bjorn Bringert
Browse files

Use resource ID for searchable description

Before, SearchableInfo read and cached the localized
searchable description, which meant that it was not updated
on locale changes. Now SearchableInfo only holds the resource
ID.

SearchableInfo is a new API in Froyo, so it's ok to change.

Part of http://b/issue?id=2175247

Change-Id: I1898f7895b9172f58419d906ad741cb7dd1e7252
parent f67119bc
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -25322,8 +25322,8 @@
 visibility="public"
 visibility="public"
>
>
</method>
</method>
<method name="getSettingsDescription"
<method name="getSettingsDescriptionId"
 return="java.lang.String"
 return="int"
 abstract="false"
 abstract="false"
 native="false"
 native="false"
 synchronized="false"
 synchronized="false"
+10 −10
Original line number Original line Diff line number Diff line
@@ -73,7 +73,7 @@ public final class SearchableInfo implements Parcelable {
    private final boolean mIncludeInGlobalSearch;
    private final boolean mIncludeInGlobalSearch;
    private final boolean mQueryAfterZeroResults;
    private final boolean mQueryAfterZeroResults;
    private final boolean mAutoUrlDetect;
    private final boolean mAutoUrlDetect;
    private final String mSettingsDescription;
    private final int mSettingsDescriptionId;
    private final String mSuggestAuthority;
    private final String mSuggestAuthority;
    private final String mSuggestPath;
    private final String mSuggestPath;
    private final String mSuggestSelection;
    private final String mSuggestSelection;
@@ -155,11 +155,11 @@ public final class SearchableInfo implements Parcelable {
    }
    }
    
    
    /**
    /**
     * Gets the description to use for this source in system search settings, or null if
     * Gets the resource ID of the description string to use for this source in system search
     * none has been specified.
     * settings, or {@code 0} if none has been specified.
     */
     */
    public String getSettingsDescription() {
    public int getSettingsDescriptionId() {
        return mSettingsDescription;
        return mSettingsDescriptionId;
    }
    }


    /**
    /**
@@ -311,8 +311,8 @@ public final class SearchableInfo implements Parcelable {
        mAutoUrlDetect = a.getBoolean(
        mAutoUrlDetect = a.getBoolean(
                com.android.internal.R.styleable.Searchable_autoUrlDetect, false);
                com.android.internal.R.styleable.Searchable_autoUrlDetect, false);


        mSettingsDescription = a.getString(
        mSettingsDescriptionId = a.getResourceId(
                com.android.internal.R.styleable.Searchable_searchSettingsDescription);
                com.android.internal.R.styleable.Searchable_searchSettingsDescription, 0);
        mSuggestAuthority = a.getString(
        mSuggestAuthority = a.getString(
                com.android.internal.R.styleable.Searchable_searchSuggestAuthority);
                com.android.internal.R.styleable.Searchable_searchSuggestAuthority);
        mSuggestPath = a.getString(
        mSuggestPath = a.getString(
@@ -495,7 +495,7 @@ public final class SearchableInfo implements Parcelable {
                        + ",suggestAuthority=" + searchable.getSuggestAuthority()
                        + ",suggestAuthority=" + searchable.getSuggestAuthority()
                        + ",target=" + searchable.getSearchActivity().getClassName()
                        + ",target=" + searchable.getSearchActivity().getClassName()
                        + ",global=" + searchable.shouldIncludeInGlobalSearch()
                        + ",global=" + searchable.shouldIncludeInGlobalSearch()
                        + ",settingsDescription=" + searchable.getSettingsDescription()
                        + ",settingsDescription=" + searchable.getSettingsDescriptionId()
                        + ",threshold=" + searchable.getSuggestThreshold());
                        + ",threshold=" + searchable.getSuggestThreshold());
            } else {
            } else {
                Log.d(LOG_TAG, "Checked " + activityInfo.name + ", no searchable meta-data");
                Log.d(LOG_TAG, "Checked " + activityInfo.name + ", no searchable meta-data");
@@ -746,7 +746,7 @@ public final class SearchableInfo implements Parcelable {
        mQueryAfterZeroResults = in.readInt() != 0;
        mQueryAfterZeroResults = in.readInt() != 0;
        mAutoUrlDetect = in.readInt() != 0;
        mAutoUrlDetect = in.readInt() != 0;
        
        
        mSettingsDescription = in.readString();
        mSettingsDescriptionId = in.readInt();
        mSuggestAuthority = in.readString();
        mSuggestAuthority = in.readString();
        mSuggestPath = in.readString();
        mSuggestPath = in.readString();
        mSuggestSelection = in.readString();
        mSuggestSelection = in.readString();
@@ -784,7 +784,7 @@ public final class SearchableInfo implements Parcelable {
        dest.writeInt(mQueryAfterZeroResults ? 1 : 0);
        dest.writeInt(mQueryAfterZeroResults ? 1 : 0);
        dest.writeInt(mAutoUrlDetect ? 1 : 0);
        dest.writeInt(mAutoUrlDetect ? 1 : 0);
        
        
        dest.writeString(mSettingsDescription);
        dest.writeInt(mSettingsDescriptionId);
        dest.writeString(mSuggestAuthority);
        dest.writeString(mSuggestAuthority);
        dest.writeString(mSuggestPath);
        dest.writeString(mSuggestPath);
        dest.writeString(mSuggestSelection);
        dest.writeString(mSuggestSelection);