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

Commit 2e7dd4bf authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Unhide audio virtualizer capability query methods

Unhide the new method to query the Virtualizer effect implementation
 about its capabilities in terms of input, device support, and
 virtual speaker angles.

Change-Id: I4478f7837efe8c9d52978244a3402c7f8590e585
parent e7d1f16f
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -13964,6 +13964,29 @@ package android.media {
    method public android.media.AudioAttributes.Builder setUsage(int);
  }
  public class AudioDevice {
    field public static final int DEVICE_TYPE_AUX_LINE = 19; // 0x13
    field public static final int DEVICE_TYPE_BLUETOOTH_A2DP = 8; // 0x8
    field public static final int DEVICE_TYPE_BLUETOOTH_SCO = 7; // 0x7
    field public static final int DEVICE_TYPE_BUILTIN_EARPIECE = 1; // 0x1
    field public static final int DEVICE_TYPE_BUILTIN_MIC = 15; // 0xf
    field public static final int DEVICE_TYPE_BUILTIN_SPEAKER = 2; // 0x2
    field public static final int DEVICE_TYPE_DOCK = 13; // 0xd
    field public static final int DEVICE_TYPE_FM = 14; // 0xe
    field public static final int DEVICE_TYPE_FM_TUNER = 16; // 0x10
    field public static final int DEVICE_TYPE_HDMI = 9; // 0x9
    field public static final int DEVICE_TYPE_HDMI_ARC = 10; // 0xa
    field public static final int DEVICE_TYPE_LINE_ANALOG = 5; // 0x5
    field public static final int DEVICE_TYPE_LINE_DIGITAL = 6; // 0x6
    field public static final int DEVICE_TYPE_TELEPHONY = 18; // 0x12
    field public static final int DEVICE_TYPE_TV_TUNER = 17; // 0x11
    field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0
    field public static final int DEVICE_TYPE_USB_ACCESSORY = 12; // 0xc
    field public static final int DEVICE_TYPE_USB_DEVICE = 11; // 0xb
    field public static final int DEVICE_TYPE_WIRED_HEADPHONES = 4; // 0x4
    field public static final int DEVICE_TYPE_WIRED_HEADSET = 3; // 0x3
  }
  public class AudioFormat {
    field public static final deprecated int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1
    field public static final deprecated int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0
@@ -15896,8 +15919,11 @@ package android.media.audiofx {
  public class Virtualizer extends android.media.audiofx.AudioEffect {
    ctor public Virtualizer(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
    method public boolean canVirtualize(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
    method public boolean forceVirtualizationMode(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
    method public android.media.audiofx.Virtualizer.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
    method public short getRoundedStrength() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
    method public boolean getSpeakerAngles(int, int, int[]) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
    method public boolean getStrengthSupported();
    method public void setParameterListener(android.media.audiofx.Virtualizer.OnParameterChangeListener);
    method public void setProperties(android.media.audiofx.Virtualizer.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+85 −2
Original line number Diff line number Diff line
@@ -19,30 +19,91 @@ package android.media;
import android.util.SparseIntArray;

/**
 * @hide
 * CANDIDATE FOR PUBLIC API
 * Class to provide information about the audio devices.
 */
public class AudioDevice {

    /**
     * A device type associated with an unknown or uninitialized device.
     */
    public static final int DEVICE_TYPE_UNKNOWN          = 0;
    /**
     * A device type describing the attached earphone speaker.
     */
    public static final int DEVICE_TYPE_BUILTIN_EARPIECE = 1;
    /**
     * A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built
     * in a device.
     */
    public static final int DEVICE_TYPE_BUILTIN_SPEAKER  = 2;
    /**
     * A device type describing a headset, which is the combination of a headphones and microphone.
     */
    public static final int DEVICE_TYPE_WIRED_HEADSET    = 3;
    /**
     * A device type describing a pair of wired headphones .
     */
    public static final int DEVICE_TYPE_WIRED_HEADPHONES = 4;
    /**
     * A device type describing an analog line-level connection.
     */
    public static final int DEVICE_TYPE_LINE_ANALOG      = 5;
    /**
     * A device type describing a digital line connection (e.g. SPDIF).
     */
    public static final int DEVICE_TYPE_LINE_DIGITAL     = 6;
    /**
     * A device type describing a Bluetooth device typically used for telephony .
     */
    public static final int DEVICE_TYPE_BLUETOOTH_SCO    = 7;
    /**
     * A device type describing a Bluetooth device supporting the A2DP profile.
     */
    public static final int DEVICE_TYPE_BLUETOOTH_A2DP   = 8;
    /**
     * A device type describing an HDMI connection .
     */
    public static final int DEVICE_TYPE_HDMI             = 9;
    /**
     * A device type describing the Audio Return Channel of an HDMI connection.
     */
    public static final int DEVICE_TYPE_HDMI_ARC         = 10;
    /**
     * A device type describing a USB audio device.
     */
    public static final int DEVICE_TYPE_USB_DEVICE       = 11;
    /**
     * A device type describing a USB audio device in accessory mode.
     */
    public static final int DEVICE_TYPE_USB_ACCESSORY    = 12;
    /**
     * A device type describing the audio device associated with a dock.
     */
    public static final int DEVICE_TYPE_DOCK             = 13;
    /**
     * A device type associated with the transmission of audio signals over FM.
     */
    public static final int DEVICE_TYPE_FM               = 14;
    /**
     * A device type describing the microphone(s) built in a device.
     */
    public static final int DEVICE_TYPE_BUILTIN_MIC      = 15;
    /**
     * A device type for accessing the audio content transmitted over FM.
     */
    public static final int DEVICE_TYPE_FM_TUNER         = 16;
    /**
     * A device type for accessing the audio content transmitted over the TV tuner system.
     */
    public static final int DEVICE_TYPE_TV_TUNER         = 17;
    /**
     * A device type describing the transmission of audio signals over the telephony network.
     */
    public static final int DEVICE_TYPE_TELEPHONY        = 18;
    /**
     * A device type describing the auxiliary line-level connectors.
     */
    public static final int DEVICE_TYPE_AUX_LINE         = 19;

    AudioDevicePortConfig mConfig;

@@ -50,18 +111,38 @@ public class AudioDevice {
        mConfig = new AudioDevicePortConfig(config);
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * @return
     */
    public boolean isInputDevice() {
        return (mConfig.port().role() == AudioPort.ROLE_SOURCE);
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * @return
     */
    public boolean isOutputDevice() {
        return (mConfig.port().role() == AudioPort.ROLE_SINK);
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * @return
     */
    public int getDeviceType() {
        return INT_TO_EXT_DEVICE_MAPPING.get(mConfig.port().type(), DEVICE_TYPE_UNKNOWN);
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * @return
     */
    public String getAddress() {
        return mConfig.port().address();
    }
@@ -102,6 +183,7 @@ public class AudioDevice {
        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI_ARC, DEVICE_TYPE_HDMI_ARC);
        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPDIF, DEVICE_TYPE_LINE_DIGITAL);
        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_FM, DEVICE_TYPE_FM);
        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_AUX_LINE, DEVICE_TYPE_AUX_LINE);

        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUILTIN_MIC, DEVICE_TYPE_BUILTIN_MIC);
        INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET, DEVICE_TYPE_BLUETOOTH_SCO);
@@ -143,6 +225,7 @@ public class AudioDevice {
        EXT_TO_INT_DEVICE_MAPPING.put(DEVICE_TYPE_FM_TUNER, AudioSystem.DEVICE_IN_FM_TUNER);
        EXT_TO_INT_DEVICE_MAPPING.put(DEVICE_TYPE_TV_TUNER, AudioSystem.DEVICE_IN_TV_TUNER);
        EXT_TO_INT_DEVICE_MAPPING.put(DEVICE_TYPE_TELEPHONY, AudioSystem.DEVICE_OUT_TELEPHONY_TX);
        EXT_TO_INT_DEVICE_MAPPING.put(DEVICE_TYPE_AUX_LINE, AudioSystem.DEVICE_OUT_AUX_LINE);
    }
}
+0 −6
Original line number Diff line number Diff line
@@ -248,8 +248,6 @@ public class Virtualizer extends AudioEffect {
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * Checks if the combination of a channel mask and device type is supported by this virtualizer.
     * Some virtualizer implementations may only support binaural processing (i.e. only support
     * headphone output), some may support transaural processing (i.e. for speaker output) for the
@@ -276,8 +274,6 @@ public class Virtualizer extends AudioEffect {
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * Queries the virtual speaker angles (azimuth and elevation) for a combination of a channel
     * mask and device type.
     * If the virtualization configuration (mask and device) is supported (see
@@ -318,8 +314,6 @@ public class Virtualizer extends AudioEffect {
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * Forces the virtualizer effect to use the processing mode used for the given device type.
     * The effect must be enabled for the forced mode to be applied.
     * @param deviceType one of the device types defined in {@link AudioDevice}.