diff options
author | 2021-07-17 01:40:25 +0000 | |
---|---|---|
committer | 2021-07-17 01:40:25 +0000 | |
commit | a687e13ff31749ca2dffb85afb9d003835f1bb35 (patch) | |
tree | ff3ea989d26e5b70da574cabbf8f6119d58c8858 | |
parent | 2a4ff35621a72dd75cdf9bdf153f974a5a58726f (diff) | |
parent | 5a485126d8a9561abd3cf724cdf6076b4b5b29cc (diff) |
Merge "Reset HotwordDetectionConnection when VoiceInteractionService crashes" into sc-dev
-rw-r--r-- | services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index 6be47e171ed7..cbcbf52c2c9c 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -126,6 +126,9 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne final ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { + if (DEBUG) { + Slog.d(TAG, "onServiceConnected to " + name + " for user(" + mUser + ")"); + } synchronized (mServiceStub) { mService = IVoiceInteractionService.Stub.asInterface(service); try { @@ -137,7 +140,13 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne @Override public void onServiceDisconnected(ComponentName name) { - mService = null; + if (DEBUG) { + Slog.d(TAG, "onServiceDisconnected to " + name); + } + synchronized (mServiceStub) { + mService = null; + resetHotwordDetectionConnectionLocked(); + } } }; @@ -575,6 +584,20 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne mHotwordDetectionConnection.forceRestart(); } + void resetHotwordDetectionConnectionLocked() { + if (DEBUG) { + Slog.d(TAG, "resetHotwordDetectionConnectionLocked"); + } + if (mHotwordDetectionConnection == null) { + if (DEBUG) { + Slog.w(TAG, "reset, but no hotword detection connection"); + } + return; + } + mHotwordDetectionConnection.cancelLocked(); + mHotwordDetectionConnection = null; + } + public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args) { if (!mValid) { pw.print(" NOT VALID: "); |