Loading api/current.xml +110 −0 Original line number Original line Diff line number Diff line Loading @@ -4123,6 +4123,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="includeInGlobalSearch" type="int" transient="false" volatile="false" value="16843374" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="indeterminate" <field name="indeterminate" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6191,6 +6202,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="queryAfterZeroResults" type="int" transient="false" volatile="false" value="16843394" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="radioButtonStyle" <field name="radioButtonStyle" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6686,6 +6708,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="searchSettingsDescription" type="int" transient="false" volatile="false" value="16843402" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="searchSuggestAuthority" <field name="searchSuggestAuthority" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6741,6 +6774,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="searchSuggestThreshold" type="int" transient="false" volatile="false" value="16843373" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="secondaryProgress" <field name="secondaryProgress" type="int" type="int" transient="false" transient="false" Loading Loading @@ -21158,6 +21202,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="INTENT_ACTION_WEB_SEARCH_SETTINGS" type="java.lang.String" transient="false" volatile="false" value=""android.search.action.WEB_SEARCH_SETTINGS"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MENU_KEY" <field name="MENU_KEY" type="char" type="char" transient="false" transient="false" Loading Loading @@ -21191,6 +21246,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SHORTCUT_MIME_TYPE" type="java.lang.String" transient="false" volatile="false" value=""vnd.android.cursor.item/vnd.android.search.suggest"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_FORMAT" <field name="SUGGEST_COLUMN_FORMAT" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading Loading @@ -21279,6 +21345,28 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_COLUMN_SHORTCUT_ID" type="java.lang.String" transient="false" volatile="false" value=""suggest_shortcut_id"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING" type="java.lang.String" transient="false" volatile="false" value=""suggest_spinner_while_refreshing"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_TEXT_1" <field name="SUGGEST_COLUMN_TEXT_1" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading Loading @@ -21312,6 +21400,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_NEVER_MAKE_SHORTCUT" type="java.lang.String" transient="false" volatile="false" value=""_-1"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_URI_PATH_QUERY" <field name="SUGGEST_URI_PATH_QUERY" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading @@ -21323,6 +21422,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_URI_PATH_SHORTCUT" type="java.lang.String" transient="false" volatile="false" value=""search_suggest_shortcut"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="USER_QUERY" <field name="USER_QUERY" type="java.lang.String" type="java.lang.String" transient="false" transient="false" core/java/android/app/SearchManager.java +131 −20 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,8 @@ import java.util.List; * <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a> * <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a> * <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a> * <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a> * <li><a href="#Suggestions">Search Suggestions</a> * <li><a href="#Suggestions">Search Suggestions</a> * <li><a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to * Quick Search Box</a></li> * <li><a href="#ActionKeys">Action Keys</a> * <li><a href="#ActionKeys">Action Keys</a> * <li><a href="#SearchabilityMetadata">Searchability Metadata</a> * <li><a href="#SearchabilityMetadata">Searchability Metadata</a> * <li><a href="#PassingSearchContext">Passing Search Context</a> * <li><a href="#PassingSearchContext">Passing Search Context</a> Loading Loading @@ -246,6 +248,12 @@ import java.util.List; * <li>Summaries of possible results</li> * <li>Summaries of possible results</li> * </ul> * </ul> * * * <p>Once an application is configured to provide search suggestions, those same suggestions can * easily be made available to the system-wide Quick Search Box, providing faster access to its * content from on central prominent place. See * <a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to Quick Search * Box</a> for more details. * * <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query * <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query * text that the user has already typed. This would generally be based on partial matches in * text that the user has already typed. This would generally be based on partial matches in * the available data. In certain situations - for example, when no query text has been typed yet - * the available data. In certain situations - for example, when no query text has been typed yet - Loading Loading @@ -480,6 +488,26 @@ import java.util.List; * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</td> * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</td> * </tr> * </tr> * * * <tr><th>{@link #SUGGEST_COLUMN_SHORTCUT_ID}</th> * <td>This column is used to indicate whether a search suggestion should be stored as a * shortcut, and whether it should be validated. Shortcuts are usually formed when the * user clicks a suggestion from Quick Search Box. If missing, the result will be * stored as a shortcut and never refreshed. If set to * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * Otherwise, the shortcut id will be used to check back for for an up to date * suggestion using {@link #SUGGEST_URI_PATH_SHORTCUT}. Read more about shortcut * refreshing in the section about * <a href="#ExposingSearchSuggestionsToQuickSearchBox">exposing search suggestions to * Quick Search Box</a>.</td> * <td align="center">No. Only applicable to sources included in Quick Search Box.</td> * </tr> * * <tr><th>{@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING}</th> * <td>This column is used to specify that a spinner should be shown in lieu of an icon2 * while the shortcut of this suggestion is being refreshed.</td> * <td align="center">No. Only applicable to sources included in Quick Search Box.</td> * </tr> * * <tr><th><i>Other Columns</i></th> * <tr><th><i>Other Columns</i></th> * <td>Finally, if you have defined any <a href="#ActionKeys">Action Keys</a> and you wish * <td>Finally, if you have defined any <a href="#ActionKeys">Action Keys</a> and you wish * for them to have suggestion-specific definitions, you'll need to define one * for them to have suggestion-specific definitions, you'll need to define one Loading Loading @@ -553,6 +581,59 @@ import java.util.List; * query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user * query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user * inspection and editing.</li></ul> * inspection and editing.</li></ul> * * * <a name="ExposingSearchSuggestionsToQuickSearchBox"></a> * <h3>Exposing Search Suggestions to Quick Search Box</h3> * * <p>Once your application is setup to provide search suggestions, making them available to the * globally accessable Quick Search Box is as easy as setting android:includeInGlobalSearch to * "true" in your searchable metadata file. Beyond that, here are some more details of how * suggestions interact with Quick Search Box, and optional ways that you may customize suggestions * for your application. * * <p><b>Source Ranking:</b> Once your application's search results are made available to Quick * Search Box, how they surface to the user for a particular query will depend on how many * other apps have results for that query, and how often the user has clicked on your results * compared to the other apps'. The apps with the best track record within Quick Search * Box will get queried earlier and have a better chance of showing their results in the top few * slots. If there are more results than can be displayed to the user within a screen or two, the * results may spill into a "more results" section that groups the remaining results by * source. The newest apps with little usage information are given middle of the road positioning * until enough usage information is available to rank it as usual. The exact formula for ranking * the results is not set in stone, but suffice it is to say that providing quality results will * increase the likelihood that your app's suggestions are provided in a prominent position, and * apps that provide lower quality suggestions will be more likely to be pushed into the spillover * area. * * <p><b>Search Settings:</b> Each app that is available to Quick Search Box has an entry in the * system settings where the user can enable or disable the inclusion of its results. Below the * name of the application, each application may provide a brief description of what kind of * information will be made available via a search settings description string pointed to by the * android:searchSettingsDescription attribute in the searchable metadata. * * <p><b>Shortcuts:</b> Suggestions that are clicked on by the user are automatically made into * shortcuts, or, copied so they can quickly be displayed to the user before querying any of * the sources. Thereafter, the shortcutted suggestion will be displayed for the query that yielded * the suggestion and for any prefixes of that query. When multiple shortcuts are made available * for a given query, they are ranked based on recency and the number of clicks they have received. * You can control how your suggestions are made into shortcuts, and whether they are refreshed, * using the {@link #SUGGEST_COLUMN_SHORTCUT_ID} column: * <ul><li>Suggestions that do not include a shortcut id column will be made into shortcuts and * never refreshed. This makes sense for suggestions that refer to data that will never be changed * or removed.</li> * <li>Suggestions that include a shortcut id will be re-queried for a fresh version of the * suggestion each time the shortcut is displayed. The shortcut will be quickly displayed with * whatever data was most recently available until the refresh query returns, after which the * suggestion will be dynamically refreshed with the up to date information. The shortcut refresh * query will be sent to your suggestion provider with a uri of {@link #SUGGEST_URI_PATH_SHORTCUT}. * The result should contain one suggestion using the same columns as the suggestion query, or be * empty, indicating that the shortcut is no longer valid. Shortcut ids make sense when referring * to data that may change over time, such as a contact's presence status. If a suggestion refers * to data that could take longer to refresh, such as a network based refresh of a stock quote, you * may include {@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING} to show a progress spinner for the * right hand icon until the refresh is complete.</li> * <li>Finally, to prevent a suggestion from being copied into a shortcut, you may provide a * shortcut id with a value of {@link #SUGGEST_NEVER_MAKE_SHORTCUT}.</li></ul> * * <a name="ActionKeys"></a> * <a name="ActionKeys"></a> * <h3>Action Keys</h3> * <h3>Action Keys</h3> * * Loading Loading @@ -869,6 +950,47 @@ import java.util.List; * </tbody> * </tbody> * </table> * </table> * * * <p>Elements of search metadata that configure search suggestions being available to Quick Search * Box: * <table border="2" width="85%" align="center" frame="hsides" rules="rows"> * * <thead> * <tr><th>Attribute</th> <th>Description</th> <th>Required?</th></tr> * </thead> * * <tr><th>android:includeInGlobalSearch</th> * <td>If true, indicates the search suggestions provided by your application should be * included in the globally accessible Quick Search Box. The attributes below are only * applicable if this is set to true.</td> * <td align="center">Yes</td> * </tr> * * <tr><th>android:searchSettingsDescription</th> * <td>If provided, provides a brief description of the search suggestions that are provided * by your application to Quick Search Box, and will be displayed in the search settings * entry for your application.</td> * <td align="center">No</td> * </tr> * * <tr><th>android:queryAfterZeroResults</th> * <td>Indicates whether a source should be invoked for supersets of queries it has * returned zero results for in the past. For example, if a source returned zero * results for "bo", it would be ignored for "bob". If set to false, this source * will only be ignored for a single session; the next time the search dialog is * invoked, all sources will be queried. The default value is false.</td> * <td align="center">No</td> * </tr> * * <tr><th>android:searchSuggestThreshold</th> * <td>Indicates the minimum number of characters needed to trigger a source from Quick * Search Box. Only guarantees that a source will not be queried for anything shorter * than the threshold. The default value is 0.</td> * <td align="center">No</td> * </tr> * * </tbody> * </table> * * <p><b>Additional metadata for search action keys.</b> For each action key that you would like to * <p><b>Additional metadata for search action keys.</b> For each action key that you would like to * define, you'll need to add an additional element defining that key, and using the attributes * define, you'll need to add an additional element defining that key, and using the attributes * discussed in <a href="#ActionKeys">Action Keys</a>. A simple example is shown here: * discussed in <a href="#ActionKeys">Action Keys</a>. A simple example is shown here: Loading Loading @@ -1246,16 +1368,12 @@ public class SearchManager * result indicates the shortcut refers to a no longer valid sugggestion. * result indicates the shortcut refers to a no longer valid sugggestion. * * * @see #SUGGEST_COLUMN_SHORTCUT_ID * @see #SUGGEST_COLUMN_SHORTCUT_ID * * @hide pending enabling of global search for third parties */ */ public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; /** /** * MIME type for shortcut validation. You'll use this in your suggestions content provider * MIME type for shortcut validation. You'll use this in your suggestions content provider * in the getType() function. * in the getType() function. * * @hide pending enabling of global search for third parties */ */ public final static String SHORTCUT_MIME_TYPE = public final static String SHORTCUT_MIME_TYPE = "vnd.android.cursor.item/vnd.android.search.suggest"; "vnd.android.cursor.item/vnd.android.search.suggest"; Loading @@ -1268,7 +1386,7 @@ public class SearchManager * In addition to the columns below, the suggestion columns are used to pass along the full * In addition to the columns below, the suggestion columns are used to pass along the full * suggestion so it can be shortcutted. * suggestion so it can be shortcutted. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_AUTHORITY = public final static String SEARCH_CLICK_REPORT_AUTHORITY = "com.android.globalsearch.stats"; "com.android.globalsearch.stats"; Loading @@ -1276,21 +1394,21 @@ public class SearchManager /** /** * The path the write goes to. * The path the write goes to. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_URI_PATH = "click"; public final static String SEARCH_CLICK_REPORT_URI_PATH = "click"; /** /** * The column storing the query for the click. * The column storing the query for the click. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_COLUMN_QUERY = "query"; public final static String SEARCH_CLICK_REPORT_COLUMN_QUERY = "query"; /** /** * The column storing the component name of the application that was pivoted into. * The column storing the component name of the application that was pivoted into. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_COLUMN_COMPONENT = "component"; public final static String SEARCH_CLICK_REPORT_COLUMN_COMPONENT = "component"; Loading Loading @@ -1375,7 +1493,7 @@ public class SearchManager * {@link #COMPONENT_NAME_KEY}. For use by the global search system only - if other providers * {@link #COMPONENT_NAME_KEY}. For use by the global search system only - if other providers * attempt to use this column, the value will be overwritten by global search. * attempt to use this column, the value will be overwritten by global search. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SUGGEST_COLUMN_INTENT_COMPONENT_NAME = "suggest_intent_component"; public final static String SUGGEST_COLUMN_INTENT_COMPONENT_NAME = "suggest_intent_component"; /** /** Loading @@ -1400,8 +1518,6 @@ public class SearchManager * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * Otherwise, the shortcut id will be used to check back for an up to date suggestion using * Otherwise, the shortcut id will be used to check back for an up to date suggestion using * {@link #SUGGEST_URI_PATH_SHORTCUT}. * {@link #SUGGEST_URI_PATH_SHORTCUT}. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id"; public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id"; Loading @@ -1410,7 +1526,7 @@ public class SearchManager * cursor item's background color if it needs a non-default background color. A non-zero value * cursor item's background color if it needs a non-default background color. A non-zero value * indicates a valid background color to override the default. * indicates a valid background color to override the default. * * * @hide an implementation detail not part of the public api * @hide For internal use, not part of the public API. */ */ public final static String SUGGEST_COLUMN_BACKGROUND_COLOR = "suggest_background_color"; public final static String SUGGEST_COLUMN_BACKGROUND_COLOR = "suggest_background_color"; Loading @@ -1418,8 +1534,6 @@ public class SearchManager * Column name for suggestions cursor. <i>Optional.</i> This column is used to specify * Column name for suggestions cursor. <i>Optional.</i> This column is used to specify * that a spinner should be shown in lieu of an icon2 while the shortcut of this suggestion * that a spinner should be shown in lieu of an icon2 while the shortcut of this suggestion * is being refreshed. * is being refreshed. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = public final static String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = "suggest_spinner_while_refreshing"; "suggest_spinner_while_refreshing"; Loading @@ -1427,8 +1541,6 @@ public class SearchManager /** /** * Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion * Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion * should not be stored as a shortcut in global search. * should not be stored as a shortcut in global search. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1"; public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1"; Loading Loading @@ -1475,8 +1587,6 @@ public class SearchManager * Intent action for starting a web search provider's settings activity. * Intent action for starting a web search provider's settings activity. * Web search providers should handle this intent if they have provider-specific * Web search providers should handle this intent if they have provider-specific * settings to implement. * settings to implement. * * @hide implementation detail only relevent to web search providers */ */ public final static String INTENT_ACTION_WEB_SEARCH_SETTINGS public final static String INTENT_ACTION_WEB_SEARCH_SETTINGS = "android.search.action.WEB_SEARCH_SETTINGS"; = "android.search.action.WEB_SEARCH_SETTINGS"; Loading @@ -1491,7 +1601,8 @@ public class SearchManager /** /** * Intent action broadcasted to inform that the search settings have changed in some way. * Intent action broadcasted to inform that the search settings have changed in some way. * Either searchables have been enabled or disabled. * Either searchables have been enabled or disabled, or a different web search provider * has been chosen. */ */ public final static String INTENT_ACTION_SEARCH_SETTINGS_CHANGED public final static String INTENT_ACTION_SEARCH_SETTINGS_CHANGED = "android.search.action.SETTINGS_CHANGED"; = "android.search.action.SETTINGS_CHANGED"; Loading @@ -1500,7 +1611,7 @@ public class SearchManager * If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION}, * If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION}, * the search dialog will take no action. * the search dialog will take no action. * * * @hide an implentation detail not part of the public api * @hide */ */ public final static String INTENT_ACTION_NONE = "android.search.action.ZILCH"; public final static String INTENT_ACTION_NONE = "android.search.action.ZILCH"; Loading core/java/android/server/search/Searchables.java +8 −30 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.content.pm.ApplicationInfo; import android.os.Bundle; import android.os.Bundle; import android.util.Log; import android.util.Log; Loading Loading @@ -231,20 +230,18 @@ public class Searchables { : webSearchInfoList.get(ii - search_count); : webSearchInfoList.get(ii - search_count); ActivityInfo ai = info.activityInfo; ActivityInfo ai = info.activityInfo; // Check first to avoid duplicate entries. // Check first to avoid duplicate entries. if (newSearchablesMap.containsKey(new ComponentName(ai.packageName, ai.name))) { if (newSearchablesMap.get(new ComponentName(ai.packageName, ai.name)) == null) { continue; } SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai); SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai); if (searchable != null) { if (searchable != null) { newSearchablesList.add(searchable); newSearchablesList.add(searchable); newSearchablesMap.put(searchable.getSearchActivity(), searchable); newSearchablesMap.put(searchable.getSearchActivity(), searchable); if (searchable.shouldIncludeInGlobalSearch() if (searchable.shouldIncludeInGlobalSearch()) { && isWhitelistedForGlobalSearch(pm, searchable.getSearchActivity())) { newSearchablesInGlobalSearchList.add(searchable); newSearchablesInGlobalSearchList.add(searchable); } } } } } } } } } if (webSearchInfoList != null) { if (webSearchInfoList != null) { for (int i = 0; i < webSearchInfoList.size(); ++i) { for (int i = 0; i < webSearchInfoList.size(); ++i) { Loading Loading @@ -291,25 +288,6 @@ public class Searchables { } } } } /** * Determines whether an activity may be included in quick search box. For now this is * restricted to system installed apps. * * TODO: remove when we are ready to enable global search for third party applications. * * @param pm The package manager. * @param searchActivity The component of the search activity. * @return True if the search activity may include its search suggestions in quick search box. */ private boolean isWhitelistedForGlobalSearch(PackageManager pm, ComponentName searchActivity) { try { ActivityInfo ai = pm.getActivityInfo(searchActivity, 0); return ((ai.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0); } catch (PackageManager.NameNotFoundException e) { return false; } } /** /** * Checks if the given activity component is present in the system and if so makes it the * Checks if the given activity component is present in the system and if so makes it the * preferred activity for handling ACTION_WEB_SEARCH. * preferred activity for handling ACTION_WEB_SEARCH. Loading core/res/res/values/attrs.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -2866,16 +2866,16 @@ when the user clicks a suggestion. <i>Optional attribute.</i> --> when the user clicks a suggestion. <i>Optional attribute.</i> --> <attr name="searchSuggestIntentData" format="string" /> <attr name="searchSuggestIntentData" format="string" /> <!-- @hide If provided, this is the minimum number of characters needed to trigger <!-- If provided, this is the minimum number of characters needed to trigger search suggestions. The default value is 0. <i>Optional attribute.</i> --> search suggestions. The default value is 0. <i>Optional attribute.</i> --> <attr name="searchSuggestThreshold" format="integer" /> <attr name="searchSuggestThreshold" format="integer" /> <!-- @hide If provided and <code>true</code>, this searchable activity will be <!-- If provided and <code>true</code>, this searchable activity will be included in any global lists of search targets. included in any global lists of search targets. The default value is <code>false</code>. <i>Optional attribute.</i>. --> The default value is <code>false</code>. <i>Optional attribute.</i>. --> <attr name="includeInGlobalSearch" format="boolean" /> <attr name="includeInGlobalSearch" format="boolean" /> <!-- @hide If provided and <code>true</code>, this searchable activity will be invoked for all <!-- If provided and <code>true</code>, this searchable activity will be invoked for all queries in a particular session. If set to <code>false</code> and the activity queries in a particular session. If set to <code>false</code> and the activity returned zero results for a query, it will not be invoked again in that session for returned zero results for a query, it will not be invoked again in that session for supersets of that zero-results query. For example, if the activity returned zero supersets of that zero-results query. For example, if the activity returned zero Loading @@ -2883,7 +2883,7 @@ The default value is <code>false</code>. <i>Optional attribute.</i>. --> The default value is <code>false</code>. <i>Optional attribute.</i>. --> <attr name="queryAfterZeroResults" format="boolean" /> <attr name="queryAfterZeroResults" format="boolean" /> <!-- @hide If provided, this string will be used to describe the searchable item in the <!-- If provided, this string will be used to describe the searchable item in the searchable items settings within system search settings. <i>Optional searchable items settings within system search settings. <i>Optional attribute.</i> --> attribute.</i> --> <attr name="searchSettingsDescription" format="string" /> <attr name="searchSettingsDescription" format="string" /> Loading core/res/res/values/public.xml +0 −4 Original line number Original line Diff line number Diff line Loading @@ -1094,9 +1094,7 @@ <public type="attr" name="tension" id="0x0101026a" /> <public type="attr" name="tension" id="0x0101026a" /> <public type="attr" name="extraTension" id="0x0101026b" /> <public type="attr" name="extraTension" id="0x0101026b" /> <public type="attr" name="anyDensity" id="0x0101026c" /> <public type="attr" name="anyDensity" id="0x0101026c" /> <!-- {@hide} --> <public type="attr" name="searchSuggestThreshold" id="0x0101026d" /> <public type="attr" name="searchSuggestThreshold" id="0x0101026d" /> <!-- {@hide} --> <public type="attr" name="includeInGlobalSearch" id="0x0101026e" /> <public type="attr" name="includeInGlobalSearch" id="0x0101026e" /> <public type="attr" name="onClick" id="0x0101026f" /> <public type="attr" name="onClick" id="0x0101026f" /> <public type="attr" name="targetSdkVersion" id="0x01010270" /> <public type="attr" name="targetSdkVersion" id="0x01010270" /> Loading @@ -1117,7 +1115,6 @@ <public type="attr" name="backupAgent" id="0x0101027f" /> <public type="attr" name="backupAgent" id="0x0101027f" /> <public type="attr" name="allowBackup" id="0x01010280" /> <public type="attr" name="allowBackup" id="0x01010280" /> <public type="attr" name="glEsVersion" id="0x01010281" /> <public type="attr" name="glEsVersion" id="0x01010281" /> <!-- {@hide} --> <public type="attr" name="queryAfterZeroResults" id="0x01010282" /> <public type="attr" name="queryAfterZeroResults" id="0x01010282" /> <public type="attr" name="dropDownHeight" id="0x01010283" /> <public type="attr" name="dropDownHeight" id="0x01010283" /> <public type="attr" name="smallScreens" id="0x01010284" /> <public type="attr" name="smallScreens" id="0x01010284" /> Loading @@ -1126,7 +1123,6 @@ <public type="attr" name="progressBarStyleInverse" id="0x01010287" /> <public type="attr" name="progressBarStyleInverse" id="0x01010287" /> <public type="attr" name="progressBarStyleSmallInverse" id="0x01010288" /> <public type="attr" name="progressBarStyleSmallInverse" id="0x01010288" /> <public type="attr" name="progressBarStyleLargeInverse" id="0x01010289" /> <public type="attr" name="progressBarStyleLargeInverse" id="0x01010289" /> <!-- {@hide} --> <public type="attr" name="searchSettingsDescription" id="0x0101028a" /> <public type="attr" name="searchSettingsDescription" id="0x0101028a" /> <public type="attr" name="textColorPrimaryInverseDisableOnly" id="0x0101028b" /> <public type="attr" name="textColorPrimaryInverseDisableOnly" id="0x0101028b" /> <public type="attr" name="autoUrlDetect" id="0x0101028c" /> <public type="attr" name="autoUrlDetect" id="0x0101028c" /> Loading Loading
api/current.xml +110 −0 Original line number Original line Diff line number Diff line Loading @@ -4123,6 +4123,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="includeInGlobalSearch" type="int" transient="false" volatile="false" value="16843374" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="indeterminate" <field name="indeterminate" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6191,6 +6202,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="queryAfterZeroResults" type="int" transient="false" volatile="false" value="16843394" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="radioButtonStyle" <field name="radioButtonStyle" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6686,6 +6708,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="searchSettingsDescription" type="int" transient="false" volatile="false" value="16843402" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="searchSuggestAuthority" <field name="searchSuggestAuthority" type="int" type="int" transient="false" transient="false" Loading Loading @@ -6741,6 +6774,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="searchSuggestThreshold" type="int" transient="false" volatile="false" value="16843373" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="secondaryProgress" <field name="secondaryProgress" type="int" type="int" transient="false" transient="false" Loading Loading @@ -21158,6 +21202,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="INTENT_ACTION_WEB_SEARCH_SETTINGS" type="java.lang.String" transient="false" volatile="false" value=""android.search.action.WEB_SEARCH_SETTINGS"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MENU_KEY" <field name="MENU_KEY" type="char" type="char" transient="false" transient="false" Loading Loading @@ -21191,6 +21246,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SHORTCUT_MIME_TYPE" type="java.lang.String" transient="false" volatile="false" value=""vnd.android.cursor.item/vnd.android.search.suggest"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_FORMAT" <field name="SUGGEST_COLUMN_FORMAT" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading Loading @@ -21279,6 +21345,28 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_COLUMN_SHORTCUT_ID" type="java.lang.String" transient="false" volatile="false" value=""suggest_shortcut_id"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING" type="java.lang.String" transient="false" volatile="false" value=""suggest_spinner_while_refreshing"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_COLUMN_TEXT_1" <field name="SUGGEST_COLUMN_TEXT_1" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading Loading @@ -21312,6 +21400,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_NEVER_MAKE_SHORTCUT" type="java.lang.String" transient="false" volatile="false" value=""_-1"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="SUGGEST_URI_PATH_QUERY" <field name="SUGGEST_URI_PATH_QUERY" type="java.lang.String" type="java.lang.String" transient="false" transient="false" Loading @@ -21323,6 +21422,17 @@ visibility="public" visibility="public" > > </field> </field> <field name="SUGGEST_URI_PATH_SHORTCUT" type="java.lang.String" transient="false" volatile="false" value=""search_suggest_shortcut"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="USER_QUERY" <field name="USER_QUERY" type="java.lang.String" type="java.lang.String" transient="false" transient="false"
core/java/android/app/SearchManager.java +131 −20 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,8 @@ import java.util.List; * <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a> * <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a> * <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a> * <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a> * <li><a href="#Suggestions">Search Suggestions</a> * <li><a href="#Suggestions">Search Suggestions</a> * <li><a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to * Quick Search Box</a></li> * <li><a href="#ActionKeys">Action Keys</a> * <li><a href="#ActionKeys">Action Keys</a> * <li><a href="#SearchabilityMetadata">Searchability Metadata</a> * <li><a href="#SearchabilityMetadata">Searchability Metadata</a> * <li><a href="#PassingSearchContext">Passing Search Context</a> * <li><a href="#PassingSearchContext">Passing Search Context</a> Loading Loading @@ -246,6 +248,12 @@ import java.util.List; * <li>Summaries of possible results</li> * <li>Summaries of possible results</li> * </ul> * </ul> * * * <p>Once an application is configured to provide search suggestions, those same suggestions can * easily be made available to the system-wide Quick Search Box, providing faster access to its * content from on central prominent place. See * <a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to Quick Search * Box</a> for more details. * * <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query * <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query * text that the user has already typed. This would generally be based on partial matches in * text that the user has already typed. This would generally be based on partial matches in * the available data. In certain situations - for example, when no query text has been typed yet - * the available data. In certain situations - for example, when no query text has been typed yet - Loading Loading @@ -480,6 +488,26 @@ import java.util.List; * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</td> * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</td> * </tr> * </tr> * * * <tr><th>{@link #SUGGEST_COLUMN_SHORTCUT_ID}</th> * <td>This column is used to indicate whether a search suggestion should be stored as a * shortcut, and whether it should be validated. Shortcuts are usually formed when the * user clicks a suggestion from Quick Search Box. If missing, the result will be * stored as a shortcut and never refreshed. If set to * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * Otherwise, the shortcut id will be used to check back for for an up to date * suggestion using {@link #SUGGEST_URI_PATH_SHORTCUT}. Read more about shortcut * refreshing in the section about * <a href="#ExposingSearchSuggestionsToQuickSearchBox">exposing search suggestions to * Quick Search Box</a>.</td> * <td align="center">No. Only applicable to sources included in Quick Search Box.</td> * </tr> * * <tr><th>{@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING}</th> * <td>This column is used to specify that a spinner should be shown in lieu of an icon2 * while the shortcut of this suggestion is being refreshed.</td> * <td align="center">No. Only applicable to sources included in Quick Search Box.</td> * </tr> * * <tr><th><i>Other Columns</i></th> * <tr><th><i>Other Columns</i></th> * <td>Finally, if you have defined any <a href="#ActionKeys">Action Keys</a> and you wish * <td>Finally, if you have defined any <a href="#ActionKeys">Action Keys</a> and you wish * for them to have suggestion-specific definitions, you'll need to define one * for them to have suggestion-specific definitions, you'll need to define one Loading Loading @@ -553,6 +581,59 @@ import java.util.List; * query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user * query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user * inspection and editing.</li></ul> * inspection and editing.</li></ul> * * * <a name="ExposingSearchSuggestionsToQuickSearchBox"></a> * <h3>Exposing Search Suggestions to Quick Search Box</h3> * * <p>Once your application is setup to provide search suggestions, making them available to the * globally accessable Quick Search Box is as easy as setting android:includeInGlobalSearch to * "true" in your searchable metadata file. Beyond that, here are some more details of how * suggestions interact with Quick Search Box, and optional ways that you may customize suggestions * for your application. * * <p><b>Source Ranking:</b> Once your application's search results are made available to Quick * Search Box, how they surface to the user for a particular query will depend on how many * other apps have results for that query, and how often the user has clicked on your results * compared to the other apps'. The apps with the best track record within Quick Search * Box will get queried earlier and have a better chance of showing their results in the top few * slots. If there are more results than can be displayed to the user within a screen or two, the * results may spill into a "more results" section that groups the remaining results by * source. The newest apps with little usage information are given middle of the road positioning * until enough usage information is available to rank it as usual. The exact formula for ranking * the results is not set in stone, but suffice it is to say that providing quality results will * increase the likelihood that your app's suggestions are provided in a prominent position, and * apps that provide lower quality suggestions will be more likely to be pushed into the spillover * area. * * <p><b>Search Settings:</b> Each app that is available to Quick Search Box has an entry in the * system settings where the user can enable or disable the inclusion of its results. Below the * name of the application, each application may provide a brief description of what kind of * information will be made available via a search settings description string pointed to by the * android:searchSettingsDescription attribute in the searchable metadata. * * <p><b>Shortcuts:</b> Suggestions that are clicked on by the user are automatically made into * shortcuts, or, copied so they can quickly be displayed to the user before querying any of * the sources. Thereafter, the shortcutted suggestion will be displayed for the query that yielded * the suggestion and for any prefixes of that query. When multiple shortcuts are made available * for a given query, they are ranked based on recency and the number of clicks they have received. * You can control how your suggestions are made into shortcuts, and whether they are refreshed, * using the {@link #SUGGEST_COLUMN_SHORTCUT_ID} column: * <ul><li>Suggestions that do not include a shortcut id column will be made into shortcuts and * never refreshed. This makes sense for suggestions that refer to data that will never be changed * or removed.</li> * <li>Suggestions that include a shortcut id will be re-queried for a fresh version of the * suggestion each time the shortcut is displayed. The shortcut will be quickly displayed with * whatever data was most recently available until the refresh query returns, after which the * suggestion will be dynamically refreshed with the up to date information. The shortcut refresh * query will be sent to your suggestion provider with a uri of {@link #SUGGEST_URI_PATH_SHORTCUT}. * The result should contain one suggestion using the same columns as the suggestion query, or be * empty, indicating that the shortcut is no longer valid. Shortcut ids make sense when referring * to data that may change over time, such as a contact's presence status. If a suggestion refers * to data that could take longer to refresh, such as a network based refresh of a stock quote, you * may include {@link #SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING} to show a progress spinner for the * right hand icon until the refresh is complete.</li> * <li>Finally, to prevent a suggestion from being copied into a shortcut, you may provide a * shortcut id with a value of {@link #SUGGEST_NEVER_MAKE_SHORTCUT}.</li></ul> * * <a name="ActionKeys"></a> * <a name="ActionKeys"></a> * <h3>Action Keys</h3> * <h3>Action Keys</h3> * * Loading Loading @@ -869,6 +950,47 @@ import java.util.List; * </tbody> * </tbody> * </table> * </table> * * * <p>Elements of search metadata that configure search suggestions being available to Quick Search * Box: * <table border="2" width="85%" align="center" frame="hsides" rules="rows"> * * <thead> * <tr><th>Attribute</th> <th>Description</th> <th>Required?</th></tr> * </thead> * * <tr><th>android:includeInGlobalSearch</th> * <td>If true, indicates the search suggestions provided by your application should be * included in the globally accessible Quick Search Box. The attributes below are only * applicable if this is set to true.</td> * <td align="center">Yes</td> * </tr> * * <tr><th>android:searchSettingsDescription</th> * <td>If provided, provides a brief description of the search suggestions that are provided * by your application to Quick Search Box, and will be displayed in the search settings * entry for your application.</td> * <td align="center">No</td> * </tr> * * <tr><th>android:queryAfterZeroResults</th> * <td>Indicates whether a source should be invoked for supersets of queries it has * returned zero results for in the past. For example, if a source returned zero * results for "bo", it would be ignored for "bob". If set to false, this source * will only be ignored for a single session; the next time the search dialog is * invoked, all sources will be queried. The default value is false.</td> * <td align="center">No</td> * </tr> * * <tr><th>android:searchSuggestThreshold</th> * <td>Indicates the minimum number of characters needed to trigger a source from Quick * Search Box. Only guarantees that a source will not be queried for anything shorter * than the threshold. The default value is 0.</td> * <td align="center">No</td> * </tr> * * </tbody> * </table> * * <p><b>Additional metadata for search action keys.</b> For each action key that you would like to * <p><b>Additional metadata for search action keys.</b> For each action key that you would like to * define, you'll need to add an additional element defining that key, and using the attributes * define, you'll need to add an additional element defining that key, and using the attributes * discussed in <a href="#ActionKeys">Action Keys</a>. A simple example is shown here: * discussed in <a href="#ActionKeys">Action Keys</a>. A simple example is shown here: Loading Loading @@ -1246,16 +1368,12 @@ public class SearchManager * result indicates the shortcut refers to a no longer valid sugggestion. * result indicates the shortcut refers to a no longer valid sugggestion. * * * @see #SUGGEST_COLUMN_SHORTCUT_ID * @see #SUGGEST_COLUMN_SHORTCUT_ID * * @hide pending enabling of global search for third parties */ */ public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; /** /** * MIME type for shortcut validation. You'll use this in your suggestions content provider * MIME type for shortcut validation. You'll use this in your suggestions content provider * in the getType() function. * in the getType() function. * * @hide pending enabling of global search for third parties */ */ public final static String SHORTCUT_MIME_TYPE = public final static String SHORTCUT_MIME_TYPE = "vnd.android.cursor.item/vnd.android.search.suggest"; "vnd.android.cursor.item/vnd.android.search.suggest"; Loading @@ -1268,7 +1386,7 @@ public class SearchManager * In addition to the columns below, the suggestion columns are used to pass along the full * In addition to the columns below, the suggestion columns are used to pass along the full * suggestion so it can be shortcutted. * suggestion so it can be shortcutted. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_AUTHORITY = public final static String SEARCH_CLICK_REPORT_AUTHORITY = "com.android.globalsearch.stats"; "com.android.globalsearch.stats"; Loading @@ -1276,21 +1394,21 @@ public class SearchManager /** /** * The path the write goes to. * The path the write goes to. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_URI_PATH = "click"; public final static String SEARCH_CLICK_REPORT_URI_PATH = "click"; /** /** * The column storing the query for the click. * The column storing the query for the click. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_COLUMN_QUERY = "query"; public final static String SEARCH_CLICK_REPORT_COLUMN_QUERY = "query"; /** /** * The column storing the component name of the application that was pivoted into. * The column storing the component name of the application that was pivoted into. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SEARCH_CLICK_REPORT_COLUMN_COMPONENT = "component"; public final static String SEARCH_CLICK_REPORT_COLUMN_COMPONENT = "component"; Loading Loading @@ -1375,7 +1493,7 @@ public class SearchManager * {@link #COMPONENT_NAME_KEY}. For use by the global search system only - if other providers * {@link #COMPONENT_NAME_KEY}. For use by the global search system only - if other providers * attempt to use this column, the value will be overwritten by global search. * attempt to use this column, the value will be overwritten by global search. * * * @hide an implementation detail not part of the public api * @hide */ */ public final static String SUGGEST_COLUMN_INTENT_COMPONENT_NAME = "suggest_intent_component"; public final static String SUGGEST_COLUMN_INTENT_COMPONENT_NAME = "suggest_intent_component"; /** /** Loading @@ -1400,8 +1518,6 @@ public class SearchManager * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut. * Otherwise, the shortcut id will be used to check back for an up to date suggestion using * Otherwise, the shortcut id will be used to check back for an up to date suggestion using * {@link #SUGGEST_URI_PATH_SHORTCUT}. * {@link #SUGGEST_URI_PATH_SHORTCUT}. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id"; public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id"; Loading @@ -1410,7 +1526,7 @@ public class SearchManager * cursor item's background color if it needs a non-default background color. A non-zero value * cursor item's background color if it needs a non-default background color. A non-zero value * indicates a valid background color to override the default. * indicates a valid background color to override the default. * * * @hide an implementation detail not part of the public api * @hide For internal use, not part of the public API. */ */ public final static String SUGGEST_COLUMN_BACKGROUND_COLOR = "suggest_background_color"; public final static String SUGGEST_COLUMN_BACKGROUND_COLOR = "suggest_background_color"; Loading @@ -1418,8 +1534,6 @@ public class SearchManager * Column name for suggestions cursor. <i>Optional.</i> This column is used to specify * Column name for suggestions cursor. <i>Optional.</i> This column is used to specify * that a spinner should be shown in lieu of an icon2 while the shortcut of this suggestion * that a spinner should be shown in lieu of an icon2 while the shortcut of this suggestion * is being refreshed. * is being refreshed. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = public final static String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = "suggest_spinner_while_refreshing"; "suggest_spinner_while_refreshing"; Loading @@ -1427,8 +1541,6 @@ public class SearchManager /** /** * Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion * Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion * should not be stored as a shortcut in global search. * should not be stored as a shortcut in global search. * * @hide pending reenabling of global search for third parties */ */ public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1"; public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1"; Loading Loading @@ -1475,8 +1587,6 @@ public class SearchManager * Intent action for starting a web search provider's settings activity. * Intent action for starting a web search provider's settings activity. * Web search providers should handle this intent if they have provider-specific * Web search providers should handle this intent if they have provider-specific * settings to implement. * settings to implement. * * @hide implementation detail only relevent to web search providers */ */ public final static String INTENT_ACTION_WEB_SEARCH_SETTINGS public final static String INTENT_ACTION_WEB_SEARCH_SETTINGS = "android.search.action.WEB_SEARCH_SETTINGS"; = "android.search.action.WEB_SEARCH_SETTINGS"; Loading @@ -1491,7 +1601,8 @@ public class SearchManager /** /** * Intent action broadcasted to inform that the search settings have changed in some way. * Intent action broadcasted to inform that the search settings have changed in some way. * Either searchables have been enabled or disabled. * Either searchables have been enabled or disabled, or a different web search provider * has been chosen. */ */ public final static String INTENT_ACTION_SEARCH_SETTINGS_CHANGED public final static String INTENT_ACTION_SEARCH_SETTINGS_CHANGED = "android.search.action.SETTINGS_CHANGED"; = "android.search.action.SETTINGS_CHANGED"; Loading @@ -1500,7 +1611,7 @@ public class SearchManager * If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION}, * If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION}, * the search dialog will take no action. * the search dialog will take no action. * * * @hide an implentation detail not part of the public api * @hide */ */ public final static String INTENT_ACTION_NONE = "android.search.action.ZILCH"; public final static String INTENT_ACTION_NONE = "android.search.action.ZILCH"; Loading
core/java/android/server/search/Searchables.java +8 −30 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.content.pm.ApplicationInfo; import android.os.Bundle; import android.os.Bundle; import android.util.Log; import android.util.Log; Loading Loading @@ -231,20 +230,18 @@ public class Searchables { : webSearchInfoList.get(ii - search_count); : webSearchInfoList.get(ii - search_count); ActivityInfo ai = info.activityInfo; ActivityInfo ai = info.activityInfo; // Check first to avoid duplicate entries. // Check first to avoid duplicate entries. if (newSearchablesMap.containsKey(new ComponentName(ai.packageName, ai.name))) { if (newSearchablesMap.get(new ComponentName(ai.packageName, ai.name)) == null) { continue; } SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai); SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai); if (searchable != null) { if (searchable != null) { newSearchablesList.add(searchable); newSearchablesList.add(searchable); newSearchablesMap.put(searchable.getSearchActivity(), searchable); newSearchablesMap.put(searchable.getSearchActivity(), searchable); if (searchable.shouldIncludeInGlobalSearch() if (searchable.shouldIncludeInGlobalSearch()) { && isWhitelistedForGlobalSearch(pm, searchable.getSearchActivity())) { newSearchablesInGlobalSearchList.add(searchable); newSearchablesInGlobalSearchList.add(searchable); } } } } } } } } } if (webSearchInfoList != null) { if (webSearchInfoList != null) { for (int i = 0; i < webSearchInfoList.size(); ++i) { for (int i = 0; i < webSearchInfoList.size(); ++i) { Loading Loading @@ -291,25 +288,6 @@ public class Searchables { } } } } /** * Determines whether an activity may be included in quick search box. For now this is * restricted to system installed apps. * * TODO: remove when we are ready to enable global search for third party applications. * * @param pm The package manager. * @param searchActivity The component of the search activity. * @return True if the search activity may include its search suggestions in quick search box. */ private boolean isWhitelistedForGlobalSearch(PackageManager pm, ComponentName searchActivity) { try { ActivityInfo ai = pm.getActivityInfo(searchActivity, 0); return ((ai.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0); } catch (PackageManager.NameNotFoundException e) { return false; } } /** /** * Checks if the given activity component is present in the system and if so makes it the * Checks if the given activity component is present in the system and if so makes it the * preferred activity for handling ACTION_WEB_SEARCH. * preferred activity for handling ACTION_WEB_SEARCH. Loading
core/res/res/values/attrs.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -2866,16 +2866,16 @@ when the user clicks a suggestion. <i>Optional attribute.</i> --> when the user clicks a suggestion. <i>Optional attribute.</i> --> <attr name="searchSuggestIntentData" format="string" /> <attr name="searchSuggestIntentData" format="string" /> <!-- @hide If provided, this is the minimum number of characters needed to trigger <!-- If provided, this is the minimum number of characters needed to trigger search suggestions. The default value is 0. <i>Optional attribute.</i> --> search suggestions. The default value is 0. <i>Optional attribute.</i> --> <attr name="searchSuggestThreshold" format="integer" /> <attr name="searchSuggestThreshold" format="integer" /> <!-- @hide If provided and <code>true</code>, this searchable activity will be <!-- If provided and <code>true</code>, this searchable activity will be included in any global lists of search targets. included in any global lists of search targets. The default value is <code>false</code>. <i>Optional attribute.</i>. --> The default value is <code>false</code>. <i>Optional attribute.</i>. --> <attr name="includeInGlobalSearch" format="boolean" /> <attr name="includeInGlobalSearch" format="boolean" /> <!-- @hide If provided and <code>true</code>, this searchable activity will be invoked for all <!-- If provided and <code>true</code>, this searchable activity will be invoked for all queries in a particular session. If set to <code>false</code> and the activity queries in a particular session. If set to <code>false</code> and the activity returned zero results for a query, it will not be invoked again in that session for returned zero results for a query, it will not be invoked again in that session for supersets of that zero-results query. For example, if the activity returned zero supersets of that zero-results query. For example, if the activity returned zero Loading @@ -2883,7 +2883,7 @@ The default value is <code>false</code>. <i>Optional attribute.</i>. --> The default value is <code>false</code>. <i>Optional attribute.</i>. --> <attr name="queryAfterZeroResults" format="boolean" /> <attr name="queryAfterZeroResults" format="boolean" /> <!-- @hide If provided, this string will be used to describe the searchable item in the <!-- If provided, this string will be used to describe the searchable item in the searchable items settings within system search settings. <i>Optional searchable items settings within system search settings. <i>Optional attribute.</i> --> attribute.</i> --> <attr name="searchSettingsDescription" format="string" /> <attr name="searchSettingsDescription" format="string" /> Loading
core/res/res/values/public.xml +0 −4 Original line number Original line Diff line number Diff line Loading @@ -1094,9 +1094,7 @@ <public type="attr" name="tension" id="0x0101026a" /> <public type="attr" name="tension" id="0x0101026a" /> <public type="attr" name="extraTension" id="0x0101026b" /> <public type="attr" name="extraTension" id="0x0101026b" /> <public type="attr" name="anyDensity" id="0x0101026c" /> <public type="attr" name="anyDensity" id="0x0101026c" /> <!-- {@hide} --> <public type="attr" name="searchSuggestThreshold" id="0x0101026d" /> <public type="attr" name="searchSuggestThreshold" id="0x0101026d" /> <!-- {@hide} --> <public type="attr" name="includeInGlobalSearch" id="0x0101026e" /> <public type="attr" name="includeInGlobalSearch" id="0x0101026e" /> <public type="attr" name="onClick" id="0x0101026f" /> <public type="attr" name="onClick" id="0x0101026f" /> <public type="attr" name="targetSdkVersion" id="0x01010270" /> <public type="attr" name="targetSdkVersion" id="0x01010270" /> Loading @@ -1117,7 +1115,6 @@ <public type="attr" name="backupAgent" id="0x0101027f" /> <public type="attr" name="backupAgent" id="0x0101027f" /> <public type="attr" name="allowBackup" id="0x01010280" /> <public type="attr" name="allowBackup" id="0x01010280" /> <public type="attr" name="glEsVersion" id="0x01010281" /> <public type="attr" name="glEsVersion" id="0x01010281" /> <!-- {@hide} --> <public type="attr" name="queryAfterZeroResults" id="0x01010282" /> <public type="attr" name="queryAfterZeroResults" id="0x01010282" /> <public type="attr" name="dropDownHeight" id="0x01010283" /> <public type="attr" name="dropDownHeight" id="0x01010283" /> <public type="attr" name="smallScreens" id="0x01010284" /> <public type="attr" name="smallScreens" id="0x01010284" /> Loading @@ -1126,7 +1123,6 @@ <public type="attr" name="progressBarStyleInverse" id="0x01010287" /> <public type="attr" name="progressBarStyleInverse" id="0x01010287" /> <public type="attr" name="progressBarStyleSmallInverse" id="0x01010288" /> <public type="attr" name="progressBarStyleSmallInverse" id="0x01010288" /> <public type="attr" name="progressBarStyleLargeInverse" id="0x01010289" /> <public type="attr" name="progressBarStyleLargeInverse" id="0x01010289" /> <!-- {@hide} --> <public type="attr" name="searchSettingsDescription" id="0x0101028a" /> <public type="attr" name="searchSettingsDescription" id="0x0101028a" /> <public type="attr" name="textColorPrimaryInverseDisableOnly" id="0x0101028b" /> <public type="attr" name="textColorPrimaryInverseDisableOnly" id="0x0101028b" /> <public type="attr" name="autoUrlDetect" id="0x0101028c" /> <public type="attr" name="autoUrlDetect" id="0x0101028c" /> Loading