summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-06-18 19:23:39 -0700
committerJim Miller <jaggies@google.com>2012-06-19 15:00:13 -0700
commit45308b1b3b1582d048845df2ee5301241e52a5cf (patch)
tree42befbc7aa70ffd9eea09fe3ba29681b84b437a4 /packages/SystemUI/src/com/android/systemui
parentc2585467107995f3130872eb7b721f3dbbcdf505 (diff)
downloadframeworks_base-45308b1b3b1582d048845df2ee5301241e52a5cf.zip
frameworks_base-45308b1b3b1582d048845df2ee5301241e52a5cf.tar.gz
frameworks_base-45308b1b3b1582d048845df2ee5301241e52a5cf.tar.bz2
Fix 6667238: allow market apps to support ACTION_ASSIST
This change allows market apps and 3rd parties to supply an activity that responds to ACTION_ASSIST (e.g. market apps). It also adds a test app to respond to the ASSIST intent and force the intent disambiguation dialog to appear. Change-Id: I5a78863c6a9546d18c66275187d178f6a1c9ee17
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java42
1 files changed, 16 insertions, 26 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index acab41e..475fb6d 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -53,7 +53,6 @@ public class SearchPanelView extends FrameLayout implements
private static final String ASSIST_ICON_METADATA_NAME =
"com.android.systemui.action_assist_icon";
private final Context mContext;
- private final SearchManager mSearchManager;
private BaseStatusBar mBar;
private StatusBarTouchProxy mStatusBarTouchProxy;
@@ -68,25 +67,13 @@ public class SearchPanelView extends FrameLayout implements
public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
- mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
- if (mSearchManager == null) {
- Slog.w(TAG, "Search manager not available");
- }
- }
-
- public boolean isAssistantAvailable() {
- return mSearchManager != null && mSearchManager.isAssistantAvailable();
- }
-
- private Intent getAssistIntent() {
- return mSearchManager != null ? mSearchManager.getAssistIntent() : null;
}
private void startAssistActivity() {
// Close Recent Apps if needed
mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
// Launch Assist
- Intent intent = getAssistIntent();
+ Intent intent = SearchManager.getAssistIntent(mContext);
if (intent == null) return;
try {
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
@@ -150,19 +137,17 @@ public class SearchPanelView extends FrameLayout implements
// TODO: fetch views
mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
- if (mSearchManager != null) {
- ComponentName component = mSearchManager.getGlobalSearchActivity();
- if (component != null) {
- if (!mGlowPadView.replaceTargetDrawablesIfPresent(component,
- ASSIST_ICON_METADATA_NAME,
- com.android.internal.R.drawable.ic_action_assist_generic)) {
- Slog.w(TAG, "Couldn't grab icon from component " + component);
- }
- } else {
- Slog.w(TAG, "No search icon specified in component " + component);
+ }
+
+ private void maybeSwapSearchIcon() {
+ Intent intent = SearchManager.getAssistIntent(mContext);
+ if (intent != null) {
+ ComponentName component = intent.getComponent();
+ if (component == null || !mGlowPadView.replaceTargetDrawablesIfPresent(component,
+ ASSIST_ICON_METADATA_NAME,
+ com.android.internal.R.drawable.ic_action_assist_generic)) {
+ if (DEBUG) Slog.v(TAG, "Couldn't grab icon for component " + component);
}
- } else {
- Slog.w(TAG, "No SearchManager");
}
}
@@ -210,6 +195,7 @@ public class SearchPanelView extends FrameLayout implements
}
mShowing = show;
if (show) {
+ maybeSwapSearchIcon();
if (getVisibility() != View.VISIBLE) {
setVisibility(View.VISIBLE);
// Don't start the animation until we've created the layer, which is done
@@ -289,4 +275,8 @@ public class SearchPanelView extends FrameLayout implements
transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
return transitioner;
}
+
+ public boolean isAssistantAvailable() {
+ return SearchManager.getAssistIntent(mContext) != null;
+ }
}