Loading core/java/android/app/ISearchManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ import android.server.search.SearchableInfo; /** @hide */ interface ISearchManager { SearchableInfo getSearchableInfo(in ComponentName launchActivity, boolean globalSearch); List<SearchableInfo> getSearchablesInGlobalSearch(); } core/java/android/app/SearchManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.os.ServiceManager; import android.server.search.SearchableInfo; import android.view.KeyEvent; import java.util.List; /** * This class provides access to the system search services. * Loading Loading @@ -1655,4 +1657,20 @@ public class SearchManager return context.getContentResolver().query(uri, null, selection, selArgs, null); } /** * Returns a list of the searchable activities that can be included in global search. * * @return a list containing searchable information for all searchable activities * that have the <code>exported</code> attribute set in their searchable * meta-data. * * @hide because SearchableInfo is not part of the API. */ public static List<SearchableInfo> getSearchablesInGlobalSearch() { try { return sService.getSearchablesInGlobalSearch(); } catch (RemoteException e) { return null; } } } core/java/android/server/search/SearchManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import java.util.List; /** * This is a simplified version of the Search Manager service. It no longer handles * presentation (UI). Its function is to maintain the map & list of "searchable" Loading Loading @@ -144,4 +146,11 @@ public class SearchManagerService extends ISearchManager.Stub return si; } /** * Returns a list of the searchable activities that can be included in global search. */ public List<SearchableInfo> getSearchablesInGlobalSearch() { return mSearchables.getSearchablesInGlobalSearchList(); } } core/java/android/server/search/SearchableInfo.java +15 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ public final class SearchableInfo implements Parcelable { private int mSearchButtonText = 0; private int mSearchInputType = 0; private int mSearchImeOptions = 0; private boolean mIncludeInGlobalSearch = false; private String mSuggestAuthority = null; private String mSuggestPath = null; private String mSuggestSelection = null; Loading Loading @@ -236,6 +237,8 @@ public final class SearchableInfo implements Parcelable { InputType.TYPE_TEXT_VARIATION_NORMAL); mSearchImeOptions = a.getInt(com.android.internal.R.styleable.Searchable_imeOptions, EditorInfo.IME_ACTION_SEARCH); mIncludeInGlobalSearch = a.getBoolean( com.android.internal.R.styleable.Searchable_includeInGlobalSearch, false); setSearchModeFlags(); if (DBG_INHIBIT_SUGGESTIONS == 0) { Loading Loading @@ -575,6 +578,16 @@ public final class SearchableInfo implements Parcelable { return mSearchImeOptions; } /** * Checks whether the searchable is exported. * * @return The value of the <code>exported</code> attribute, * or <code>false</code> if the attribute is not set. */ public boolean shouldIncludeInGlobalSearch() { return mIncludeInGlobalSearch; } /** * Support for parcelable and aidl operations. */ Loading Loading @@ -606,6 +619,7 @@ public final class SearchableInfo implements Parcelable { mSearchButtonText = in.readInt(); mSearchInputType = in.readInt(); mSearchImeOptions = in.readInt(); mIncludeInGlobalSearch = in.readInt() != 0; setSearchModeFlags(); mSuggestAuthority = in.readString(); Loading Loading @@ -644,6 +658,7 @@ public final class SearchableInfo implements Parcelable { dest.writeInt(mSearchButtonText); dest.writeInt(mSearchInputType); dest.writeInt(mSearchImeOptions); dest.writeInt(mIncludeInGlobalSearch ? 1 : 0); dest.writeString(mSuggestAuthority); dest.writeString(mSuggestPath); Loading core/java/android/server/search/Searchables.java +15 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class Searchables { private HashMap<ComponentName, SearchableInfo> mSearchablesMap = null; private ArrayList<SearchableInfo> mSearchablesList = null; private ArrayList<SearchableInfo> mSearchablesInGlobalSearchList = null; private SearchableInfo mDefaultSearchable = null; /** Loading Loading @@ -189,6 +190,8 @@ public class Searchables { = new HashMap<ComponentName, SearchableInfo>(); ArrayList<SearchableInfo> newSearchablesList = new ArrayList<SearchableInfo>(); ArrayList<SearchableInfo> newSearchablesInGlobalSearchList = new ArrayList<SearchableInfo>(); final PackageManager pm = mContext.getPackageManager(); Loading @@ -208,6 +211,9 @@ public class Searchables { if (searchable != null) { newSearchablesList.add(searchable); newSearchablesMap.put(searchable.mSearchActivity, searchable); if (searchable.shouldIncludeInGlobalSearch()) { newSearchablesInGlobalSearchList.add(searchable); } } } } Loading @@ -219,8 +225,9 @@ public class Searchables { // Store a consistent set of new values synchronized (this) { mSearchablesList = newSearchablesList; mSearchablesMap = newSearchablesMap; mSearchablesList = newSearchablesList; mSearchablesInGlobalSearchList = newSearchablesInGlobalSearchList; mDefaultSearchable = newDefaultSearchable; } } Loading @@ -232,4 +239,11 @@ public class Searchables { ArrayList<SearchableInfo> result = new ArrayList<SearchableInfo>(mSearchablesList); return result; } /** * Returns a list of the searchable activities that can be included in global search. */ public synchronized ArrayList<SearchableInfo> getSearchablesInGlobalSearchList() { return new ArrayList<SearchableInfo>(mSearchablesInGlobalSearchList); } } Loading
core/java/android/app/ISearchManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ import android.server.search.SearchableInfo; /** @hide */ interface ISearchManager { SearchableInfo getSearchableInfo(in ComponentName launchActivity, boolean globalSearch); List<SearchableInfo> getSearchablesInGlobalSearch(); }
core/java/android/app/SearchManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.os.ServiceManager; import android.server.search.SearchableInfo; import android.view.KeyEvent; import java.util.List; /** * This class provides access to the system search services. * Loading Loading @@ -1655,4 +1657,20 @@ public class SearchManager return context.getContentResolver().query(uri, null, selection, selArgs, null); } /** * Returns a list of the searchable activities that can be included in global search. * * @return a list containing searchable information for all searchable activities * that have the <code>exported</code> attribute set in their searchable * meta-data. * * @hide because SearchableInfo is not part of the API. */ public static List<SearchableInfo> getSearchablesInGlobalSearch() { try { return sService.getSearchablesInGlobalSearch(); } catch (RemoteException e) { return null; } } }
core/java/android/server/search/SearchManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import java.util.List; /** * This is a simplified version of the Search Manager service. It no longer handles * presentation (UI). Its function is to maintain the map & list of "searchable" Loading Loading @@ -144,4 +146,11 @@ public class SearchManagerService extends ISearchManager.Stub return si; } /** * Returns a list of the searchable activities that can be included in global search. */ public List<SearchableInfo> getSearchablesInGlobalSearch() { return mSearchables.getSearchablesInGlobalSearchList(); } }
core/java/android/server/search/SearchableInfo.java +15 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ public final class SearchableInfo implements Parcelable { private int mSearchButtonText = 0; private int mSearchInputType = 0; private int mSearchImeOptions = 0; private boolean mIncludeInGlobalSearch = false; private String mSuggestAuthority = null; private String mSuggestPath = null; private String mSuggestSelection = null; Loading Loading @@ -236,6 +237,8 @@ public final class SearchableInfo implements Parcelable { InputType.TYPE_TEXT_VARIATION_NORMAL); mSearchImeOptions = a.getInt(com.android.internal.R.styleable.Searchable_imeOptions, EditorInfo.IME_ACTION_SEARCH); mIncludeInGlobalSearch = a.getBoolean( com.android.internal.R.styleable.Searchable_includeInGlobalSearch, false); setSearchModeFlags(); if (DBG_INHIBIT_SUGGESTIONS == 0) { Loading Loading @@ -575,6 +578,16 @@ public final class SearchableInfo implements Parcelable { return mSearchImeOptions; } /** * Checks whether the searchable is exported. * * @return The value of the <code>exported</code> attribute, * or <code>false</code> if the attribute is not set. */ public boolean shouldIncludeInGlobalSearch() { return mIncludeInGlobalSearch; } /** * Support for parcelable and aidl operations. */ Loading Loading @@ -606,6 +619,7 @@ public final class SearchableInfo implements Parcelable { mSearchButtonText = in.readInt(); mSearchInputType = in.readInt(); mSearchImeOptions = in.readInt(); mIncludeInGlobalSearch = in.readInt() != 0; setSearchModeFlags(); mSuggestAuthority = in.readString(); Loading Loading @@ -644,6 +658,7 @@ public final class SearchableInfo implements Parcelable { dest.writeInt(mSearchButtonText); dest.writeInt(mSearchInputType); dest.writeInt(mSearchImeOptions); dest.writeInt(mIncludeInGlobalSearch ? 1 : 0); dest.writeString(mSuggestAuthority); dest.writeString(mSuggestPath); Loading
core/java/android/server/search/Searchables.java +15 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class Searchables { private HashMap<ComponentName, SearchableInfo> mSearchablesMap = null; private ArrayList<SearchableInfo> mSearchablesList = null; private ArrayList<SearchableInfo> mSearchablesInGlobalSearchList = null; private SearchableInfo mDefaultSearchable = null; /** Loading Loading @@ -189,6 +190,8 @@ public class Searchables { = new HashMap<ComponentName, SearchableInfo>(); ArrayList<SearchableInfo> newSearchablesList = new ArrayList<SearchableInfo>(); ArrayList<SearchableInfo> newSearchablesInGlobalSearchList = new ArrayList<SearchableInfo>(); final PackageManager pm = mContext.getPackageManager(); Loading @@ -208,6 +211,9 @@ public class Searchables { if (searchable != null) { newSearchablesList.add(searchable); newSearchablesMap.put(searchable.mSearchActivity, searchable); if (searchable.shouldIncludeInGlobalSearch()) { newSearchablesInGlobalSearchList.add(searchable); } } } } Loading @@ -219,8 +225,9 @@ public class Searchables { // Store a consistent set of new values synchronized (this) { mSearchablesList = newSearchablesList; mSearchablesMap = newSearchablesMap; mSearchablesList = newSearchablesList; mSearchablesInGlobalSearchList = newSearchablesInGlobalSearchList; mDefaultSearchable = newDefaultSearchable; } } Loading @@ -232,4 +239,11 @@ public class Searchables { ArrayList<SearchableInfo> result = new ArrayList<SearchableInfo>(mSearchablesList); return result; } /** * Returns a list of the searchable activities that can be included in global search. */ public synchronized ArrayList<SearchableInfo> getSearchablesInGlobalSearchList() { return new ArrayList<SearchableInfo>(mSearchablesInGlobalSearchList); } }