summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl5
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java6
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java27
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java2
6 files changed, 45 insertions, 7 deletions
diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
index 644adb6c6df4..a2bd700c5dd4 100644
--- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
+++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
@@ -97,6 +97,11 @@ interface IVoiceInteractionManagerService {
void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback);
/**
+ * Hides the session from the active service, if it is showing.
+ */
+ void hideCurrentSession();
+
+ /**
* Notifies the active service that a launch was requested from the Keyguard. This will only
* be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 79af706dc460..f129288325f5 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -124,6 +124,14 @@ public class AssistManager {
startAssist();
}
+ public void hideAssist() {
+ try {
+ mVoiceInteractionManagerService.hideCurrentSession();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to call hideCurrentSession", e);
+ }
+ }
+
private WindowManager.LayoutParams getLayoutParams() {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 6fb4b48910fc..f34dd692e50c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -92,6 +92,7 @@ import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SwipeHelper;
import com.android.systemui.SystemUI;
+import com.android.systemui.assist.AssistManager;
import com.android.systemui.recents.Recents;
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.phone.NavigationBarView;
@@ -240,6 +241,8 @@ public abstract class BaseStatusBar extends SystemUI implements
private NotificationClicker mNotificationClicker = new NotificationClicker();
+ protected AssistManager mAssistManager;
+
@Override // NotificationData.Environment
public boolean isDeviceProvisioned() {
return mDeviceProvisioned;
@@ -1626,6 +1629,7 @@ public abstract class BaseStatusBar extends SystemUI implements
// TODO: Dismiss Keyguard.
}
if (intent.isActivity()) {
+ mAssistManager.hideAssist();
overrideActivityPendingAppTransition(keyguardShowing
&& !afterKeyguardGone);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 347ab19ecd14..569b9188d17e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -344,8 +344,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private int mNavigationIconHints = 0;
private HandlerThread mHandlerThread;
- private AssistManager mAssistManager;
-
// ensure quick settings is disabled until the current user makes it through the setup wizard
private boolean mUserSetup = false;
private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) {
@@ -2753,6 +2751,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
Runnable runnable = new Runnable() {
public void run() {
+ mAssistManager.hideAssist();
intent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
int result = ActivityManager.START_CANCELED;
@@ -2781,7 +2780,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
};
- executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShade, afterKeyguardGone);
+ executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShade,
+ afterKeyguardGone);
}
public void executeRunnableDismissingKeyguard(final Runnable runnable,
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 8834497f2f9b..4cdf254ad9c2 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -49,6 +49,7 @@ import android.service.voice.VoiceInteractionServiceInfo;
import android.service.voice.VoiceInteractionSession;
import android.speech.RecognitionService;
import android.text.TextUtils;
+import android.util.Log;
import android.util.Slog;
import com.android.internal.app.IVoiceInteractionManagerService;
@@ -475,11 +476,9 @@ public class VoiceInteractionManagerService extends SystemService {
Slog.w(TAG, "hideSessionFromSession without running voice interaction service");
return false;
}
- final int callingPid = Binder.getCallingPid();
- final int callingUid = Binder.getCallingUid();
final long caller = Binder.clearCallingIdentity();
try {
- return mImpl.hideSessionLocked(callingPid, callingUid);
+ return mImpl.hideSessionLocked();
} finally {
Binder.restoreCallingIdentity(caller);
}
@@ -744,6 +743,28 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
+ public void hideCurrentSession() throws RemoteException {
+ enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
+ synchronized (this) {
+ if (mImpl == null) {
+ return;
+ }
+ final long caller = Binder.clearCallingIdentity();
+ try {
+ if (mImpl.mActiveSession != null && mImpl.mActiveSession.mSession != null) {
+ try {
+ mImpl.mActiveSession.mSession.closeSystemDialogs();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to call closeSystemDialogs", e);
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(caller);
+ }
+ }
+ }
+
+ @Override
public void launchVoiceAssistFromKeyguard() {
enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index d8569bc8a204..acd484dac0c8 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -144,7 +144,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
return mActiveSession.showLocked(args, flags, showCallback);
}
- public boolean hideSessionLocked(int callingPid, int callingUid) {
+ public boolean hideSessionLocked() {
if (mActiveSession != null) {
return mActiveSession.hideLocked();
}