summaryrefslogtreecommitdiffstats
path: root/policy
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 /policy
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 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java14
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