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

Commit 320c1ade authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Add TestApi annotation to AudioEffect, AudioFormat, VolumeShaper" into pi-dev

parents 919f606d 3ce023b0
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -467,12 +467,49 @@ package android.location {

}

package android.media {

  public final class AudioFormat implements android.os.Parcelable {
    method public static int channelCountFromInChannelMask(int);
    method public static int channelCountFromOutChannelMask(int);
    method public static int getBytesPerSample(int);
    method public static boolean isEncodingLinearPcm(int);
  }

  public static final class VolumeShaper.Configuration.Builder {
    method public android.media.VolumeShaper.Configuration.Builder setOptionFlags(int);
  }

}

package android.media.audiofx {

  public class AudioEffect {
    method public static int byteArrayToInt(byte[]);
    method public static short byteArrayToShort(byte[]);
    method public int getParameter(byte[], byte[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, byte[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, int[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, short[]) throws java.lang.IllegalStateException;
    method public int getParameter(int[], short[]) throws java.lang.IllegalStateException;
    method public static byte[] intToByteArray(int);
    method public static boolean isEffectTypeAvailable(java.util.UUID);
    method public static boolean isError(int);
    method public int setParameter(byte[], byte[]) throws java.lang.IllegalStateException;
    method public int setParameter(int, int) throws java.lang.IllegalStateException;
    method public int setParameter(int, short) throws java.lang.IllegalStateException;
    method public int setParameter(int, byte[]) throws java.lang.IllegalStateException;
    method public int setParameter(int[], int[]) throws java.lang.IllegalStateException;
    method public int setParameter(int[], byte[]) throws java.lang.IllegalStateException;
    method public void setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener);
    method public static byte[] shortToByteArray(short);
    field public static final java.util.UUID EFFECT_TYPE_NULL;
  }

  public static abstract interface AudioEffect.OnParameterChangeListener {
    method public abstract void onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]);
  }

}

package android.net {
+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.media;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;

@@ -437,6 +438,7 @@ public final class AudioFormat implements Parcelable {
     * @param mask a combination of the CHANNEL_IN_* definitions, even CHANNEL_IN_DEFAULT
     * @return number of channels for the mask
     */
    @TestApi
    public static int channelCountFromInChannelMask(int mask) {
        return Integer.bitCount(mask);
    }
@@ -446,6 +448,7 @@ public final class AudioFormat implements Parcelable {
     * @param mask a combination of the CHANNEL_OUT_* definitions, but not CHANNEL_OUT_DEFAULT
     * @return number of channels for the mask
     */
    @TestApi
    public static int channelCountFromOutChannelMask(int mask) {
        return Integer.bitCount(mask);
    }
@@ -492,6 +495,7 @@ public final class AudioFormat implements Parcelable {
    // CHANNEL_IN_ALL is not yet defined; if added then it should match AUDIO_CHANNEL_IN_ALL

    /** @hide */
    @TestApi
    public static int getBytesPerSample(int audioFormat)
    {
        switch (audioFormat) {
@@ -562,6 +566,7 @@ public final class AudioFormat implements Parcelable {
    }

    /** @hide */
    @TestApi
    public static boolean isEncodingLinearPcm(int audioFormat)
    {
        switch (audioFormat) {
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.media;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;

@@ -843,6 +844,7 @@ public final class VolumeShaper implements AutoCloseable {
             * @return the same {@code Builder} instance.
             * @throws IllegalArgumentException if flag is not recognized.
             */
            @TestApi
            public @NonNull Builder setOptionFlags(@OptionFlag int optionFlags) {
                if ((optionFlags & ~OPTION_FLAG_PUBLIC_ALL) != 0) {
                    throw new IllegalArgumentException("invalid bits in flag: " + optionFlags);
+19 −0
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ public class AudioEffect {
     * @return true if the device implements the specified effect type, false otherwise.
     * @hide
     */
    @TestApi
    public static boolean isEffectTypeAvailable(UUID type) {
        AudioEffect.Descriptor[] desc = AudioEffect.queryEffects();
        if (desc == null) {
@@ -546,6 +547,7 @@ public class AudioEffect {
     * @throws IllegalStateException
     * @hide
     */
    @TestApi
    public int setParameter(byte[] param, byte[] value)
            throws IllegalStateException {
        checkState("setParameter()");
@@ -558,6 +560,7 @@ public class AudioEffect {
     * @see #setParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int setParameter(int param, int value) throws IllegalStateException {
        byte[] p = intToByteArray(param);
        byte[] v = intToByteArray(value);
@@ -571,6 +574,7 @@ public class AudioEffect {
     * @see #setParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int setParameter(int param, short value)
            throws IllegalStateException {
        byte[] p = intToByteArray(param);
@@ -585,6 +589,7 @@ public class AudioEffect {
     * @see #setParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int setParameter(int param, byte[] value)
            throws IllegalStateException {
        byte[] p = intToByteArray(param);
@@ -598,6 +603,7 @@ public class AudioEffect {
     * @see #setParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int setParameter(int[] param, int[] value)
            throws IllegalStateException {
        if (param.length > 2 || value.length > 2) {
@@ -649,6 +655,7 @@ public class AudioEffect {
     * @see #setParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int setParameter(int[] param, byte[] value)
            throws IllegalStateException {
        if (param.length > 2) {
@@ -677,6 +684,7 @@ public class AudioEffect {
     * @throws IllegalStateException
     * @hide
     */
    @TestApi
    public int getParameter(byte[] param, byte[] value)
            throws IllegalStateException {
        checkState("getParameter()");
@@ -690,6 +698,7 @@ public class AudioEffect {
     * @see #getParameter(byte[], byte[])
     * @hide
     */
    @TestApi
    public int getParameter(int param, byte[] value)
            throws IllegalStateException {
        byte[] p = intToByteArray(param);
@@ -705,6 +714,7 @@ public class AudioEffect {
     * In case of success, returns the number of meaningful integers in value array.
     * @hide
     */
    @TestApi
    public int getParameter(int param, int[] value)
            throws IllegalStateException {
        if (value.length > 2) {
@@ -736,6 +746,7 @@ public class AudioEffect {
     * In case of success, returns the number of meaningful short integers in value array.
     * @hide
     */
    @TestApi
    public int getParameter(int param, short[] value)
            throws IllegalStateException {
        if (value.length > 2) {
@@ -801,6 +812,7 @@ public class AudioEffect {
     * In case of success, returns the number of meaningful short integers in value array.
     * @hide
     */
    @TestApi
    public int getParameter(int[] param, short[] value)
            throws IllegalStateException {
        if (param.length > 2 || value.length > 2) {
@@ -940,6 +952,7 @@ public class AudioEffect {
     * @param listener
     * @hide
     */
    @TestApi
    public void setParameterListener(OnParameterChangeListener listener) {
        synchronized (mListenerLock) {
            mParameterChangeListener = listener;
@@ -1001,6 +1014,7 @@ public class AudioEffect {
     * when a parameter is changed in the effect engine by the controlling application.
     * @hide
     */
    @TestApi
    public interface OnParameterChangeListener {
        /**
         * Called on the listener to notify it that a parameter value has changed.
@@ -1293,6 +1307,7 @@ public class AudioEffect {
    /**
     * @hide
     */
    @TestApi
    public static boolean isError(int status) {
        return (status < 0);
    }
@@ -1300,6 +1315,7 @@ public class AudioEffect {
    /**
     * @hide
     */
    @TestApi
    public static int byteArrayToInt(byte[] valueBuf) {
        return byteArrayToInt(valueBuf, 0);

@@ -1318,6 +1334,7 @@ public class AudioEffect {
    /**
     * @hide
     */
    @TestApi
    public static byte[] intToByteArray(int value) {
        ByteBuffer converter = ByteBuffer.allocate(4);
        converter.order(ByteOrder.nativeOrder());
@@ -1328,6 +1345,7 @@ public class AudioEffect {
    /**
     * @hide
     */
    @TestApi
    public static short byteArrayToShort(byte[] valueBuf) {
        return byteArrayToShort(valueBuf, 0);
    }
@@ -1345,6 +1363,7 @@ public class AudioEffect {
    /**
     * @hide
     */
    @TestApi
    public static byte[] shortToByteArray(short value) {
        ByteBuffer converter = ByteBuffer.allocate(2);
        converter.order(ByteOrder.nativeOrder());