summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-07-17 01:40:25 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-07-17 01:40:25 +0000
commita687e13ff31749ca2dffb85afb9d003835f1bb35 (patch)
treeff3ea989d26e5b70da574cabbf8f6119d58c8858
parent2a4ff35621a72dd75cdf9bdf153f974a5a58726f (diff)
parent5a485126d8a9561abd3cf724cdf6076b4b5b29cc (diff)
Merge "Reset HotwordDetectionConnection when VoiceInteractionService crashes" into sc-dev
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java25
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: ");