diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-10-09 19:00:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-09 19:00:12 +0000 |
commit | 6166a824b2ea7b7918f54769005ab691e15f77f7 (patch) | |
tree | 9a57ef2a90bd1b093bd5770ab308d42d6bb09dbb /policy | |
parent | 01f1c5c85476b7eee3155ac1a1f6b570582ecd6c (diff) | |
parent | fdf5b35ab46639759d6389a4e2a4d5799cb6814b (diff) | |
download | frameworks_base-6166a824b2ea7b7918f54769005ab691e15f77f7.zip frameworks_base-6166a824b2ea7b7918f54769005ab691e15f77f7.tar.gz frameworks_base-6166a824b2ea7b7918f54769005ab691e15f77f7.tar.bz2 |
Merge "Implement issue #17906468: Allow search request to fall back to global search" into lmp-dev
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index e9a114a..9c81f0a 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -22,6 +22,8 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.WindowManager.LayoutParams.*; +import android.app.SearchManager; +import android.os.UserHandle; import com.android.internal.R; import com.android.internal.view.RootViewSurfaceTaker; import com.android.internal.view.StandaloneActionMode; @@ -4004,13 +4006,21 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { * @return true if search window opened */ private boolean launchDefaultSearch() { + boolean result; final Callback cb = getCallback(); if (cb == null || isDestroyed()) { - return false; + result = false; } else { sendCloseSystemWindows("search"); - return cb.onSearchRequested(); + result = cb.onSearchRequested(); + } + if (!result && (getContext().getResources().getConfiguration().uiMode + & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) { + // On TVs, if the app doesn't implement search, we want to launch assist. + return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)) + .launchAssistAction(0, null, UserHandle.myUserId()); } + return result; } @Override |