summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andy Hung <hunga@google.com> 2019-03-07 18:44:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-03-07 18:44:48 +0000
commit2587a5e7f1c454799d62cfbe0ba89238f32be34d (patch)
tree78e30034aa7438f264f6c36e88883eda5849389d
parent69ea91828caca955996690bda054a3bf32ed0943 (diff)
parent55f1a27a42fe4012a6b56894574fee670b08b25f (diff)
Merge "Deprecate unsupported MediaMetrics constants for AudioTrack, AudioRecord"
-rw-r--r--api/current.txt6
-rw-r--r--media/java/android/media/AudioRecord.java30
-rw-r--r--media/java/android/media/AudioTrack.java34
3 files changed, 41 insertions, 29 deletions
diff --git a/api/current.txt b/api/current.txt
index 395f5b2736ae..56762815af4f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23492,7 +23492,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";
}
@@ -23656,9 +23656,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";
}
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 28937a65ad0d..fbb629b8383a 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -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";
}
}
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 7cfe0dd4b596..a15d322cf8fd 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -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";
-
}
}