Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21d778f0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I640f6470,Idca3ccc6

* changes:
  add java doc for SoundTriggerManager.Model
  fix naming discrepancy in SoundTrigger
parents e82ae9c3 e3afbbb7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3704,8 +3704,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;
+6 −5
Original line number Diff line number Diff line
@@ -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;
+4 −4
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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)
+6 −5
Original line number Diff line number Diff line
@@ -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;
Loading