Loading core/java/android/app/ISearchManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -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); } core/java/android/app/SearchManager.java +26 −23 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } } Loading core/java/com/android/internal/app/AssistUtils.java +13 −6 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ import android.app.SearchManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading @@ -42,9 +45,10 @@ public class AssistUtils { ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); } public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback) { public void showSessionForActiveService(Bundle args, IVoiceInteractionSessionShowCallback showCallback) { try { mVoiceInteractionManagerService.showSessionForActiveService(showCallback); mVoiceInteractionManagerService.showSessionForActiveService(args, showCallback); } catch (RemoteException e) { Log.w(TAG, "Failed to call showSessionForActiveService", e); } Loading Loading @@ -118,11 +122,14 @@ public class AssistUtils { } Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, false, userId); if (intent != null) { return intent.getComponent(); .getAssistIntent(false); PackageManager pm = mContext.getPackageManager(); ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY, userId); if (info != null) { return new ComponentName(info.activityInfo.applicationInfo.packageName, info.activityInfo.name); } return null; } Loading core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -93,9 +93,11 @@ interface IVoiceInteractionManagerService { * Shows the session for the currently active service. Used to start a new session from system * affordances. * * @param args the bundle to pass as arguments to the voice interaction session * @param showCallback callback to be notified when the session was shown */ void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback); void showSessionForActiveService(in Bundle args, IVoiceInteractionSessionShowCallback showCallback); /** * Hides the session from the active service, if it is showing. Loading core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -4419,7 +4419,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { Bundle args = new Bundle(); args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, event.getDeviceId()); return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)) .launchAssistAction(null, UserHandle.myUserId(), args); .launchLegacyAssist(null, UserHandle.myUserId(), args); } return result; } Loading Loading
core/java/android/app/ISearchManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -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); }
core/java/android/app/SearchManager.java +26 −23 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } } Loading
core/java/com/android/internal/app/AssistUtils.java +13 −6 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ import android.app.SearchManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading @@ -42,9 +45,10 @@ public class AssistUtils { ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); } public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback) { public void showSessionForActiveService(Bundle args, IVoiceInteractionSessionShowCallback showCallback) { try { mVoiceInteractionManagerService.showSessionForActiveService(showCallback); mVoiceInteractionManagerService.showSessionForActiveService(args, showCallback); } catch (RemoteException e) { Log.w(TAG, "Failed to call showSessionForActiveService", e); } Loading Loading @@ -118,11 +122,14 @@ public class AssistUtils { } Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, false, userId); if (intent != null) { return intent.getComponent(); .getAssistIntent(false); PackageManager pm = mContext.getPackageManager(); ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY, userId); if (info != null) { return new ComponentName(info.activityInfo.applicationInfo.packageName, info.activityInfo.name); } return null; } Loading
core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -93,9 +93,11 @@ interface IVoiceInteractionManagerService { * Shows the session for the currently active service. Used to start a new session from system * affordances. * * @param args the bundle to pass as arguments to the voice interaction session * @param showCallback callback to be notified when the session was shown */ void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback); void showSessionForActiveService(in Bundle args, IVoiceInteractionSessionShowCallback showCallback); /** * Hides the session from the active service, if it is showing. Loading
core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -4419,7 +4419,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { Bundle args = new Bundle(); args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, event.getDeviceId()); return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)) .launchAssistAction(null, UserHandle.myUserId(), args); .launchLegacyAssist(null, UserHandle.myUserId(), args); } return result; } Loading