summaryrefslogtreecommitdiffstats
path: root/services/voiceinteraction
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-07-01 13:41:03 -0700
committerDianne Hackborn <hackbod@google.com>2015-07-01 13:41:03 -0700
commit4e88bcd39918197c78b148afe40a08b6adcace1e (patch)
tree0a00e7b1ff8269d1fbab4edb591feaf8beb2d5a8 /services/voiceinteraction
parent80abf887a1578669d3167ea83d52a497a64ea491 (diff)
downloadframeworks_base-4e88bcd39918197c78b148afe40a08b6adcace1e.zip
frameworks_base-4e88bcd39918197c78b148afe40a08b6adcace1e.tar.gz
frameworks_base-4e88bcd39918197c78b148afe40a08b6adcace1e.tar.bz2
Fix issue #20672970: Notifications are not dismissed on hot word detection
Add new VoiceInteractionSession.closeSystemDialogs() API that closes everything except the session itself. Change-Id: If45f1e120d8ca095b6c8055b6485acb5e710820e
Diffstat (limited to 'services/voiceinteraction')
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java18
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java27
2 files changed, 40 insertions, 5 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index cde87bd..61ae1c0 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -545,6 +545,24 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
+ public void closeSystemDialogs(IBinder token) {
+ synchronized (this) {
+ if (mImpl == null) {
+ Slog.w(TAG, "closeSystemDialogs without running voice interaction service");
+ return;
+ }
+ final int callingPid = Binder.getCallingPid();
+ final int callingUid = Binder.getCallingUid();
+ final long caller = Binder.clearCallingIdentity();
+ try {
+ mImpl.closeSystemDialogsLocked(callingPid, callingUid, token);
+ } finally {
+ Binder.restoreCallingIdentity(caller);
+ }
+ }
+ }
+
+ @Override
public void finish(IBinder token) {
synchronized (this) {
if (mImpl == null) {
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index af0ddbe..e5faf4d 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -48,6 +48,8 @@ import java.io.PrintWriter;
class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConnection.Callback {
final static String TAG = "VoiceInteractionServiceManager";
+ final static String CLOSE_REASON_VOICE_INTERACTION = "voiceinteraction";
+
final boolean mValid;
final Context mContext;
@@ -68,11 +70,14 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) {
- synchronized (mLock) {
- if (mActiveSession != null && mActiveSession.mSession != null) {
- try {
- mActiveSession.mSession.closeSystemDialogs();
- } catch (RemoteException e) {
+ String reason = intent.getStringExtra("reason");
+ if (!CLOSE_REASON_VOICE_INTERACTION.equals(reason)) {
+ synchronized (mLock) {
+ if (mActiveSession != null && mActiveSession.mSession != null) {
+ try {
+ mActiveSession.mSession.closeSystemDialogs();
+ } catch (RemoteException e) {
+ }
}
}
}
@@ -196,6 +201,18 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
}
}
+ public void closeSystemDialogsLocked(int callingPid, int callingUid, IBinder token) {
+ try {
+ if (mActiveSession == null || token != mActiveSession.mToken) {
+ Slog.w(TAG, "closeSystemDialogs does not match active session");
+ return;
+ }
+ mAm.closeSystemDialogs(CLOSE_REASON_VOICE_INTERACTION);
+ } catch (RemoteException e) {
+ throw new IllegalStateException("Unexpected remote error", e);
+ }
+ }
+
public void finishLocked(IBinder token) {
if (mActiveSession == null || token != mActiveSession.mToken) {
Slog.w(TAG, "finish does not match active session");