summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java43
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java2
2 files changed, 23 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index f3b9e30..185ca5b 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -52,7 +52,6 @@ public class SearchPanelView extends FrameLayout implements
private boolean mShowing;
private View mSearchTargetsContainer;
private MultiWaveView mMultiWaveView;
- private SearchManager mSearchManager;
public SearchPanelView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -67,10 +66,30 @@ public class SearchPanelView extends FrameLayout implements
}
}
- public boolean isSearchAvailable() {
+ private SearchManager mSearchManager;
+
+ public boolean isAssistantAvailable() {
return mSearchManager != null && mSearchManager.getGlobalSearchActivity() != null;
}
+ private void startAssistActivity() {
+ if (mSearchManager != null) {
+ ComponentName globalSearchActivity = mSearchManager.getGlobalSearchActivity();
+ if (globalSearchActivity != null) {
+ Intent intent = new Intent(Intent.ACTION_ASSIST);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setPackage(globalSearchActivity.getPackageName());
+ try {
+ mContext.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Slog.w(TAG, "Activity not found for " + intent.getAction());
+ }
+ } else {
+ Slog.w(TAG, "No global search activity");
+ }
+ }
+ }
+
final MultiWaveView.OnTriggerListener mMultiWaveViewListener
= new MultiWaveView.OnTriggerListener() {
@@ -90,29 +109,11 @@ public class SearchPanelView extends FrameLayout implements
final int resId = mMultiWaveView.getResourceIdForTarget(target);
switch (resId) {
case com.android.internal.R.drawable.ic_lockscreen_search:
- startGlobalSearch();
+ startAssistActivity();
break;
}
mBar.hideSearchPanel();
}
-
- private void startGlobalSearch() {
- if (mSearchManager != null) {
- ComponentName globalSearchActivity = mSearchManager.getGlobalSearchActivity();
- if (globalSearchActivity != null) {
- Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.setComponent(globalSearchActivity);
- try {
- mContext.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Slog.w(TAG, "Application not found for action " + intent.getAction());
- }
- } else {
- Slog.w(TAG, "No global search activity");
- }
- }
- }
};
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 4125704..7317c5c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -397,7 +397,7 @@ public abstract class BaseStatusBar extends SystemUI implements
break;
case MSG_OPEN_SEARCH_PANEL:
if (DEBUG) Slog.d(TAG, "opening search panel");
- if (mSearchPanelView != null && mSearchPanelView.isSearchAvailable()) {
+ if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) {
mSearchPanelView.show(true, true);
}
break;