fix naming discrepancy in SoundTrigger
adjusted SoundTrigger.AudioCapabilities constants Bug: 148853209 Test: manual bulid and test && atest SoundTriggerMiddlewareImplTest Change-Id: Idca3ccc671b90f6f31c872669400b44fbbd5b9bd
This commit is contained in:
@@ -3749,8 +3749,8 @@ package android.hardware.soundtrigger {
|
||||
public static final class SoundTrigger.ModuleProperties implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final int CAPABILITY_ECHO_CANCELLATION = 1; // 0x1
|
||||
field public static final int CAPABILITY_NOISE_SUPPRESSION = 2; // 0x2
|
||||
field public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION = 1; // 0x1
|
||||
field public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION = 2; // 0x2
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.ModuleProperties> CREATOR;
|
||||
field public final int audioCapabilities;
|
||||
field @NonNull public final String description;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.hardware.soundtrigger;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.soundtrigger.ModelParams;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.audio.common.AudioConfig;
|
||||
import android.media.soundtrigger_middleware.AudioCapabilities;
|
||||
@@ -333,20 +332,22 @@ class ConversionUtil {
|
||||
public static int aidl2apiAudioCapabilities(int aidlCapabilities) {
|
||||
int result = 0;
|
||||
if ((aidlCapabilities & AudioCapabilities.ECHO_CANCELLATION) != 0) {
|
||||
result |= SoundTrigger.ModuleProperties.CAPABILITY_ECHO_CANCELLATION;
|
||||
result |= SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_ECHO_CANCELLATION;
|
||||
}
|
||||
if ((aidlCapabilities & AudioCapabilities.NOISE_SUPPRESSION) != 0) {
|
||||
result |= SoundTrigger.ModuleProperties.CAPABILITY_NOISE_SUPPRESSION;
|
||||
result |= SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_NOISE_SUPPRESSION;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int api2aidlAudioCapabilities(int apiCapabilities) {
|
||||
int result = 0;
|
||||
if ((apiCapabilities & SoundTrigger.ModuleProperties.CAPABILITY_ECHO_CANCELLATION) != 0) {
|
||||
if ((apiCapabilities & SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_ECHO_CANCELLATION)
|
||||
!= 0) {
|
||||
result |= AudioCapabilities.ECHO_CANCELLATION;
|
||||
}
|
||||
if ((apiCapabilities & SoundTrigger.ModuleProperties.CAPABILITY_NOISE_SUPPRESSION) != 0) {
|
||||
if ((apiCapabilities & SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_NOISE_SUPPRESSION)
|
||||
!= 0) {
|
||||
result |= AudioCapabilities.NOISE_SUPPRESSION;
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -97,8 +97,8 @@ public class SoundTrigger {
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(flag = true, prefix = { "AUDIO_CAPABILITY_" }, value = {
|
||||
CAPABILITY_ECHO_CANCELLATION,
|
||||
CAPABILITY_NOISE_SUPPRESSION
|
||||
AUDIO_CAPABILITY_ECHO_CANCELLATION,
|
||||
AUDIO_CAPABILITY_NOISE_SUPPRESSION
|
||||
})
|
||||
public @interface AudioCapabilities {}
|
||||
|
||||
@@ -106,12 +106,12 @@ public class SoundTrigger {
|
||||
* If set the underlying module supports AEC.
|
||||
* Describes bit field {@link ModuleProperties#audioCapabilities}
|
||||
*/
|
||||
public static final int CAPABILITY_ECHO_CANCELLATION = 0x1;
|
||||
public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION = 0x1;
|
||||
/**
|
||||
* If set, the underlying module supports noise suppression.
|
||||
* Describes bit field {@link ModuleProperties#audioCapabilities}
|
||||
*/
|
||||
public static final int CAPABILITY_NOISE_SUPPRESSION = 0x2;
|
||||
public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION = 0x2;
|
||||
|
||||
/** Unique module ID provided by the native service */
|
||||
public final int id;
|
||||
|
||||
@@ -181,14 +181,14 @@ public class AlwaysOnHotwordDetector {
|
||||
* Returned by {@link #getSupportedAudioCapabilities()}
|
||||
*/
|
||||
public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION =
|
||||
SoundTrigger.ModuleProperties.CAPABILITY_ECHO_CANCELLATION;
|
||||
SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_ECHO_CANCELLATION;
|
||||
|
||||
/**
|
||||
* If set, the underlying module supports noise suppression.
|
||||
* Returned by {@link #getSupportedAudioCapabilities()}
|
||||
*/
|
||||
public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION =
|
||||
SoundTrigger.ModuleProperties.CAPABILITY_NOISE_SUPPRESSION;
|
||||
SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_NOISE_SUPPRESSION;
|
||||
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class SoundTriggerDetector {
|
||||
* This capability may or may not be supported by the system, and support can be queried
|
||||
* by calling {@link SoundTriggerManager#getModuleProperties()} and checking
|
||||
* {@link ModuleProperties#audioCapabilities}. The corresponding capabilities field for
|
||||
* this flag is {@link SoundTrigger.ModuleProperties#CAPABILITY_ECHO_CANCELLATION}.
|
||||
* this flag is {@link SoundTrigger.ModuleProperties#AUDIO_CAPABILITY_ECHO_CANCELLATION}.
|
||||
* If this flag is passed without the audio capability supported, there will be no audio effect
|
||||
* applied.
|
||||
*/
|
||||
@@ -125,8 +125,9 @@ public final class SoundTriggerDetector {
|
||||
* This capability may or may not be supported by the system, and support can be queried
|
||||
* by calling {@link SoundTriggerManager#getModuleProperties()} and checking
|
||||
* {@link ModuleProperties#audioCapabilities}. The corresponding capabilities field for
|
||||
* this flag is {@link SoundTrigger.ModuleProperties#CAPABILITY_NOISE_SUPPRESSION}. If this flag
|
||||
* is passed without the audio capability supported, there will be no audio effect applied.
|
||||
* this flag is {@link SoundTrigger.ModuleProperties#AUDIO_CAPABILITY_NOISE_SUPPRESSION}.
|
||||
* If this flag is passed without the audio capability supported, there will be no audio effect
|
||||
* applied.
|
||||
*/
|
||||
public static final int RECOGNITION_FLAG_ENABLE_AUDIO_NOISE_SUPPRESSION = 0x8;
|
||||
|
||||
@@ -296,10 +297,10 @@ public final class SoundTriggerDetector {
|
||||
|
||||
int audioCapabilities = 0;
|
||||
if ((recognitionFlags & RECOGNITION_FLAG_ENABLE_AUDIO_ECHO_CANCELLATION) != 0) {
|
||||
audioCapabilities |= SoundTrigger.ModuleProperties.CAPABILITY_ECHO_CANCELLATION;
|
||||
audioCapabilities |= SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_ECHO_CANCELLATION;
|
||||
}
|
||||
if ((recognitionFlags & RECOGNITION_FLAG_ENABLE_AUDIO_NOISE_SUPPRESSION) != 0) {
|
||||
audioCapabilities |= SoundTrigger.ModuleProperties.CAPABILITY_NOISE_SUPPRESSION;
|
||||
audioCapabilities |= SoundTrigger.ModuleProperties.AUDIO_CAPABILITY_NOISE_SUPPRESSION;
|
||||
}
|
||||
|
||||
int status;
|
||||
|
||||
Reference in New Issue
Block a user