OSDN Git Service

Fix assist for hardware long-press
authorJorim Jaggi <jjaggi@google.com>
Mon, 6 Jul 2015 23:18:11 +0000 (16:18 -0700)
committerJorim Jaggi <jjaggi@google.com>
Wed, 8 Jul 2015 22:26:24 +0000 (22:26 +0000)
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

17 files changed:
core/java/android/app/ISearchManager.aidl
core/java/android/app/SearchManager.java
core/java/com/android/internal/app/AssistUtils.java
core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
core/java/com/android/internal/policy/PhoneWindow.java
core/java/com/android/internal/statusbar/IStatusBar.aidl
core/java/com/android/internal/statusbar/IStatusBarService.aidl
packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
services/core/java/com/android/server/policy/PhoneWindowManager.java
services/core/java/com/android/server/search/SearchManagerService.java
services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
services/core/java/com/android/server/statusbar/StatusBarManagerService.java
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java

index 6094012..0d09e4a 100644 (file)
@@ -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);
 }
index 45799a1..9e32164 100644 (file)
@@ -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;
         }
     }
index b520384..6ba09c9 100644 (file)
@@ -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;
@@ -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);
         }
@@ -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;
     }
 
index 8cd9bab..7f54f50 100644 (file)
@@ -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.
index 0abd200..016d010 100644 (file)
@@ -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;
     }
index 0732add..c1645c3 100644 (file)
 
 package com.android.internal.statusbar;
 
-import com.android.internal.statusbar.StatusBarIcon;
+import android.os.Bundle;
 import android.service.notification.StatusBarNotification;
 
+import com.android.internal.statusbar.StatusBarIcon;
+
 /** @hide */
 oneway interface IStatusBar
 {
@@ -66,5 +68,6 @@ oneway interface IStatusBar
     void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);
 
     void showAssistDisclosure();
+    void startAssist(in Bundle args);
 }
 
index 63bfbe5..7db2cc9 100644 (file)
 
 package com.android.internal.statusbar;
 
+import android.os.Bundle;
+import android.service.notification.StatusBarNotification;
+
 import com.android.internal.statusbar.IStatusBar;
 import com.android.internal.statusbar.StatusBarIcon;
 import com.android.internal.statusbar.StatusBarIconList;
 import com.android.internal.statusbar.NotificationVisibility;
-import android.service.notification.StatusBarNotification;
 
 /** @hide */
 interface IStatusBarService
@@ -86,4 +88,6 @@ interface IStatusBarService
      *        bar caused by this app transition in millis
      */
     void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);
+
+    void startAssist(in Bundle args);
 }
index 51d0bf1..0daa5c9 100644 (file)
@@ -30,6 +30,7 @@ import android.widget.ImageView;
 import com.android.internal.app.AssistUtils;
 import com.android.internal.app.IVoiceInteractionSessionShowCallback;
 import com.android.systemui.R;
+import com.android.systemui.statusbar.BaseStatusBar;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.phone.PhoneStatusBar;
 
@@ -45,11 +46,6 @@ public class AssistManager {
     private static final String ASSIST_ICON_METADATA_NAME =
             "com.android.systemui.action_assist_icon";
 
-    private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
-            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
-            .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
-            .build();
-
     private static final long TIMEOUT_SERVICE = 2500;
     private static final long TIMEOUT_ACTIVITY = 1000;
 
@@ -58,7 +54,7 @@ public class AssistManager {
     private final AssistDisclosure mAssistDisclosure;
 
     private AssistOrbContainer mView;
-    private final PhoneStatusBar mBar;
+    private final BaseStatusBar mBar;
     private final AssistUtils mAssistUtils;
 
     private ComponentName mAssistComponent;
@@ -92,7 +88,7 @@ public class AssistManager {
         }
     };
 
-    public AssistManager(PhoneStatusBar bar, Context context) {
+    public AssistManager(BaseStatusBar bar, Context context) {
         mContext = context;
         mBar = bar;
         mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
@@ -125,7 +121,8 @@ public class AssistManager {
         }
     }
 
-    public void onGestureInvoked() {
+    public void startAssist(Bundle args) {
+        updateAssistInfo();
         if (mAssistComponent == null) {
             return;
         }
@@ -137,7 +134,7 @@ public class AssistManager {
                     ? TIMEOUT_SERVICE
                     : TIMEOUT_ACTIVITY);
         }
-        startAssist();
+        startAssistInternal(args);
     }
 
     public void hideAssist() {
@@ -168,17 +165,17 @@ public class AssistManager {
         mView.show(true /* show */, true /* animate */);
     }
 
-    private void startAssist() {
+    private void startAssistInternal(Bundle args) {
         if (mAssistComponent != null) {
             if (isAssistantService()) {
-                startVoiceInteractor();
+                startVoiceInteractor(args);
             } else {
-                startAssistActivity();
+                startAssistActivity(args);
             }
         }
     }
 
-    private void startAssistActivity() {
+    private void startAssistActivity(Bundle args) {
         if (!mBar.isDeviceProvisioned()) {
             return;
         }
@@ -191,13 +188,14 @@ public class AssistManager {
                 Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
 
         final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
-                .getAssistIntent(mContext, structureEnabled, UserHandle.USER_CURRENT);
+                .getAssistIntent(structureEnabled);
         if (intent == null) {
             return;
         }
         if (mAssistComponent != null) {
             intent.setComponent(mAssistComponent);
         }
+        intent.putExtras(args);
 
         if (structureEnabled) {
             showDisclosure();
@@ -219,8 +217,8 @@ public class AssistManager {
         }
     }
 
-    private void startVoiceInteractor() {
-        mAssistUtils.showSessionForActiveService(mShowCallback);
+    private void startVoiceInteractor(Bundle args) {
+        mAssistUtils.showSessionForActiveService(args, mShowCallback);
     }
 
     public void launchVoiceAssistFromKeyguard() {
@@ -304,8 +302,4 @@ public class AssistManager {
     public void onUserSwitched(int newUserId) {
         updateAssistInfo();
     }
-
-    public void prepareBeforeInvocation() {
-        updateAssistInfo();
-    }
 }
index b60c66f..17db471 100644 (file)
@@ -52,6 +52,7 @@ import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
 import android.os.SystemProperties;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.util.Log;
 import android.util.MutableBoolean;
@@ -62,6 +63,8 @@ import android.view.DisplayInfo;
 import android.view.SurfaceControl;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityManager;
+
+import com.android.internal.app.AssistUtils;
 import com.android.systemui.Prefs;
 import com.android.systemui.R;
 import com.android.systemui.recents.Constants;
@@ -89,7 +92,7 @@ public class SystemServicesProxy {
     AppWidgetManager mAwm;
     PackageManager mPm;
     IPackageManager mIpm;
-    SearchManager mSm;
+    AssistUtils mAssistUtils;
     WindowManager mWm;
     Display mDisplay;
     String mRecentsPackage;
@@ -114,7 +117,7 @@ public class SystemServicesProxy {
         mAwm = AppWidgetManager.getInstance(context);
         mPm = context.getPackageManager();
         mIpm = AppGlobals.getPackageManager();
-        mSm = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
+        mAssistUtils = new AssistUtils(context);
         mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
         mDisplay = mWm.getDefaultDisplay();
         mRecentsPackage = context.getPackageName();
@@ -133,10 +136,7 @@ public class SystemServicesProxy {
         mBgProtectionCanvas = new Canvas();
 
         // Resolve the assist intent
-        Intent assist = mSm.getAssistIntent(context, false);
-        if (assist != null) {
-            mAssistComponent = assist.getComponent();
-        }
+        mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.myUserId());
 
         if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
             // Create a dummy icon
@@ -580,6 +580,7 @@ public class SystemServicesProxy {
      * Returns the first Recents widget from the same package as the global assist activity.
      */
     private AppWidgetProviderInfo resolveSearchAppWidget() {
+        if (mAssistComponent == null) return null;
         List<AppWidgetProviderInfo> widgets = mAwm.getInstalledProviders(
                 AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX);
         for (AppWidgetProviderInfo info : widgets) {
index 6ad0ef9..f62dc59 100644 (file)
@@ -41,9 +41,9 @@ import android.content.res.Resources;
 import android.database.ContentObserver;
 import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
 import android.os.AsyncTask;
 import android.os.Build;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
@@ -65,7 +65,6 @@ import android.util.Slog;
 import android.util.SparseArray;
 import android.util.SparseBooleanArray;
 import android.view.Display;
-import android.view.Gravity;
 import android.view.IWindowManager;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
@@ -2125,4 +2124,11 @@ public abstract class BaseStatusBar extends SystemUI implements
             mAssistManager.showDisclosure();
         }
     }
+
+    @Override
+    public void startAssist(Bundle args) {
+        if (mAssistManager != null) {
+            mAssistManager.startAssist(args);
+        }
+    }
 }
index 0deff08..a1b07b5 100644 (file)
@@ -16,6 +16,7 @@
 
 package com.android.systemui.statusbar;
 
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
@@ -62,6 +63,7 @@ public class CommandQueue extends IStatusBar.Stub {
     private static final int MSG_APP_TRANSITION_CANCELLED   = 20 << MSG_SHIFT;
     private static final int MSG_APP_TRANSITION_STARTING    = 21 << MSG_SHIFT;
     private static final int MSG_ASSIST_DISCLOSURE          = 22 << MSG_SHIFT;
+    private static final int MSG_START_ASSIST               = 23 << MSG_SHIFT;
 
     public static final int FLAG_EXCLUDE_NONE = 0;
     public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -106,6 +108,7 @@ public class CommandQueue extends IStatusBar.Stub {
         public void appTransitionCancelled();
         public void appTransitionStarting(long startTime, long duration);
         public void showAssistDisclosure();
+        public void startAssist(Bundle args);
     }
 
     public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -283,6 +286,13 @@ public class CommandQueue extends IStatusBar.Stub {
         }
     }
 
+    public void startAssist(Bundle args) {
+        synchronized (mList) {
+            mHandler.removeMessages(MSG_START_ASSIST);
+            mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget();
+        }
+    }
+
     private final class H extends Handler {
         public void handleMessage(Message msg) {
             final int what = msg.what & MSG_MASK;
@@ -378,6 +388,9 @@ public class CommandQueue extends IStatusBar.Stub {
                 case MSG_ASSIST_DISCLOSURE:
                     mCallbacks.showAssistDisclosure();
                     break;
+                case MSG_START_ASSIST:
+                    mCallbacks.startAssist((Bundle) msg.obj);
+                    break;
             }
         }
     }
index 20f4dc7..c481be1 100644 (file)
@@ -81,7 +81,6 @@ import android.view.MotionEvent;
 import android.view.ThreadedRenderer;
 import android.view.VelocityTracker;
 import android.view.View;
-import android.view.ViewConfiguration;
 import android.view.ViewGroup.LayoutParams;
 import android.view.ViewStub;
 import android.view.WindowManager;
@@ -106,7 +105,6 @@ import com.android.systemui.EventLogConstants;
 import com.android.systemui.EventLogTags;
 import com.android.systemui.Prefs;
 import com.android.systemui.R;
-import com.android.systemui.SwipeHelper;
 import com.android.systemui.assist.AssistManager;
 import com.android.systemui.doze.DozeHost;
 import com.android.systemui.doze.DozeLog;
@@ -1045,8 +1043,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
             if (shouldDisableNavbarGestures()) {
                 return false;
             }
-            mAssistManager.prepareBeforeInvocation();
-            mAssistManager.onGestureInvoked();
+            mAssistManager.startAssist(new Bundle() /* args */);
             awakenDreams();
             if (mNavigationBarView != null) {
                 mNavigationBarView.abortCurrentGesture();
index 3393d7d..87efb8d 100644 (file)
@@ -3048,14 +3048,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         }
     }
 
-    private void launchAssistAction() {
-        launchAssistAction(null, Integer.MIN_VALUE);
-    }
-
-    private void launchAssistAction(String hint) {
-        launchAssistAction(hint, Integer.MIN_VALUE);
-    }
-
     private void launchAssistAction(String hint, int deviceId) {
         sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
         Bundle args = null;
@@ -3063,8 +3055,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             args = new Bundle();
             args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, deviceId);
         }
-        ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
-                .launchAssistAction(hint, UserHandle.myUserId(), args);
+        if ((mContext.getResources().getConfiguration().uiMode
+                & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) {
+            // On TV, use legacy handling until assistants are implemented in the proper way.
+            ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+                    .launchLegacyAssist(hint, UserHandle.myUserId(), args);
+        } else {
+            try {
+                if (hint != null) {
+                    if (args == null) {
+                        args = new Bundle();
+                    }
+                    args.putBoolean(hint, true);
+                }
+                IStatusBarService statusbar = getStatusBarService();
+                if (statusbar != null) {
+                    statusbar.startAssist(args);
+                }
+            } catch (RemoteException e) {
+                Slog.e(TAG, "RemoteException when starting assist", e);
+                // re-acquire status bar service next time it is needed.
+                mStatusBarService = null;
+            }
+        }
     }
 
     private void startActivityAsUser(Intent intent, UserHandle handle) {
index dd2286f..04b2f60 100644 (file)
@@ -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;
         }
index 4692403..130815e 100644 (file)
@@ -16,6 +16,8 @@
 
 package com.android.server.statusbar;
 
+import android.os.Bundle;
+
 import com.android.server.notification.NotificationDelegate;
 
 public interface StatusBarManagerInternal {
@@ -25,4 +27,5 @@ public interface StatusBarManagerInternal {
     void notificationLightOff();
     void showScreenPinningRequest();
     void showAssistDisclosure();
+    void startAssist(Bundle args);
 }
index 5ceb6ad..2a817ea 100644 (file)
@@ -18,6 +18,7 @@ package com.android.server.statusbar;
 
 import android.app.StatusBarManager;
 import android.os.Binder;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -165,6 +166,16 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
                 }
             }
         }
+
+        @Override
+        public void startAssist(Bundle args) {
+            if (mBar != null) {
+                try {
+                    mBar.startAssist(args);
+                } catch (RemoteException e) {
+                }
+            }
+        }
     };
 
     // ================================================================================
@@ -526,6 +537,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
         }
     }
 
+    @Override
+    public void startAssist(Bundle args) {
+        if (mBar != null) {
+            try {
+                mBar.startAssist(args);
+            } catch (RemoteException ex) {}
+        }
+    }
+
     private void enforceStatusBar() {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR,
                 "StatusBarManagerService");
index 61ae1c0..36478da 100644 (file)
@@ -761,7 +761,8 @@ public class VoiceInteractionManagerService extends SystemService {
         }
 
         @Override
-        public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback) {
+        public void showSessionForActiveService(Bundle args,
+                IVoiceInteractionSessionShowCallback showCallback) {
             enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
             synchronized (this) {
                 if (mImpl == null) {
@@ -771,7 +772,7 @@ public class VoiceInteractionManagerService extends SystemService {
                 }
                 final long caller = Binder.clearCallingIdentity();
                 try {
-                    mImpl.showSessionLocked(new Bundle() /* sessionArgs */,
+                    mImpl.showSessionLocked(args,
                             VoiceInteractionSession.SHOW_SOURCE_ASSIST_GESTURE
                                     | VoiceInteractionSession.SHOW_WITH_ASSIST
                                     | VoiceInteractionSession.SHOW_WITH_SCREENSHOT,