diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-10-08 17:43:48 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2014-10-09 10:37:19 -0700 |
commit | fdf5b35ab46639759d6389a4e2a4d5799cb6814b (patch) | |
tree | 2d8e17d3f7323290237308f40dccd5bdd7890f46 /core/java/android/app/Activity.java | |
parent | 5e5bc4b13cd1fc657da940c14e2333d8d3b18080 (diff) | |
download | frameworks_base-fdf5b35ab46639759d6389a4e2a4d5799cb6814b.zip frameworks_base-fdf5b35ab46639759d6389a4e2a4d5799cb6814b.tar.gz frameworks_base-fdf5b35ab46639759d6389a4e2a4d5799cb6814b.tar.bz2 |
Implement issue #17906468: Allow search request to fall back to global search
Change-Id: I04834b2a9f1ec4a68c6a3fed14da2f8dd93b3be7
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r-- | core/java/android/app/Activity.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 9f683e3..0e98175 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3498,14 +3498,24 @@ public class Activity extends ContextThemeWrapper * <p>You can override this function to force global search, e.g. in response to a dedicated * search key, or to block search entirely (by simply returning false). * - * @return Returns {@code true} if search launched, and {@code false} if activity blocks it. - * The default implementation always returns {@code true}. + * <p>Note: when running in a {@link Configuration#UI_MODE_TYPE_TELEVISION}, the default + * implementation changes to simply return false and you must supply your own custom + * implementation if you want to support search.</p> + * + * @return Returns {@code true} if search launched, and {@code false} if the activity does + * not respond to search. The default implementation always returns {@code true}, except + * when in {@link Configuration#UI_MODE_TYPE_TELEVISION} mode where it returns false. * * @see android.app.SearchManager */ public boolean onSearchRequested() { - startSearch(null, false, null, false); - return true; + if ((getResources().getConfiguration().uiMode&Configuration.UI_MODE_TYPE_MASK) + != Configuration.UI_MODE_TYPE_TELEVISION) { + startSearch(null, false, null, false); + return true; + } else { + return false; + } } /** |