summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Kim <danieljkim@google.com> 2022-09-26 08:12:46 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-09-26 08:12:46 +0000
commit4e528edd314d699697cdd594ecf83d600da00ca2 (patch)
tree96c99c3adfe8970aafacb85773697f57f2a315a4
parent36f16a2fb8e4898019fd62d56f8c2d82c65f4bf1 (diff)
parent4dd69f2ebbdd5d9a2d11300fb8afa46cb22660fb (diff)
Merge "Disable proximity result for hotword" into tm-qpr-dev
-rw-r--r--core/java/android/service/voice/HotwordDetectionService.java8
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java11
2 files changed, 15 insertions, 4 deletions
diff --git a/core/java/android/service/voice/HotwordDetectionService.java b/core/java/android/service/voice/HotwordDetectionService.java
index d755d3877275..eac3bee8e790 100644
--- a/core/java/android/service/voice/HotwordDetectionService.java
+++ b/core/java/android/service/voice/HotwordDetectionService.java
@@ -87,6 +87,14 @@ public abstract class HotwordDetectionService extends Service {
public static final int MAXIMUM_NUMBER_OF_INITIALIZATION_STATUS_CUSTOM_ERROR = 2;
/**
+ * Feature flag for Attention Service.
+ *
+ * TODO(b/247920386): Add TestApi annotation
+ * @hide
+ */
+ public static final boolean ENABLE_PROXIMITY_RESULT = false;
+
+ /**
* Indicates that the updated status is successful.
*/
public static final int INITIALIZATION_STATUS_SUCCESS = 0;
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
index bde9c3dfd641..a6e1a3256cb6 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
@@ -22,6 +22,7 @@ import static android.service.attention.AttentionService.PROXIMITY_UNKNOWN;
import static android.service.voice.HotwordDetectedResult.EXTRA_PROXIMITY_METERS;
import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_EXTERNAL;
import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_MICROPHONE;
+import static android.service.voice.HotwordDetectionService.ENABLE_PROXIMITY_RESULT;
import static android.service.voice.HotwordDetectionService.INITIALIZATION_STATUS_SUCCESS;
import static android.service.voice.HotwordDetectionService.INITIALIZATION_STATUS_UNKNOWN;
import static android.service.voice.HotwordDetectionService.KEY_INITIALIZATION_STATUS;
@@ -185,7 +186,7 @@ final class HotwordDetectionConnection {
final int mUser;
final Context mContext;
- @Nullable final AttentionManagerInternal mAttentionManagerInternal;
+ @Nullable AttentionManagerInternal mAttentionManagerInternal = null;
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
this::setProximityMeters;
@@ -240,9 +241,11 @@ final class HotwordDetectionConnection {
mServiceConnectionFactory = new ServiceConnectionFactory(intent, bindInstantServiceAllowed);
mRemoteHotwordDetectionService = mServiceConnectionFactory.createLocked();
- mAttentionManagerInternal = LocalServices.getService(AttentionManagerInternal.class);
- if (mAttentionManagerInternal != null) {
- mAttentionManagerInternal.onStartProximityUpdates(mProximityCallbackInternal);
+ if (ENABLE_PROXIMITY_RESULT) {
+ mAttentionManagerInternal = LocalServices.getService(AttentionManagerInternal.class);
+ if (mAttentionManagerInternal != null) {
+ mAttentionManagerInternal.onStartProximityUpdates(mProximityCallbackInternal);
+ }
}
mLastRestartInstant = Instant.now();