Merge "Disable proximity result for hotword" into tm-qpr-dev am: 4e528edd31 am: c031c0feb2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20001718

Change-Id: I02e1d839409d3f00d1ad07f094d5b637af3904e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Daniel Kim
2022-09-26 08:43:35 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 4 deletions

View File

@@ -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.
*/

View File

@@ -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;
@@ -189,7 +190,7 @@ final class HotwordDetectionConnection {
final int mUser;
final Context mContext;
@Nullable final AttentionManagerInternal mAttentionManagerInternal;
@Nullable AttentionManagerInternal mAttentionManagerInternal = null;
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
this::setProximityMeters;
@@ -244,9 +245,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();