diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-07-06 16:18:11 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-07-08 22:26:24 +0000 |
commit | 165ce066b701ba0153000f0692bfc7032655d17d (patch) | |
tree | f557490ccff7c7dd1787fedd40540d6ccd35d5a3 /core/java/android | |
parent | 588932a53e63c0a7ee281dea22559c129b40eb99 (diff) | |
download | frameworks_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')
-rw-r--r-- | core/java/android/app/ISearchManager.aidl | 4 | ||||
-rw-r--r-- | core/java/android/app/SearchManager.java | 49 |
2 files changed, 28 insertions, 25 deletions
diff --git a/core/java/android/app/ISearchManager.aidl b/core/java/android/app/ISearchManager.aidl index 6094012..0d09e4a 100644 --- a/core/java/android/app/ISearchManager.aidl +++ b/core/java/android/app/ISearchManager.aidl @@ -30,6 +30,6 @@ interface ISearchManager { List<ResolveInfo> getGlobalSearchActivities(); ComponentName getGlobalSearchActivity(); ComponentName getWebSearchActivity(); - ComponentName getAssistIntent(int userHandle); - boolean launchAssistAction(String hint, int userHandle, in Bundle args); + void launchAssist(in Bundle args); + boolean launchLegacyAssist(String hint, int userHandle, in Bundle args); } 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; } } |