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 /services/core/java/com/android/server/search | |
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 'services/core/java/com/android/server/search')
-rw-r--r-- | services/core/java/com/android/server/search/SearchManagerService.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/search/SearchManagerService.java b/services/core/java/com/android/server/search/SearchManagerService.java index dd2286f..04b2f60 100644 --- a/services/core/java/com/android/server/search/SearchManagerService.java +++ b/services/core/java/com/android/server/search/SearchManagerService.java @@ -45,6 +45,8 @@ import android.util.SparseArray; import com.android.internal.content.PackageMonitor; import com.android.internal.util.IndentingPrintWriter; +import com.android.server.LocalServices; +import com.android.server.statusbar.StatusBarManagerInternal; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -240,16 +242,24 @@ public class SearchManagerService extends ISearchManager.Stub { } @Override - public ComponentName getAssistIntent(int userHandle) { + public void launchAssist(Bundle args) { + StatusBarManagerInternal statusBarManager = + LocalServices.getService(StatusBarManagerInternal.class); + if (statusBarManager != null) { + statusBarManager.startAssist(args); + } + } + + private ComponentName getLegacyAssistComponent(int userHandle) { try { userHandle = ActivityManager.handleIncomingUser(Binder.getCallingPid(), - Binder.getCallingUid(), userHandle, true, false, "getAssistIntent", null); + Binder.getCallingUid(), userHandle, true, false, "getLegacyAssistComponent", null); IPackageManager pm = AppGlobals.getPackageManager(); Intent assistIntent = new Intent(Intent.ACTION_ASSIST); ResolveInfo info = pm.resolveIntent(assistIntent, - assistIntent.resolveTypeIfNeeded(mContext.getContentResolver()), - PackageManager.MATCH_DEFAULT_ONLY, userHandle); + assistIntent.resolveTypeIfNeeded(mContext.getContentResolver()), + PackageManager.MATCH_DEFAULT_ONLY, userHandle); if (info != null) { return new ComponentName( info.activityInfo.applicationInfo.packageName, @@ -257,16 +267,16 @@ public class SearchManagerService extends ISearchManager.Stub { } } catch (RemoteException re) { // Local call - Log.e(TAG, "RemoteException in getAssistIntent: " + re); + Log.e(TAG, "RemoteException in getLegacyAssistComponent: " + re); } catch (Exception e) { - Log.e(TAG, "Exception in getAssistIntent: " + e); + Log.e(TAG, "Exception in getLegacyAssistComponent: " + e); } return null; } @Override - public boolean launchAssistAction(String hint, int userHandle, Bundle args) { - ComponentName comp = getAssistIntent(userHandle); + public boolean launchLegacyAssist(String hint, int userHandle, Bundle args) { + ComponentName comp = getLegacyAssistComponent(userHandle); if (comp == null) { return false; } |