summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/Activity.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-10-08 17:43:48 -0700
committerDianne Hackborn <hackbod@google.com>2014-10-09 10:37:19 -0700
commitfdf5b35ab46639759d6389a4e2a4d5799cb6814b (patch)
tree2d8e17d3f7323290237308f40dccd5bdd7890f46 /core/java/android/app/Activity.java
parent5e5bc4b13cd1fc657da940c14e2333d8d3b18080 (diff)
downloadframeworks_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.java18
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;
+ }
}
/**