Merge "Rework getMetrics() api per API council" into oc-dev
diff --git a/api/current.txt b/api/current.txt
index 98db4f7..5697b39 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -21906,7 +21906,7 @@
method public deprecated java.nio.ByteBuffer[] getInputBuffers();
method public final android.media.MediaFormat getInputFormat();
method public android.media.Image getInputImage(int);
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public final java.lang.String getName();
method public java.nio.ByteBuffer getOutputBuffer(int);
method public deprecated java.nio.ByteBuffer[] getOutputBuffers();
@@ -22004,6 +22004,19 @@
method public void set(int, int);
}
+ public static final class MediaCodec.MetricsConstants {
+ field public static final java.lang.String CODEC = "android.media.mediacodec.codec";
+ field public static final java.lang.String ENCODER = "android.media.mediacodec.encoder";
+ field public static final java.lang.String HEIGHT = "android.media.mediacodec.height";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediacodec.mime";
+ field public static final java.lang.String MODE = "android.media.mediacodec.mode";
+ field public static final java.lang.String MODE_AUDIO = "audio";
+ field public static final java.lang.String MODE_VIDEO = "video";
+ field public static final java.lang.String ROTATION = "android.media.mediacodec.rotation";
+ field public static final java.lang.String SECURE = "android.media.mediacodec.secure";
+ field public static final java.lang.String WIDTH = "android.media.mediacodec.width";
+ }
+
public static abstract interface MediaCodec.OnFrameRenderedListener {
method public abstract void onFrameRendered(android.media.MediaCodec, long, long);
}
@@ -22459,7 +22472,7 @@
method public long getCachedDuration();
method public android.media.MediaExtractor.CasInfo getCasInfo(int);
method public android.media.DrmInitData getDrmInitData();
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public java.util.Map<java.util.UUID, byte[]> getPsshInfo();
method public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo);
method public int getSampleFlags();
@@ -22494,6 +22507,12 @@
method public int getSystemId();
}
+ public static final class MediaExtractor.MetricsConstants {
+ field public static final java.lang.String FORMAT = "android.media.mediaextractor.fmt";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediaextractor.mime";
+ field public static final java.lang.String TRACKS = "android.media.mediaextractor.ntrk";
+ }
+
public final class MediaFormat {
ctor public MediaFormat();
method public final boolean containsKey(java.lang.String);
@@ -22719,69 +22738,6 @@
field public static final int OPTION_PREVIOUS_SYNC = 0; // 0x0
}
- public final class MediaMetricsSet {
- method public double getDouble(java.lang.String, double);
- method public int getInt(java.lang.String, int);
- method public long getLong(java.lang.String, long);
- method public java.lang.String getString(java.lang.String, java.lang.String);
- method public boolean isEmpty();
- method public java.util.Set<java.lang.String> keySet();
- method public int size();
- }
-
- public static final class MediaMetricsSet.MediaCodec {
- field public static final java.lang.String KEY_CODEC = "android.media.mediacodec.codec";
- field public static final java.lang.String KEY_ENCODER = "android.media.mediacodec.encoder";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediacodec.height";
- field public static final java.lang.String KEY_MIME = "android.media.mediacodec.mime";
- field public static final java.lang.String KEY_MODE = "android.media.mediacodec.mode";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediacodec.rotation";
- field public static final java.lang.String KEY_SECURE = "android.media.mediacodec.secure";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediacodec.width";
- field public static final java.lang.String MODE_AUDIO = "audio";
- field public static final java.lang.String MODE_VIDEO = "video";
- }
-
- public static final class MediaMetricsSet.MediaExtractor {
- field public static final java.lang.String KEY_FORMAT = "android.media.mediaextractor.fmt";
- field public static final java.lang.String KEY_MIME = "android.media.mediaextractor.mime";
- field public static final java.lang.String KEY_TRACKS = "android.media.mediaextractor.ntrk";
- }
-
- public static final class MediaMetricsSet.MediaPlayer {
- field public static final java.lang.String KEY_CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
- field public static final java.lang.String KEY_CODEC_VIDEO = "android.media.mediaplayer.video.codec";
- field public static final java.lang.String KEY_DURATION = "android.media.mediaplayer.durationMs";
- field public static final java.lang.String KEY_ERRORS = "android.media.mediaplayer.err";
- field public static final java.lang.String KEY_ERROR_CODE = "android.media.mediaplayer.errcode";
- field public static final java.lang.String KEY_FRAMES = "android.media.mediaplayer.frames";
- field public static final java.lang.String KEY_FRAMES_DROPPED = "android.media.mediaplayer.dropped";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediaplayer.height";
- field public static final java.lang.String KEY_MIME_AUDIO = "android.media.mediaplayer.audio.mime";
- field public static final java.lang.String KEY_MIME_VIDEO = "android.media.mediaplayer.video.mime";
- field public static final java.lang.String KEY_PLAYING = "android.media.mediaplayer.playingMs";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediaplayer.width";
- }
-
- public static final class MediaMetricsSet.MediaRecorder {
- field public static final java.lang.String KEY_AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
- field public static final java.lang.String KEY_AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
- field public static final java.lang.String KEY_AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
- field public static final java.lang.String KEY_AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
- field public static final java.lang.String KEY_CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
- field public static final java.lang.String KEY_CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
- field public static final java.lang.String KEY_FRAMERATE = "android.media.mediarecorder.frame-rate";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediarecorder.height";
- field public static final java.lang.String KEY_MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediarecorder.rotation";
- field public static final java.lang.String KEY_VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
- field public static final java.lang.String KEY_VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
- field public static final java.lang.String KEY_VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
- field public static final java.lang.String KEY_VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
- field public static final java.lang.String KEY_VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediarecorder.width";
- }
-
public final class MediaMuxer {
ctor public MediaMuxer(java.lang.String, int) throws java.io.IOException;
ctor public MediaMuxer(java.io.FileDescriptor, int) throws java.io.IOException;
@@ -22820,7 +22776,7 @@
method public java.lang.String getDrmPropertyString(java.lang.String) throws android.media.MediaPlayer.NoDrmSchemeException;
method public int getDuration();
method public android.media.MediaDrm.KeyRequest getKeyRequest(byte[], java.lang.String, int, java.util.Map<java.lang.String, java.lang.String>) throws android.media.MediaPlayer.NoDrmSchemeException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.media.PlaybackParams getPlaybackParams();
method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
method public android.media.SyncParams getSyncParams();
@@ -22915,6 +22871,21 @@
method public java.util.UUID[] getSupportedSchemes();
}
+ public static final class MediaPlayer.MetricsConstants {
+ field public static final java.lang.String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
+ field public static final java.lang.String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
+ field public static final java.lang.String DURATION = "android.media.mediaplayer.durationMs";
+ field public static final java.lang.String ERRORS = "android.media.mediaplayer.err";
+ field public static final java.lang.String ERROR_CODE = "android.media.mediaplayer.errcode";
+ field public static final java.lang.String FRAMES = "android.media.mediaplayer.frames";
+ field public static final java.lang.String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
+ field public static final java.lang.String HEIGHT = "android.media.mediaplayer.height";
+ field public static final java.lang.String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
+ field public static final java.lang.String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
+ field public static final java.lang.String PLAYING = "android.media.mediaplayer.playingMs";
+ field public static final java.lang.String WIDTH = "android.media.mediaplayer.width";
+ }
+
public static final class MediaPlayer.NoDrmSchemeException extends android.media.MediaDrmException {
ctor public MediaPlayer.NoDrmSchemeException(java.lang.String);
}
@@ -22989,7 +22960,7 @@
ctor public MediaRecorder();
method public static final int getAudioSourceMax();
method public int getMaxAmplitude() throws java.lang.IllegalStateException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.view.Surface getSurface();
method public void pause() throws java.lang.IllegalStateException;
method public void prepare() throws java.io.IOException, java.lang.IllegalStateException;
@@ -23057,6 +23028,25 @@
field public static final int VOICE_UPLINK = 2; // 0x2
}
+ public static final class MediaRecorder.MetricsConstants {
+ field public static final java.lang.String AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
+ field public static final java.lang.String AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
+ field public static final java.lang.String AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
+ field public static final java.lang.String AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
+ field public static final java.lang.String CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
+ field public static final java.lang.String CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
+ field public static final java.lang.String FRAMERATE = "android.media.mediarecorder.frame-rate";
+ field public static final java.lang.String HEIGHT = "android.media.mediarecorder.height";
+ field public static final java.lang.String MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
+ field public static final java.lang.String ROTATION = "android.media.mediarecorder.rotation";
+ field public static final java.lang.String VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
+ field public static final java.lang.String VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
+ field public static final java.lang.String VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
+ field public static final java.lang.String VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
+ field public static final java.lang.String VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
+ field public static final java.lang.String WIDTH = "android.media.mediarecorder.width";
+ }
+
public static abstract interface MediaRecorder.OnErrorListener {
method public abstract void onError(android.media.MediaRecorder, int, int);
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 7dfd44b..8b2ac55 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -23739,7 +23739,7 @@
method public deprecated java.nio.ByteBuffer[] getInputBuffers();
method public final android.media.MediaFormat getInputFormat();
method public android.media.Image getInputImage(int);
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public final java.lang.String getName();
method public java.nio.ByteBuffer getOutputBuffer(int);
method public deprecated java.nio.ByteBuffer[] getOutputBuffers();
@@ -23837,6 +23837,19 @@
method public void set(int, int);
}
+ public static final class MediaCodec.MetricsConstants {
+ field public static final java.lang.String CODEC = "android.media.mediacodec.codec";
+ field public static final java.lang.String ENCODER = "android.media.mediacodec.encoder";
+ field public static final java.lang.String HEIGHT = "android.media.mediacodec.height";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediacodec.mime";
+ field public static final java.lang.String MODE = "android.media.mediacodec.mode";
+ field public static final java.lang.String MODE_AUDIO = "audio";
+ field public static final java.lang.String MODE_VIDEO = "video";
+ field public static final java.lang.String ROTATION = "android.media.mediacodec.rotation";
+ field public static final java.lang.String SECURE = "android.media.mediacodec.secure";
+ field public static final java.lang.String WIDTH = "android.media.mediacodec.width";
+ }
+
public static abstract interface MediaCodec.OnFrameRenderedListener {
method public abstract void onFrameRendered(android.media.MediaCodec, long, long);
}
@@ -24292,7 +24305,7 @@
method public long getCachedDuration();
method public android.media.MediaExtractor.CasInfo getCasInfo(int);
method public android.media.DrmInitData getDrmInitData();
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public java.util.Map<java.util.UUID, byte[]> getPsshInfo();
method public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo);
method public int getSampleFlags();
@@ -24327,6 +24340,12 @@
method public int getSystemId();
}
+ public static final class MediaExtractor.MetricsConstants {
+ field public static final java.lang.String FORMAT = "android.media.mediaextractor.fmt";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediaextractor.mime";
+ field public static final java.lang.String TRACKS = "android.media.mediaextractor.ntrk";
+ }
+
public final class MediaFormat {
ctor public MediaFormat();
method public final boolean containsKey(java.lang.String);
@@ -24552,69 +24571,6 @@
field public static final int OPTION_PREVIOUS_SYNC = 0; // 0x0
}
- public final class MediaMetricsSet {
- method public double getDouble(java.lang.String, double);
- method public int getInt(java.lang.String, int);
- method public long getLong(java.lang.String, long);
- method public java.lang.String getString(java.lang.String, java.lang.String);
- method public boolean isEmpty();
- method public java.util.Set<java.lang.String> keySet();
- method public int size();
- }
-
- public static final class MediaMetricsSet.MediaCodec {
- field public static final java.lang.String KEY_CODEC = "android.media.mediacodec.codec";
- field public static final java.lang.String KEY_ENCODER = "android.media.mediacodec.encoder";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediacodec.height";
- field public static final java.lang.String KEY_MIME = "android.media.mediacodec.mime";
- field public static final java.lang.String KEY_MODE = "android.media.mediacodec.mode";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediacodec.rotation";
- field public static final java.lang.String KEY_SECURE = "android.media.mediacodec.secure";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediacodec.width";
- field public static final java.lang.String MODE_AUDIO = "audio";
- field public static final java.lang.String MODE_VIDEO = "video";
- }
-
- public static final class MediaMetricsSet.MediaExtractor {
- field public static final java.lang.String KEY_FORMAT = "android.media.mediaextractor.fmt";
- field public static final java.lang.String KEY_MIME = "android.media.mediaextractor.mime";
- field public static final java.lang.String KEY_TRACKS = "android.media.mediaextractor.ntrk";
- }
-
- public static final class MediaMetricsSet.MediaPlayer {
- field public static final java.lang.String KEY_CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
- field public static final java.lang.String KEY_CODEC_VIDEO = "android.media.mediaplayer.video.codec";
- field public static final java.lang.String KEY_DURATION = "android.media.mediaplayer.durationMs";
- field public static final java.lang.String KEY_ERRORS = "android.media.mediaplayer.err";
- field public static final java.lang.String KEY_ERROR_CODE = "android.media.mediaplayer.errcode";
- field public static final java.lang.String KEY_FRAMES = "android.media.mediaplayer.frames";
- field public static final java.lang.String KEY_FRAMES_DROPPED = "android.media.mediaplayer.dropped";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediaplayer.height";
- field public static final java.lang.String KEY_MIME_AUDIO = "android.media.mediaplayer.audio.mime";
- field public static final java.lang.String KEY_MIME_VIDEO = "android.media.mediaplayer.video.mime";
- field public static final java.lang.String KEY_PLAYING = "android.media.mediaplayer.playingMs";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediaplayer.width";
- }
-
- public static final class MediaMetricsSet.MediaRecorder {
- field public static final java.lang.String KEY_AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
- field public static final java.lang.String KEY_AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
- field public static final java.lang.String KEY_AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
- field public static final java.lang.String KEY_AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
- field public static final java.lang.String KEY_CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
- field public static final java.lang.String KEY_CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
- field public static final java.lang.String KEY_FRAMERATE = "android.media.mediarecorder.frame-rate";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediarecorder.height";
- field public static final java.lang.String KEY_MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediarecorder.rotation";
- field public static final java.lang.String KEY_VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
- field public static final java.lang.String KEY_VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
- field public static final java.lang.String KEY_VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
- field public static final java.lang.String KEY_VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
- field public static final java.lang.String KEY_VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediarecorder.width";
- }
-
public final class MediaMuxer {
ctor public MediaMuxer(java.lang.String, int) throws java.io.IOException;
ctor public MediaMuxer(java.io.FileDescriptor, int) throws java.io.IOException;
@@ -24653,7 +24609,7 @@
method public java.lang.String getDrmPropertyString(java.lang.String) throws android.media.MediaPlayer.NoDrmSchemeException;
method public int getDuration();
method public android.media.MediaDrm.KeyRequest getKeyRequest(byte[], java.lang.String, int, java.util.Map<java.lang.String, java.lang.String>) throws android.media.MediaPlayer.NoDrmSchemeException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.media.PlaybackParams getPlaybackParams();
method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
method public android.media.SyncParams getSyncParams();
@@ -24748,6 +24704,21 @@
method public java.util.UUID[] getSupportedSchemes();
}
+ public static final class MediaPlayer.MetricsConstants {
+ field public static final java.lang.String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
+ field public static final java.lang.String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
+ field public static final java.lang.String DURATION = "android.media.mediaplayer.durationMs";
+ field public static final java.lang.String ERRORS = "android.media.mediaplayer.err";
+ field public static final java.lang.String ERROR_CODE = "android.media.mediaplayer.errcode";
+ field public static final java.lang.String FRAMES = "android.media.mediaplayer.frames";
+ field public static final java.lang.String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
+ field public static final java.lang.String HEIGHT = "android.media.mediaplayer.height";
+ field public static final java.lang.String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
+ field public static final java.lang.String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
+ field public static final java.lang.String PLAYING = "android.media.mediaplayer.playingMs";
+ field public static final java.lang.String WIDTH = "android.media.mediaplayer.width";
+ }
+
public static final class MediaPlayer.NoDrmSchemeException extends android.media.MediaDrmException {
ctor public MediaPlayer.NoDrmSchemeException(java.lang.String);
}
@@ -24822,7 +24793,7 @@
ctor public MediaRecorder();
method public static final int getAudioSourceMax();
method public int getMaxAmplitude() throws java.lang.IllegalStateException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.view.Surface getSurface();
method public void pause() throws java.lang.IllegalStateException;
method public void prepare() throws java.io.IOException, java.lang.IllegalStateException;
@@ -24892,6 +24863,25 @@
field public static final int VOICE_UPLINK = 2; // 0x2
}
+ public static final class MediaRecorder.MetricsConstants {
+ field public static final java.lang.String AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
+ field public static final java.lang.String AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
+ field public static final java.lang.String AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
+ field public static final java.lang.String AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
+ field public static final java.lang.String CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
+ field public static final java.lang.String CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
+ field public static final java.lang.String FRAMERATE = "android.media.mediarecorder.frame-rate";
+ field public static final java.lang.String HEIGHT = "android.media.mediarecorder.height";
+ field public static final java.lang.String MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
+ field public static final java.lang.String ROTATION = "android.media.mediarecorder.rotation";
+ field public static final java.lang.String VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
+ field public static final java.lang.String VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
+ field public static final java.lang.String VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
+ field public static final java.lang.String VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
+ field public static final java.lang.String VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
+ field public static final java.lang.String WIDTH = "android.media.mediarecorder.width";
+ }
+
public static abstract interface MediaRecorder.OnErrorListener {
method public abstract void onError(android.media.MediaRecorder, int, int);
}
diff --git a/api/test-current.txt b/api/test-current.txt
index 090df83..86227a7 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -22013,7 +22013,7 @@
method public deprecated java.nio.ByteBuffer[] getInputBuffers();
method public final android.media.MediaFormat getInputFormat();
method public android.media.Image getInputImage(int);
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public final java.lang.String getName();
method public java.nio.ByteBuffer getOutputBuffer(int);
method public deprecated java.nio.ByteBuffer[] getOutputBuffers();
@@ -22111,6 +22111,19 @@
method public void set(int, int);
}
+ public static final class MediaCodec.MetricsConstants {
+ field public static final java.lang.String CODEC = "android.media.mediacodec.codec";
+ field public static final java.lang.String ENCODER = "android.media.mediacodec.encoder";
+ field public static final java.lang.String HEIGHT = "android.media.mediacodec.height";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediacodec.mime";
+ field public static final java.lang.String MODE = "android.media.mediacodec.mode";
+ field public static final java.lang.String MODE_AUDIO = "audio";
+ field public static final java.lang.String MODE_VIDEO = "video";
+ field public static final java.lang.String ROTATION = "android.media.mediacodec.rotation";
+ field public static final java.lang.String SECURE = "android.media.mediacodec.secure";
+ field public static final java.lang.String WIDTH = "android.media.mediacodec.width";
+ }
+
public static abstract interface MediaCodec.OnFrameRenderedListener {
method public abstract void onFrameRendered(android.media.MediaCodec, long, long);
}
@@ -22566,7 +22579,7 @@
method public long getCachedDuration();
method public android.media.MediaExtractor.CasInfo getCasInfo(int);
method public android.media.DrmInitData getDrmInitData();
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public java.util.Map<java.util.UUID, byte[]> getPsshInfo();
method public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo);
method public int getSampleFlags();
@@ -22601,6 +22614,12 @@
method public int getSystemId();
}
+ public static final class MediaExtractor.MetricsConstants {
+ field public static final java.lang.String FORMAT = "android.media.mediaextractor.fmt";
+ field public static final java.lang.String MIME_TYPE = "android.media.mediaextractor.mime";
+ field public static final java.lang.String TRACKS = "android.media.mediaextractor.ntrk";
+ }
+
public final class MediaFormat {
ctor public MediaFormat();
method public final boolean containsKey(java.lang.String);
@@ -22826,69 +22845,6 @@
field public static final int OPTION_PREVIOUS_SYNC = 0; // 0x0
}
- public final class MediaMetricsSet {
- method public double getDouble(java.lang.String, double);
- method public int getInt(java.lang.String, int);
- method public long getLong(java.lang.String, long);
- method public java.lang.String getString(java.lang.String, java.lang.String);
- method public boolean isEmpty();
- method public java.util.Set<java.lang.String> keySet();
- method public int size();
- }
-
- public static final class MediaMetricsSet.MediaCodec {
- field public static final java.lang.String KEY_CODEC = "android.media.mediacodec.codec";
- field public static final java.lang.String KEY_ENCODER = "android.media.mediacodec.encoder";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediacodec.height";
- field public static final java.lang.String KEY_MIME = "android.media.mediacodec.mime";
- field public static final java.lang.String KEY_MODE = "android.media.mediacodec.mode";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediacodec.rotation";
- field public static final java.lang.String KEY_SECURE = "android.media.mediacodec.secure";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediacodec.width";
- field public static final java.lang.String MODE_AUDIO = "audio";
- field public static final java.lang.String MODE_VIDEO = "video";
- }
-
- public static final class MediaMetricsSet.MediaExtractor {
- field public static final java.lang.String KEY_FORMAT = "android.media.mediaextractor.fmt";
- field public static final java.lang.String KEY_MIME = "android.media.mediaextractor.mime";
- field public static final java.lang.String KEY_TRACKS = "android.media.mediaextractor.ntrk";
- }
-
- public static final class MediaMetricsSet.MediaPlayer {
- field public static final java.lang.String KEY_CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
- field public static final java.lang.String KEY_CODEC_VIDEO = "android.media.mediaplayer.video.codec";
- field public static final java.lang.String KEY_DURATION = "android.media.mediaplayer.durationMs";
- field public static final java.lang.String KEY_ERRORS = "android.media.mediaplayer.err";
- field public static final java.lang.String KEY_ERROR_CODE = "android.media.mediaplayer.errcode";
- field public static final java.lang.String KEY_FRAMES = "android.media.mediaplayer.frames";
- field public static final java.lang.String KEY_FRAMES_DROPPED = "android.media.mediaplayer.dropped";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediaplayer.height";
- field public static final java.lang.String KEY_MIME_AUDIO = "android.media.mediaplayer.audio.mime";
- field public static final java.lang.String KEY_MIME_VIDEO = "android.media.mediaplayer.video.mime";
- field public static final java.lang.String KEY_PLAYING = "android.media.mediaplayer.playingMs";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediaplayer.width";
- }
-
- public static final class MediaMetricsSet.MediaRecorder {
- field public static final java.lang.String KEY_AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
- field public static final java.lang.String KEY_AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
- field public static final java.lang.String KEY_AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
- field public static final java.lang.String KEY_AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
- field public static final java.lang.String KEY_CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
- field public static final java.lang.String KEY_CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
- field public static final java.lang.String KEY_FRAMERATE = "android.media.mediarecorder.frame-rate";
- field public static final java.lang.String KEY_HEIGHT = "android.media.mediarecorder.height";
- field public static final java.lang.String KEY_MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
- field public static final java.lang.String KEY_ROTATION = "android.media.mediarecorder.rotation";
- field public static final java.lang.String KEY_VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
- field public static final java.lang.String KEY_VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
- field public static final java.lang.String KEY_VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
- field public static final java.lang.String KEY_VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
- field public static final java.lang.String KEY_VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
- field public static final java.lang.String KEY_WIDTH = "android.media.mediarecorder.width";
- }
-
public final class MediaMuxer {
ctor public MediaMuxer(java.lang.String, int) throws java.io.IOException;
ctor public MediaMuxer(java.io.FileDescriptor, int) throws java.io.IOException;
@@ -22927,7 +22883,7 @@
method public java.lang.String getDrmPropertyString(java.lang.String) throws android.media.MediaPlayer.NoDrmSchemeException;
method public int getDuration();
method public android.media.MediaDrm.KeyRequest getKeyRequest(byte[], java.lang.String, int, java.util.Map<java.lang.String, java.lang.String>) throws android.media.MediaPlayer.NoDrmSchemeException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.media.PlaybackParams getPlaybackParams();
method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
method public android.media.SyncParams getSyncParams();
@@ -23022,6 +22978,21 @@
method public java.util.UUID[] getSupportedSchemes();
}
+ public static final class MediaPlayer.MetricsConstants {
+ field public static final java.lang.String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
+ field public static final java.lang.String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
+ field public static final java.lang.String DURATION = "android.media.mediaplayer.durationMs";
+ field public static final java.lang.String ERRORS = "android.media.mediaplayer.err";
+ field public static final java.lang.String ERROR_CODE = "android.media.mediaplayer.errcode";
+ field public static final java.lang.String FRAMES = "android.media.mediaplayer.frames";
+ field public static final java.lang.String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
+ field public static final java.lang.String HEIGHT = "android.media.mediaplayer.height";
+ field public static final java.lang.String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
+ field public static final java.lang.String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
+ field public static final java.lang.String PLAYING = "android.media.mediaplayer.playingMs";
+ field public static final java.lang.String WIDTH = "android.media.mediaplayer.width";
+ }
+
public static final class MediaPlayer.NoDrmSchemeException extends android.media.MediaDrmException {
ctor public MediaPlayer.NoDrmSchemeException(java.lang.String);
}
@@ -23096,7 +23067,7 @@
ctor public MediaRecorder();
method public static final int getAudioSourceMax();
method public int getMaxAmplitude() throws java.lang.IllegalStateException;
- method public android.media.MediaMetricsSet getMetrics();
+ method public android.os.PersistableBundle getMetrics();
method public android.view.Surface getSurface();
method public void pause() throws java.lang.IllegalStateException;
method public void prepare() throws java.io.IOException, java.lang.IllegalStateException;
@@ -23164,6 +23135,25 @@
field public static final int VOICE_UPLINK = 2; // 0x2
}
+ public static final class MediaRecorder.MetricsConstants {
+ field public static final java.lang.String AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
+ field public static final java.lang.String AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
+ field public static final java.lang.String AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
+ field public static final java.lang.String AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
+ field public static final java.lang.String CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
+ field public static final java.lang.String CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
+ field public static final java.lang.String FRAMERATE = "android.media.mediarecorder.frame-rate";
+ field public static final java.lang.String HEIGHT = "android.media.mediarecorder.height";
+ field public static final java.lang.String MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
+ field public static final java.lang.String ROTATION = "android.media.mediarecorder.rotation";
+ field public static final java.lang.String VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
+ field public static final java.lang.String VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
+ field public static final java.lang.String VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
+ field public static final java.lang.String VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
+ field public static final java.lang.String VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
+ field public static final java.lang.String WIDTH = "android.media.mediarecorder.width";
+ }
+
public static abstract interface MediaRecorder.OnErrorListener {
method public abstract void onError(android.media.MediaRecorder, int, int);
}
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index e628d18..6cab56c 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -23,12 +23,12 @@
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaMetricsSet;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
+import android.os.PersistableBundle;
import android.view.Surface;
import java.io.IOException;
@@ -3188,20 +3188,19 @@
/**
* Return Metrics data about the current codec instance.
*
- * @return a MediaMetricsSet containing the set of attributes and values
+ * @return a {@link PersistableBundle} containing the set of attributes and values
* available for the media being handled by this instance of MediaCodec
- * The attributes are descibed in {@link MediaMetricsSet.MediaCodec}.
+ * The attributes are descibed in {@link MetricsConstants}.
*
- * Additional vendor-specific fields may also be present in
- * the return value.
+ * Additional vendor-specific fields may also be present in
+ * the return value.
*/
- public MediaMetricsSet getMetrics() {
- Bundle bundle = native_getMetrics();
- MediaMetricsSet mSet = new MediaMetricsSet(bundle);
- return mSet;
+ public PersistableBundle getMetrics() {
+ PersistableBundle bundle = native_getMetrics();
+ return bundle;
}
- private native Bundle native_getMetrics();
+ private native PersistableBundle native_getMetrics();
/**
* Change a video encoder's target bitrate on the fly. The value is an
@@ -3660,4 +3659,80 @@
private final ByteBuffer mData;
}
}
+
+ public final static class MetricsConstants
+ {
+ private MetricsConstants() {}
+
+ /**
+ * Key to extract the codec being used
+ * from the {@link MediaCodec#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String CODEC = "android.media.mediacodec.codec";
+
+ /**
+ * Key to extract the MIME type
+ * from the {@link MediaCodec#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String MIME_TYPE = "android.media.mediacodec.mime";
+
+ /**
+ * Key to extract what the codec mode
+ * from the {@link MediaCodec#getMetrics} return value.
+ * The value is a String. Values will be one of the constants
+ * {@link #MODE_AUDIO} or {@link #MODE_VIDEO}.
+ */
+ public static final String MODE = "android.media.mediacodec.mode";
+
+ /**
+ * The value returned for the key {@link #MODE} when the
+ * codec is a audio codec.
+ */
+ public static final String MODE_AUDIO = "audio";
+
+ /**
+ * The value returned for the key {@link #MODE} when the
+ * codec is a video codec.
+ */
+ public static final String MODE_VIDEO = "video";
+
+ /**
+ * Key to extract the flag indicating whether the codec is running
+ * as an encoder or decoder from the {@link MediaCodec#getMetrics} return value.
+ * The value is an integer.
+ * A 0 indicates decoder; 1 indicates encoder.
+ */
+ public static final String ENCODER = "android.media.mediacodec.encoder";
+
+ /**
+ * Key to extract the flag indicating whether the codec is running
+ * in secure (DRM) mode from the {@link MediaCodec#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String SECURE = "android.media.mediacodec.secure";
+
+ /**
+ * Key to extract the width (in pixels) of the video track
+ * from the {@link MediaCodec#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String WIDTH = "android.media.mediacodec.width";
+
+ /**
+ * Key to extract the height (in pixels) of the video track
+ * from the {@link MediaCodec#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String HEIGHT = "android.media.mediacodec.height";
+
+ /**
+ * Key to extract the rotation (in degrees) to properly orient the video
+ * from the {@link MediaCodec#getMetrics} return.
+ * The value is a integer.
+ */
+ public static final String ROTATION = "android.media.mediacodec.rotation";
+
+ }
}
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index a0a6a1e..fe461be 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -25,10 +25,10 @@
import android.media.MediaCodec;
import android.media.MediaFormat;
import android.media.MediaHTTPService;
-import android.media.MediaMetricsSet;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.PersistableBundle;
import com.android.internal.util.Preconditions;
@@ -689,22 +689,21 @@
/**
* Return Metrics data about the current media container.
*
- * @return a MediaMetricsSet containing the set of attributes and values
+ * @return a {@link PersistableBundle} containing the set of attributes and values
* available for the media container being handled by this instance
* of MediaExtractor.
- * The attributes are descibed in {@link MediaMetricsSet.MediaExtractor}.
+ * The attributes are descibed in {@link MetricsConstants}.
*
* Additional vendor-specific fields may also be present in
* the return value.
*/
- public MediaMetricsSet getMetrics() {
- Bundle bundle = native_getMetrics();
- MediaMetricsSet mSet = new MediaMetricsSet(bundle);
- return mSet;
+ public PersistableBundle getMetrics() {
+ PersistableBundle bundle = native_getMetrics();
+ return bundle;
}
- private native Bundle native_getMetrics();
+ private native PersistableBundle native_getMetrics();
private static native final void native_init();
private native final void native_setup();
@@ -718,4 +717,32 @@
private MediaCas mMediaCas;
private long mNativeContext;
+
+ public final static class MetricsConstants
+ {
+ private MetricsConstants() {}
+
+ /**
+ * Key to extract the container format
+ * from the {@link MediaExtractor#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String FORMAT = "android.media.mediaextractor.fmt";
+
+ /**
+ * Key to extract the container MIME type
+ * from the {@link MediaExtractor#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String MIME_TYPE = "android.media.mediaextractor.mime";
+
+ /**
+ * Key to extract the number of tracks in the container
+ * from the {@link MediaExtractor#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String TRACKS = "android.media.mediaextractor.ntrk";
+
+ }
+
}
diff --git a/media/java/android/media/MediaMetricsSet.java b/media/java/android/media/MediaMetricsSet.java
deleted file mode 100644
index 5ecbee2..0000000
--- a/media/java/android/media/MediaMetricsSet.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-import android.os.Bundle;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.Runnable;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.ref.WeakReference;
-import java.net.HttpCookie;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.URL;
-import java.nio.ByteOrder;
-import java.util.Arrays;
-import java.util.BitSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import java.util.Set;
-import java.util.UUID;
-import java.util.Vector;
-
-
-/**
- * MediaMetricsSet contains the results returned by the getMetrics()
- * methods defined in other Media classes such as
- * {@link MediaCodec}, {@link MediaExtractor}, {@link MediaPlayer},
- * and {@link MediaRecorder}.
- *
- * MediaMetricsSet behaves similarly to a {@link Bundle}. It contains
- * a set of keys and values.
- * Methods such as {@link #getInt} and {@link #getString} are provided
- * to extract values of the corresponding types.
- * The {@link #keySet} method can be used to discover all of the keys
- * that are present in the particular instance.
- *
- */
-public final class MediaMetricsSet
-{
-
- /**
- * This MediaCodec class holds the constants defining keys related to
- * the metrics for a MediaCodec.
- */
- public final static class MediaCodec
- {
- private MediaCodec() {}
-
- /**
- * Key to extract the codec being used
- * from the {@link MediaCodec#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_CODEC = "android.media.mediacodec.codec";
-
- /**
- * Key to extract the MIME type
- * from the {@link MediaCodec#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_MIME = "android.media.mediacodec.mime";
-
- /**
- * Key to extract what the codec mode
- * from the {@link MediaCodec#getMetrics} return value.
- * The value is a String. Values will be one of the constants
- * MODE_AUDIO or MODE_VIDEO.
- */
- public static final String KEY_MODE = "android.media.mediacodec.mode";
-
- /**
- * The value returned for the key {@link #KEY_MODE} when the
- * codec is a audio codec.
- */
- public static final String MODE_AUDIO = "audio";
-
- /**
- * The value returned for the key {@link #KEY_MODE} when the
- * codec is a video codec.
- */
- public static final String MODE_VIDEO = "video";
-
- /**
- * Key to extract the flag indicating whether the codec is running
- * as an encoder or decoder from the {@link MediaCodec#getMetrics} return value.
- * The value is an integer.
- * A 0 indicates decoder; 1 indicates encoder.
- */
- public static final String KEY_ENCODER = "android.media.mediacodec.encoder";
-
- /**
- * Key to extract the flag indicating whether the codec is running
- * in secure (DRM) mode from the {@link MediaCodec#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_SECURE = "android.media.mediacodec.secure";
-
- /**
- * Key to extract the width (in pixels) of the video track
- * from the {@link MediaCodec#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_WIDTH = "android.media.mediacodec.width";
-
- /**
- * Key to extract the height (in pixels) of the video track
- * from the {@link MediaCodec#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_HEIGHT = "android.media.mediacodec.height";
-
- /**
- * Key to extract the rotation (in degrees) to properly orient the video
- * from the {@link MediaCodec#getMetrics} return.
- * The value is a integer.
- */
- public static final String KEY_ROTATION = "android.media.mediacodec.rotation";
-
- }
-
- /**
- * This class holds the constants defining keys related to
- * the metrics for a MediaExtractor.
- */
- public final static class MediaExtractor
- {
- private MediaExtractor() {}
-
- /**
- * Key to extract the container format
- * from the {@link MediaExtractor#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_FORMAT = "android.media.mediaextractor.fmt";
-
- /**
- * Key to extract the container MIME type
- * from the {@link MediaExtractor#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_MIME = "android.media.mediaextractor.mime";
-
- /**
- * Key to extract the number of tracks in the container
- * from the {@link MediaExtractor#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_TRACKS = "android.media.mediaextractor.ntrk";
-
- }
-
- /**
- * This class holds the constants defining keys related to
- * the metrics for a MediaPlayer.
- */
- public final static class MediaPlayer
- {
- private MediaPlayer() {}
-
- /**
- * Key to extract the MIME type of the video track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_MIME_VIDEO = "android.media.mediaplayer.video.mime";
-
- /**
- * Key to extract the codec being used to decode the video track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_CODEC_VIDEO = "android.media.mediaplayer.video.codec";
-
- /**
- * Key to extract the width (in pixels) of the video track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_WIDTH = "android.media.mediaplayer.width";
-
- /**
- * Key to extract the height (in pixels) of the video track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_HEIGHT = "android.media.mediaplayer.height";
-
- /**
- * Key to extract the count of video frames played
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_FRAMES = "android.media.mediaplayer.frames";
-
- /**
- * Key to extract the count of video frames dropped
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_FRAMES_DROPPED = "android.media.mediaplayer.dropped";
-
- /**
- * Key to extract the MIME type of the audio track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_MIME_AUDIO = "android.media.mediaplayer.audio.mime";
-
- /**
- * Key to extract the codec being used to decode the audio track
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a String.
- */
- public static final String KEY_CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
-
- /**
- * Key to extract the duration (in milliseconds) of the
- * media being played
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a long.
- */
- public static final String KEY_DURATION = "android.media.mediaplayer.durationMs";
-
- /**
- * Key to extract the playing time (in milliseconds) of the
- * media being played
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is a long.
- */
- public static final String KEY_PLAYING = "android.media.mediaplayer.playingMs";
-
- /**
- * Key to extract the count of errors encountered while
- * playing the media
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_ERRORS = "android.media.mediaplayer.err";
-
- /**
- * Key to extract an (optional) error code detected while
- * playing the media
- * from the {@link MediaPlayer#getMetrics} return value.
- * The value is an integer.
- */
- public static final String KEY_ERROR_CODE = "android.media.mediaplayer.errcode";
-
- }
-
- /**
- * This class holds the constants defining keys related to
- * the metrics for a MediaRecorder.
- */
- public final static class MediaRecorder
- {
- private MediaRecorder() {}
-
- /**
- * Key to extract the audio bitrate
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
-
- /**
- * Key to extract the number of audio channels
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
-
- /**
- * Key to extract the audio samplerate
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
-
- /**
- * Key to extract the audio timescale
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
-
- /**
- * Key to extract the video capture frame rate
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is a double.
- */
- public static final String KEY_CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
-
- /**
- * Key to extract the video capture framerate enable value
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
-
- /**
- * Key to extract the intended playback frame rate
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_FRAMERATE = "android.media.mediarecorder.frame-rate";
-
- /**
- * Key to extract the height (in pixels) of the captured video
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_HEIGHT = "android.media.mediarecorder.height";
-
- /**
- * Key to extract the recorded movies time units
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- * A value of 1000 indicates that the movie's timing is in milliseconds.
- */
- public static final String KEY_MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
-
- /**
- * Key to extract the rotation (in degrees) to properly orient the video
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_ROTATION = "android.media.mediarecorder.rotation";
-
- /**
- * Key to extract the video bitrate from being used
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
-
- /**
- * Key to extract the value for how often video iframes are generated
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
-
- /**
- * Key to extract the video encoding level
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
-
- /**
- * Key to extract the video encoding profile
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
-
- /**
- * Key to extract the recorded video time units
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- * A value of 1000 indicates that the video's timing is in milliseconds.
- */
- public static final String KEY_VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
-
- /**
- * Key to extract the width (in pixels) of the captured video
- * from the {@link MediaRecorder#getMetrics} return.
- * The value is an integer.
- */
- public static final String KEY_WIDTH = "android.media.mediarecorder.width";
-
- }
-
- /*
- * Methods that we want
- */
-
- private Bundle mBundle;
-
- MediaMetricsSet(Bundle bundle) {
- mBundle = bundle;
- }
-
- /**
- * Returns the number of mappings contained in this Bundle.
- *
- * @return the number of mappings as an int.
- */
- public int size() {
- return mBundle.size();
- }
-
- /**
- * Returns true if the mapping of this MediaMetricsSet is empty,
- * false otherwise.
- */
- public boolean isEmpty() {
- return mBundle.isEmpty();
- }
-
- /**
- * Returns the value associated with the given key, or defaultValue if
- * no mapping of the desired type exists for the given key.
- *
- * @param key a String
- * @param defaultValue Value to return if key does not exist
- * @return a double value
- */
- public double getDouble(String key, double defaultValue) {
- return mBundle.getDouble(key, defaultValue);
- }
-
- /**
- * Returns the value associated with the given key, or defaultValue if
- * no mapping of the desired type exists for the given key.
- *
- * @param key a String
- * @param defaultValue Value to return if key does not exist
- * @return an int value
- */
- public int getInt(String key, int defaultValue) {
- return mBundle.getInt(key, defaultValue);
- }
-
- /**
- * Returns the value associated with the given key, or defaultValue if
- * no mapping of the desired type exists for the given key.
- *
- * @param key a String
- * @param defaultValue Value to return if key does not exist
- * @return a long value
- */
- public long getLong(String key, long defaultValue) {
- return mBundle.getLong(key, defaultValue);
- }
-
- /**
- * Returns the value associated with the given key, or defaultValue if
- * no mapping of the desired type exists for the given key or if a null
- * value is explicitly associated with the given key.
- *
- * @param key a String
- * @param defaultValue Value to return if key does not exist or if a null
- * value is associated with the given key.
- * @return the String value associated with the given key, or defaultValue
- * if no valid String object is currently mapped to that key.
- */
- public String getString(String key, String defaultValue) {
- return mBundle.getString(key, defaultValue);
- }
-
- /**
- * Returns a Set containing the Strings used as keys in this Bundle.
- *
- * @return a Set of String keys
- */
- public Set<String> keySet() {
- return mBundle.keySet();
- }
-
-
-
- public String toString() {
- return mBundle.toString();
- }
-
-}
-
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 71a968b..9386246 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -33,6 +33,7 @@
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.PersistableBundle;
import android.os.Process;
import android.os.PowerManager;
import android.os.SystemProperties;
@@ -48,7 +49,6 @@
import android.media.AudioManager;
import android.media.MediaDrm;
import android.media.MediaFormat;
-import android.media.MediaMetricsSet;
import android.media.MediaTimeProvider;
import android.media.PlaybackParams;
import android.media.SubtitleController;
@@ -1491,20 +1491,19 @@
/**
* Return Metrics data about the current player.
*
- * @return a MediaMetricsSet containing the set of attributes and values
+ * @return a {@link PersistableBundle} containing the set of attributes and values
* available for the media being handled by this instance of MediaPlayer
- * The attributes are descibed in {@link MediaMetricsSet.MediaPlayer}.
+ * The attributes are descibed in {@link MetricsConstants}.
*
* Additional vendor-specific fields may also be present in
* the return value.
*/
- public MediaMetricsSet getMetrics() {
- Bundle bundle = native_getMetrics();
- MediaMetricsSet mSet = new MediaMetricsSet(bundle);
- return mSet;
+ public PersistableBundle getMetrics() {
+ PersistableBundle bundle = native_getMetrics();
+ return bundle;
}
- private native Bundle native_getMetrics();
+ private native PersistableBundle native_getMetrics();
/**
* Checks whether the MediaPlayer is playing.
@@ -5418,4 +5417,98 @@
}
}
}
+
+ public final static class MetricsConstants
+ {
+ private MetricsConstants() {}
+
+ /**
+ * Key to extract the MIME type of the video track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
+
+ /**
+ * Key to extract the codec being used to decode the video track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
+
+ /**
+ * Key to extract the width (in pixels) of the video track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String WIDTH = "android.media.mediaplayer.width";
+
+ /**
+ * Key to extract the height (in pixels) of the video track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String HEIGHT = "android.media.mediaplayer.height";
+
+ /**
+ * Key to extract the count of video frames played
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String FRAMES = "android.media.mediaplayer.frames";
+
+ /**
+ * Key to extract the count of video frames dropped
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
+
+ /**
+ * Key to extract the MIME type of the audio track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
+
+ /**
+ * Key to extract the codec being used to decode the audio track
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a String.
+ */
+ public static final String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
+
+ /**
+ * Key to extract the duration (in milliseconds) of the
+ * media being played
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a long.
+ */
+ public static final String DURATION = "android.media.mediaplayer.durationMs";
+
+ /**
+ * Key to extract the playing time (in milliseconds) of the
+ * media being played
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is a long.
+ */
+ public static final String PLAYING = "android.media.mediaplayer.playingMs";
+
+ /**
+ * Key to extract the count of errors encountered while
+ * playing the media
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String ERRORS = "android.media.mediaplayer.err";
+
+ /**
+ * Key to extract an (optional) error code detected while
+ * playing the media
+ * from the {@link MediaPlayer#getMetrics} return value.
+ * The value is an integer.
+ */
+ public static final String ERROR_CODE = "android.media.mediaplayer.errcode";
+
+ }
}
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 4675e32..858c678 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -20,11 +20,11 @@
import android.annotation.SystemApi;
import android.app.ActivityThread;
import android.hardware.Camera;
-import android.media.MediaMetricsSet;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.os.PersistableBundle;
import android.util.Log;
import android.view.Surface;
@@ -1267,23 +1267,142 @@
/**
* Return Metrics data about the current Mediarecorder instance.
*
- * @return a MediaMetricsSet containing the set of attributes and values
+ * @return a {@link PersistableBundle} containing the set of attributes and values
* available for the media being generated by this instance of
* MediaRecorder.
- * The attributes are descibed in {@link MediaMetricsSet.MediaRecorder}.
+ * The attributes are descibed in {@link MetricsConstants}.
*
* Additional vendor-specific fields may also be present in
* the return value.
*/
- public MediaMetricsSet getMetrics() {
- Bundle bundle = native_getMetrics();
- MediaMetricsSet mSet = new MediaMetricsSet(bundle);
- return mSet;
+ public PersistableBundle getMetrics() {
+ PersistableBundle bundle = native_getMetrics();
+ return bundle;
}
- private native Bundle native_getMetrics();
+ private native PersistableBundle native_getMetrics();
@Override
protected void finalize() { native_finalize(); }
+
+ public final static class MetricsConstants
+ {
+ private MetricsConstants() {}
+
+ /**
+ * Key to extract the audio bitrate
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
+
+ /**
+ * Key to extract the number of audio channels
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
+
+ /**
+ * Key to extract the audio samplerate
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
+
+ /**
+ * Key to extract the audio timescale
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
+
+ /**
+ * Key to extract the video capture frame rate
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is a double.
+ */
+ public static final String CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
+
+ /**
+ * Key to extract the video capture framerate enable value
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
+
+ /**
+ * Key to extract the intended playback frame rate
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String FRAMERATE = "android.media.mediarecorder.frame-rate";
+
+ /**
+ * Key to extract the height (in pixels) of the captured video
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String HEIGHT = "android.media.mediarecorder.height";
+
+ /**
+ * Key to extract the recorded movies time units
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ * A value of 1000 indicates that the movie's timing is in milliseconds.
+ */
+ public static final String MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
+
+ /**
+ * Key to extract the rotation (in degrees) to properly orient the video
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String ROTATION = "android.media.mediarecorder.rotation";
+
+ /**
+ * Key to extract the video bitrate from being used
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
+
+ /**
+ * Key to extract the value for how often video iframes are generated
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
+
+ /**
+ * Key to extract the video encoding level
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
+
+ /**
+ * Key to extract the video encoding profile
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
+
+ /**
+ * Key to extract the recorded video time units
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ * A value of 1000 indicates that the video's timing is in milliseconds.
+ */
+ public static final String VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
+
+ /**
+ * Key to extract the width (in pixels) of the captured video
+ * from the {@link MediaRecorder#getMetrics} return.
+ * The value is an integer.
+ */
+ public static final String WIDTH = "android.media.mediarecorder.width";
+
+ }
}
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index a8dd313..2178607 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -2002,7 +2002,7 @@
{ "getName", "()Ljava/lang/String;",
(void *)android_media_MediaCodec_getName },
- { "native_getMetrics", "()Landroid/os/Bundle;",
+ { "native_getMetrics", "()Landroid/os/PersistableBundle;",
(void *)android_media_MediaCodec_native_getMetrics},
{ "setParameters", "([Ljava/lang/String;[Ljava/lang/Object;)V",
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index c2cfed9..9e5d3d1 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -905,7 +905,7 @@
{ "hasCacheReachedEndOfStream", "()Z",
(void *)android_media_MediaExtractor_hasCacheReachedEOS },
- {"native_getMetrics", "()Landroid/os/Bundle;",
+ {"native_getMetrics", "()Landroid/os/PersistableBundle;",
(void *)android_media_MediaExtractor_native_getMetrics},
};
diff --git a/media/jni/android_media_MediaMetricsJNI.cpp b/media/jni/android_media_MediaMetricsJNI.cpp
index fb606ba..8979cec 100644
--- a/media/jni/android_media_MediaMetricsJNI.cpp
+++ b/media/jni/android_media_MediaMetricsJNI.cpp
@@ -24,15 +24,12 @@
namespace android {
-// place the attributes into a java Bundle object
-// decide whether this is appropriately scoped here.
-// if we do it somewhere else, we have to figure a "give me all the attrs"
-// access to the inside of MediaAnalyticsItem
+// place the attributes into a java PersistableBundle object
jobject MediaMetricsJNI::writeMetricsToBundle(JNIEnv* env, MediaAnalyticsItem *item, jobject mybundle) {
- jclass clazzBundle = env->FindClass("android/os/Bundle");
+ jclass clazzBundle = env->FindClass("android/os/PersistableBundle");
if (clazzBundle==NULL) {
- ALOGD("can't find android/os/Bundle");
+ ALOGD("can't find android/os/PersistableBundle");
return NULL;
}
// sometimes the caller provides one for us to fill
@@ -58,7 +55,7 @@
// -- get name, get type, get value
// -- insert appropriately into the bundle
for (size_t i = 0 ; i < item->mPropCount; i++ ) {
- MediaAnalyticsItem::Prop *prop = &item->mProps[i];
+ MediaAnalyticsItem::Prop *prop = &item->mProps[i];
// build the key parameter from prop->mName
jstring keyName = env->NewStringUTF(prop->mName);
// invoke the appropriate method to insert
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 1b52cf5..2fc4afd 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -1393,7 +1393,7 @@
{"_stop", "()V", (void *)android_media_MediaPlayer_stop},
{"getVideoWidth", "()I", (void *)android_media_MediaPlayer_getVideoWidth},
{"getVideoHeight", "()I", (void *)android_media_MediaPlayer_getVideoHeight},
- {"native_getMetrics", "()Landroid/os/Bundle;", (void *)android_media_MediaPlayer_native_getMetrics},
+ {"native_getMetrics", "()Landroid/os/PersistableBundle;", (void *)android_media_MediaPlayer_native_getMetrics},
{"setPlaybackParams", "(Landroid/media/PlaybackParams;)V", (void *)android_media_MediaPlayer_setPlaybackParams},
{"getPlaybackParams", "()Landroid/media/PlaybackParams;", (void *)android_media_MediaPlayer_getPlaybackParams},
{"setSyncParams", "(Landroid/media/SyncParams;)V", (void *)android_media_MediaPlayer_setSyncParams},
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index 7a63e00..2c1e834 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -688,7 +688,7 @@
{"native_finalize", "()V", (void *)android_media_MediaRecorder_native_finalize},
{"native_setInputSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaRecorder_setInputSurface },
- {"native_getMetrics", "()Landroid/os/Bundle;", (void *)android_media_MediaRecorder_native_getMetrics},
+ {"native_getMetrics", "()Landroid/os/PersistableBundle;", (void *)android_media_MediaRecorder_native_getMetrics},
};
// This function only registers the native methods, and is called from