diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-10-09 19:15:32 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-09 19:15:32 +0000 |
commit | 5ffb591b061d4044043fd342b0a5b0063de8c318 (patch) | |
tree | 5dbad80892ad94d9538db1751342799c62abc81b /policy | |
parent | 3601aeb6d46d5d8702a12776e39b096092ecf45b (diff) | |
parent | 6166a824b2ea7b7918f54769005ab691e15f77f7 (diff) | |
download | frameworks_base-5ffb591b061d4044043fd342b0a5b0063de8c318.zip frameworks_base-5ffb591b061d4044043fd342b0a5b0063de8c318.tar.gz frameworks_base-5ffb591b061d4044043fd342b0a5b0063de8c318.tar.bz2 |
am 6166a824: Merge "Implement issue #17906468: Allow search request to fall back to global search" into lmp-dev
* commit '6166a824b2ea7b7918f54769005ab691e15f77f7':
Implement issue #17906468: Allow search request to fall back to global search
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 |