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

Commit 55f1a27a authored by Andy Hung's avatar Andy Hung
Browse files

Deprecate unsupported MediaMetrics constants for AudioTrack, AudioRecord

Test: Audio(Record|Track)Test#testMediaMetrics
Bug: 127485355
Change-Id: I3097208a7132f81f8d96b205e28e0229917c137f
parent b54aa3d9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23493,7 +23493,7 @@ package android.media {
  public static final class AudioRecord.MetricsConstants {
    field public static final String CHANNELS = "android.media.audiorecord.channels";
    field public static final String ENCODING = "android.media.audiorecord.encoding";
    field public static final String LATENCY = "android.media.audiorecord.latency";
    field @Deprecated public static final String LATENCY = "android.media.audiorecord.latency";
    field public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
    field public static final String SOURCE = "android.media.audiorecord.source";
  }
@@ -23657,9 +23657,9 @@ package android.media {
  }
  public static final class AudioTrack.MetricsConstants {
    field public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
    field @Deprecated public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
    field public static final String CONTENTTYPE = "android.media.audiotrack.type";
    field public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
    field @Deprecated public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
    field public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
    field public static final String USAGE = "android.media.audiotrack.usage";
  }
+17 −13
Original line number Diff line number Diff line
@@ -1984,41 +1984,45 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
    {
        private MetricsConstants() {}

        // MM_PREFIX is slightly different than TAG, used to avoid cut-n-paste errors.
        private static final String MM_PREFIX = "android.media.audiorecord.";

        /**
         * Key to extract the output format being recorded
         * Key to extract the audio data encoding for this track
         * from the {@link AudioRecord#getMetrics} return value.
         * The value is a String.
         * The value is a {@code String}.
         */
        public static final String ENCODING = "android.media.audiorecord.encoding";
        public static final String ENCODING = MM_PREFIX + "encoding";

        /**
         * Key to extract the Source Type for this track
         * Key to extract the source type for this track
         * from the {@link AudioRecord#getMetrics} return value.
         * The value is a String.
         * The value is a {@code String}.
         */
        public static final String SOURCE = "android.media.audiorecord.source";
        public static final String SOURCE = MM_PREFIX + "source";

        /**
         * Key to extract the estimated latency through the recording pipeline
         * from the {@link AudioRecord#getMetrics} return value.
         * This is in units of milliseconds.
         * The value is an integer.
         * The value is an {@code int}.
         * @deprecated Not properly supported in the past.
         */
        public static final String LATENCY = "android.media.audiorecord.latency";
        @Deprecated
        public static final String LATENCY = MM_PREFIX + "latency";

        /**
         * Key to extract the sink sample rate for this record track in Hz
         * from the {@link AudioRecord#getMetrics} return value.
         * The value is an integer.
         * The value is an {@code int}.
         */
        public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
        public static final String SAMPLERATE = MM_PREFIX + "samplerate";

        /**
         * Key to extract the number of channels being recorded in this record track
         * from the {@link AudioRecord#getMetrics} return value.
         * The value is an integer.
         * The value is an {@code int}.
         */
        public static final String CHANNELS = "android.media.audiorecord.channels";

        public static final String CHANNELS = MM_PREFIX + "channels";
    }
}
+21 −13
Original line number Diff line number Diff line
@@ -3580,41 +3580,49 @@ public class AudioTrack extends PlayerBase
    {
        private MetricsConstants() {}

        // MM_PREFIX is slightly different than TAG, used to avoid cut-n-paste errors.
        private static final String MM_PREFIX = "android.media.audiotrack.";

        /**
         * Key to extract the Stream Type for this track
         * Key to extract the stream type for this track
         * from the {@link AudioTrack#getMetrics} return value.
         * The value is a String.
         * This value may not exist in API level {@link android.os.Build.VERSION_CODES#P}.
         * The value is a {@code String}.
         */
        public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
        public static final String STREAMTYPE = MM_PREFIX + "streamtype";

        /**
         * Key to extract the Content Type for this track
         * Key to extract the attribute content type for this track
         * from the {@link AudioTrack#getMetrics} return value.
         * The value is a String.
         * The value is a {@code String}.
         */
        public static final String CONTENTTYPE = "android.media.audiotrack.type";
        public static final String CONTENTTYPE = MM_PREFIX + "type";

        /**
         * Key to extract the Content Type for this track
         * Key to extract the attribute usage for this track
         * from the {@link AudioTrack#getMetrics} return value.
         * The value is a String.
         * The value is a {@code String}.
         */
        public static final String USAGE = "android.media.audiotrack.usage";
        public static final String USAGE = MM_PREFIX + "usage";

        /**
         * Key to extract the sample rate for this track in Hz
         * from the {@link AudioTrack#getMetrics} return value.
         * The value is an integer.
         * The value is an {@code int}.
         * @deprecated This does not work. Use {@link AudioTrack#getSampleRate()} instead.
         */
        @Deprecated
        public static final String SAMPLERATE = "android.media.audiorecord.samplerate";

        /**
         * Key to extract the channel mask information for this track
         * Key to extract the native channel mask information for this track
         * from the {@link AudioTrack#getMetrics} return value.
         *
         * The value is a Long integer.
         * The value is a {@code long}.
         * @deprecated This does not work. Use {@link AudioTrack#getFormat()} and read from
         * the returned format instead.
         */
        @Deprecated
        public static final String CHANNELMASK = "android.media.audiorecord.channelmask";

    }
}