Merge "Disable proximity result for hotword" into tm-qpr-dev
This commit is contained in:
@@ -86,6 +86,14 @@ public abstract class HotwordDetectionService extends Service {
|
|||||||
*/
|
*/
|
||||||
public static final int MAXIMUM_NUMBER_OF_INITIALIZATION_STATUS_CUSTOM_ERROR = 2;
|
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.
|
* Indicates that the updated status is successful.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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.HotwordDetectedResult.EXTRA_PROXIMITY_METERS;
|
||||||
import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_EXTERNAL;
|
import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_EXTERNAL;
|
||||||
import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_MICROPHONE;
|
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_SUCCESS;
|
||||||
import static android.service.voice.HotwordDetectionService.INITIALIZATION_STATUS_UNKNOWN;
|
import static android.service.voice.HotwordDetectionService.INITIALIZATION_STATUS_UNKNOWN;
|
||||||
import static android.service.voice.HotwordDetectionService.KEY_INITIALIZATION_STATUS;
|
import static android.service.voice.HotwordDetectionService.KEY_INITIALIZATION_STATUS;
|
||||||
@@ -185,7 +186,7 @@ final class HotwordDetectionConnection {
|
|||||||
final int mUser;
|
final int mUser;
|
||||||
final Context mContext;
|
final Context mContext;
|
||||||
|
|
||||||
@Nullable final AttentionManagerInternal mAttentionManagerInternal;
|
@Nullable AttentionManagerInternal mAttentionManagerInternal = null;
|
||||||
|
|
||||||
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
|
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
|
||||||
this::setProximityMeters;
|
this::setProximityMeters;
|
||||||
@@ -240,9 +241,11 @@ final class HotwordDetectionConnection {
|
|||||||
mServiceConnectionFactory = new ServiceConnectionFactory(intent, bindInstantServiceAllowed);
|
mServiceConnectionFactory = new ServiceConnectionFactory(intent, bindInstantServiceAllowed);
|
||||||
|
|
||||||
mRemoteHotwordDetectionService = mServiceConnectionFactory.createLocked();
|
mRemoteHotwordDetectionService = mServiceConnectionFactory.createLocked();
|
||||||
mAttentionManagerInternal = LocalServices.getService(AttentionManagerInternal.class);
|
if (ENABLE_PROXIMITY_RESULT) {
|
||||||
if (mAttentionManagerInternal != null) {
|
mAttentionManagerInternal = LocalServices.getService(AttentionManagerInternal.class);
|
||||||
mAttentionManagerInternal.onStartProximityUpdates(mProximityCallbackInternal);
|
if (mAttentionManagerInternal != null) {
|
||||||
|
mAttentionManagerInternal.onStartProximityUpdates(mProximityCallbackInternal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastRestartInstant = Instant.now();
|
mLastRestartInstant = Instant.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user