summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-05-16 16:24:32 -0700
committerJim Miller <jaggies@google.com>2012-05-16 16:24:32 -0700
commit12e0c5ac1b837d85c78221108b0d70417199bbbb (patch)
treea4243ebcd0d70ed04ab39970a088e408932ab573 /packages/SystemUI/src
parentc1c140657633cc5b0ff26da1f122fab305d21e01 (diff)
downloadframeworks_base-12e0c5ac1b837d85c78221108b0d70417199bbbb.zip
frameworks_base-12e0c5ac1b837d85c78221108b0d70417199bbbb.tar.gz
frameworks_base-12e0c5ac1b837d85c78221108b0d70417199bbbb.tar.bz2
Fix 6504124: Disable assist when ACTION_ASSIST is not available
Change-Id: I2218afa7954961309d8cf2f2be0aff10826b9243
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java3
2 files changed, 32 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index 05a3bec..6b0bb87 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -23,6 +23,7 @@ import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
@@ -69,8 +70,36 @@ public class SearchPanelView extends FrameLayout implements
private SearchManager mSearchManager;
+ // This code should be the same as that used in LockScreen.java
public boolean isAssistantAvailable() {
- return mSearchManager != null && mSearchManager.getGlobalSearchActivity() != null;
+ Intent intent = getAssistIntent();
+ return intent == null ? false
+ : mContext.getPackageManager().queryIntentActivities(intent,
+ PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
+ }
+
+ private Intent getAssistIntent() {
+ Intent intent = null;
+ SearchManager searchManager = getSearchManager();
+ if (searchManager != null) {
+ ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
+ if (globalSearchActivity != null) {
+ intent = new Intent(Intent.ACTION_ASSIST);
+ intent.setPackage(globalSearchActivity.getPackageName());
+ } else {
+ Slog.w(TAG, "No global search activity");
+ }
+ } else {
+ Slog.w(TAG, "No SearchManager");
+ }
+ return intent;
+ }
+
+ private SearchManager getSearchManager() {
+ if (mSearchManager == null) {
+ mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
+ }
+ return mSearchManager;
}
private void startAssistActivity() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
index 0e6dfd5..7edeaef 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
@@ -63,7 +63,8 @@ public class DelegateViewHelper {
break;
}
if (mDelegateView != null) {
- if (mDelegateView.getVisibility() != View.VISIBLE && event.getAction() != MotionEvent.ACTION_CANCEL) {
+ if (mDelegateView.getVisibility() != View.VISIBLE
+ && event.getAction() != MotionEvent.ACTION_CANCEL) {
final boolean isVertical = (mOrientation == Surface.ROTATION_90
|| mOrientation == Surface.ROTATION_270);
final int historySize = event.getHistorySize();