diff options
| -rw-r--r-- | core/java/android/app/Activity.java | 16 | ||||
| -rw-r--r-- | core/java/android/app/SearchManager.java | 3 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 6 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 4 |
4 files changed, 23 insertions, 6 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 3ebe89f3a487..3d04e2c64bee 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -4161,9 +4161,10 @@ 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). * - * <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> + * <p>Note: when running in a {@link Configuration#UI_MODE_TYPE_TELEVISION} or + * {@link Configuration#UI_MODE_TYPE_WATCH}, the default implementation changes to simply + * return false and you must supply your own custom implementation if you want to support + * search. * * @param searchEvent The {@link SearchEvent} that signaled this search. * @return Returns {@code true} if search launched, and {@code false} if the activity does @@ -4183,8 +4184,10 @@ public class Activity extends ContextThemeWrapper * @see #onSearchRequested(SearchEvent) */ public boolean onSearchRequested() { - if ((getResources().getConfiguration().uiMode&Configuration.UI_MODE_TYPE_MASK) - != Configuration.UI_MODE_TYPE_TELEVISION) { + final int uiMode = getResources().getConfiguration().uiMode + & Configuration.UI_MODE_TYPE_MASK; + if (uiMode != Configuration.UI_MODE_TYPE_TELEVISION + && uiMode != Configuration.UI_MODE_TYPE_WATCH) { startSearch(null, false, null, false); return true; } else { @@ -4213,6 +4216,9 @@ public class Activity extends ContextThemeWrapper * is to inject specific data such as context data, it is preferred to <i>override</i> * onSearchRequested(), so that any callers to it will benefit from the override. * + * <p>Note: when running in a {@link Configuration#UI_MODE_TYPE_WATCH}, use of this API is + * not supported. + * * @param initialQuery Any non-null non-empty string will be inserted as * pre-entered text in the search query box. * @param selectInitialQuery If true, the initial query will be preselected, which means that diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index ea990ad2924e..4e2cb646e714 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -48,6 +48,9 @@ import java.util.List; * and the {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} * {@link android.content.Intent Intent}. * + * <p> + * {@link Configuration#UI_MODE_TYPE_WATCH} does not support this system service. + * * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For more information about using the search dialog and adding search diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index f184380fd36c..e1a00b146576 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3370,7 +3370,11 @@ public abstract class Context { * Use with {@link #getSystemService(String)} to retrieve a {@link * android.app.SearchManager} for handling searches. * - * @see #getSystemService(String) + * <p> + * {@link Configuration#UI_MODE_TYPE_WATCH} does not support + * {@link android.app.SearchManager}. + * + * @see #getSystemService * @see android.app.SearchManager */ public static final String SEARCH_SERVICE = "search"; diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 03a7cd26da36..50c9d6c69ac9 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2040,6 +2040,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (getKeyguardManager().inKeyguardRestrictedInputMode()) { break; } + if ((getContext().getResources().getConfiguration().uiMode + & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH) { + break; + } if (event.isTracking() && !event.isCanceled()) { launchDefaultSearch(event); } |