Merge "Deprecate unsupported MediaMetrics constants for AudioTrack, AudioRecord"
diff --git a/api/current.txt b/api/current.txt
index 395f5b2..5676281 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23492,7 +23492,7 @@
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";
}
@@ -23656,9 +23656,9 @@
}
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";
}
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 28937a6..fbb629b 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -1984,41 +1984,45 @@
{
private MetricsConstants() {}
- /**
- * Key to extract the output format being recorded
- * from the {@link AudioRecord#getMetrics} return value.
- * The value is a String.
- */
- public static final String ENCODING = "android.media.audiorecord.encoding";
+ // 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 Source Type for this track
+ * 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 SOURCE = "android.media.audiorecord.source";
+ public static final String ENCODING = MM_PREFIX + "encoding";
+
+ /**
+ * Key to extract the source type for this track
+ * from the {@link AudioRecord#getMetrics} return value.
+ * The value is a {@code String}.
+ */
+ 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";
}
}
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 7cfe0dd..a15d322 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -3580,41 +3580,49 @@
{
private MetricsConstants() {}
- /**
- * Key to extract the Stream Type for this track
- * from the {@link AudioTrack#getMetrics} return value.
- * The value is a String.
- */
- public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
+ // 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 Content 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 CONTENTTYPE = "android.media.audiotrack.type";
+ 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 USAGE = "android.media.audiotrack.usage";
+ public static final String CONTENTTYPE = MM_PREFIX + "type";
+
+ /**
+ * Key to extract the attribute usage for this track
+ * from the {@link AudioTrack#getMetrics} return value.
+ * The value is a {@code String}.
+ */
+ 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";
-
}
}