summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/SearchManager.java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-07-06 16:18:11 -0700
committerJorim Jaggi <jjaggi@google.com>2015-07-08 22:26:24 +0000
commit165ce066b701ba0153000f0692bfc7032655d17d (patch)
treef557490ccff7c7dd1787fedd40540d6ccd35d5a3 /core/java/android/app/SearchManager.java
parent588932a53e63c0a7ee281dea22559c129b40eb99 (diff)
downloadframeworks_base-165ce066b701ba0153000f0692bfc7032655d17d.zip
frameworks_base-165ce066b701ba0153000f0692bfc7032655d17d.tar.gz
frameworks_base-165ce066b701ba0153000f0692bfc7032655d17d.tar.bz2
Fix assist for hardware long-press
Activating the assistant will now route through SysUI, so we have the logic whether to start an activity or to start a voice interaction session in one single place. Bug: 22201770 Change-Id: I0f4699533aea2a1e595ee25a844434c82f548c01
Diffstat (limited to 'core/java/android/app/SearchManager.java')
-rw-r--r--core/java/android/app/SearchManager.java49
1 files changed, 26 insertions, 23 deletions
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 45799a1..9e32164 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -946,27 +946,9 @@ public class SearchManager
*
* @hide
*/
- public Intent getAssistIntent(Context context, boolean inclContext) {
- return getAssistIntent(context, inclContext, UserHandle.myUserId());
- }
-
- /**
- * Gets an intent for launching installed assistant activity, or null if not available.
- * @return The assist intent.
- *
- * @hide
- */
- public Intent getAssistIntent(Context context, boolean inclContext, int userHandle) {
+ public Intent getAssistIntent(boolean inclContext) {
try {
- if (mService == null) {
- return null;
- }
- ComponentName comp = mService.getAssistIntent(userHandle);
- if (comp == null) {
- return null;
- }
Intent intent = new Intent(Intent.ACTION_ASSIST);
- intent.setComponent(comp);
if (inclContext) {
IActivityManager am = ActivityManagerNative.getDefault();
Bundle extras = am.getAssistContextExtras(ActivityManager.ASSIST_CONTEXT_BASIC);
@@ -982,17 +964,38 @@ public class SearchManager
}
/**
- * Launch an assist action for the current top activity.
+ * Starts the assistant.
+ *
+ * @param args the args to pass to the assistant
+ *
+ * @hide
+ */
+ public void launchAssist(Bundle args) {
+ try {
+ if (mService == null) {
+ return;
+ }
+ mService.launchAssist(args);
+ } catch (RemoteException re) {
+ Log.e(TAG, "launchAssist() failed: " + re);
+ }
+ }
+
+ /**
+ * Starts the legacy assistant (i.e. the {@link Intent#ACTION_ASSIST}).
+ *
+ * @param args the args to pass to the assistant
+ *
* @hide
*/
- public boolean launchAssistAction(String hint, int userHandle, Bundle args) {
+ public boolean launchLegacyAssist(String hint, int userHandle, Bundle args) {
try {
if (mService == null) {
return false;
}
- return mService.launchAssistAction(hint, userHandle, args);
+ return mService.launchLegacyAssist(hint, userHandle, args);
} catch (RemoteException re) {
- Log.e(TAG, "launchAssistAction() failed: " + re);
+ Log.e(TAG, "launchAssist() failed: " + re);
return false;
}
}