Merge "audio: Add device definitions for Echo Reference" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-22 18:24:59 +00:00
committed by Android (Google) Code Review

View File

@@ -16,8 +16,10 @@
package android.media; package android.media;
import android.Manifest;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@@ -161,6 +163,14 @@ public final class AudioDeviceInfo {
*/ */
public static final int TYPE_BLE_SPEAKER = 27; public static final int TYPE_BLE_SPEAKER = 27;
/**
* A device type describing an Echo Canceller loopback Reference.
* This device is only used when capturing with MediaRecorder.AudioSource.ECHO_REFERENCE,
* which requires privileged permission
* {@link android.Manifest.permission#CAPTURE_AUDIO_OUTPUT}.
* @hide */
@RequiresPermission(Manifest.permission.CAPTURE_AUDIO_OUTPUT)
public static final int TYPE_ECHO_REFERENCE = 28;
/** @hide */ /** @hide */
@IntDef(flag = false, prefix = "TYPE", value = { @IntDef(flag = false, prefix = "TYPE", value = {
@@ -188,7 +198,8 @@ public final class AudioDeviceInfo {
TYPE_FM_TUNER, TYPE_FM_TUNER,
TYPE_TV_TUNER, TYPE_TV_TUNER,
TYPE_BLE_HEADSET, TYPE_BLE_HEADSET,
TYPE_BLE_SPEAKER} TYPE_BLE_SPEAKER,
TYPE_ECHO_REFERENCE}
) )
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface AudioDeviceType {} public @interface AudioDeviceType {}
@@ -211,7 +222,8 @@ public final class AudioDeviceInfo {
TYPE_LINE_DIGITAL, TYPE_LINE_DIGITAL,
TYPE_IP, TYPE_IP,
TYPE_BUS, TYPE_BUS,
TYPE_BLE_HEADSET} TYPE_BLE_HEADSET,
TYPE_ECHO_REFERENCE}
) )
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface AudioDeviceTypeIn {} public @interface AudioDeviceTypeIn {}
@@ -297,6 +309,7 @@ public final class AudioDeviceInfo {
case TYPE_BUS: case TYPE_BUS:
case TYPE_REMOTE_SUBMIX: case TYPE_REMOTE_SUBMIX:
case TYPE_BLE_HEADSET: case TYPE_BLE_HEADSET:
case TYPE_ECHO_REFERENCE:
return true; return true;
default: default:
return false; return false;
@@ -621,6 +634,8 @@ public final class AudioDeviceInfo {
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUS, TYPE_BUS); INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUS, TYPE_BUS);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX); INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLE_HEADSET, TYPE_BLE_HEADSET); INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLE_HEADSET, TYPE_BLE_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_ECHO_REFERENCE, TYPE_ECHO_REFERENCE);
// privileges mapping to output device // privileges mapping to output device
EXT_TO_INT_DEVICE_MAPPING = new SparseIntArray(); EXT_TO_INT_DEVICE_MAPPING = new SparseIntArray();
@@ -678,6 +693,9 @@ public final class AudioDeviceInfo {
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_IN_REMOTE_SUBMIX); TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_IN_REMOTE_SUBMIX);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_IN_BLE_HEADSET); EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_IN_BLE_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
TYPE_ECHO_REFERENCE, AudioSystem.DEVICE_IN_ECHO_REFERENCE);
} }
} }