Merge "Unhide media metrics APIs" into sc-dev
This commit is contained in:
@@ -24418,11 +24418,16 @@ package android.media.metrics {
|
||||
|
||||
public abstract class Event {
|
||||
ctor protected Event(long);
|
||||
method @NonNull public android.os.Bundle getMetricsBundle();
|
||||
method @IntRange(from=0xffffffff) public long getTimeSinceCreatedMillis();
|
||||
}
|
||||
|
||||
public final class LogSessionId {
|
||||
}
|
||||
|
||||
public class MediaMetricsManager {
|
||||
method @NonNull public android.media.metrics.PlaybackSession createPlaybackSession();
|
||||
method @NonNull public android.media.metrics.RecordingSession createRecordingSession();
|
||||
field public static final long INVALID_TIMESTAMP = -1L; // 0xffffffffffffffffL
|
||||
}
|
||||
|
||||
@@ -24437,14 +24442,16 @@ package android.media.metrics {
|
||||
field public static final int NETWORK_TYPE_5G_NSA = 7; // 0x7
|
||||
field public static final int NETWORK_TYPE_5G_SA = 8; // 0x8
|
||||
field public static final int NETWORK_TYPE_ETHERNET = 3; // 0x3
|
||||
field public static final int NETWORK_TYPE_NONE = 0; // 0x0
|
||||
field public static final int NETWORK_TYPE_OFFLINE = 9; // 0x9
|
||||
field public static final int NETWORK_TYPE_OTHER = 1; // 0x1
|
||||
field public static final int NETWORK_TYPE_UNKNOWN = 0; // 0x0
|
||||
field public static final int NETWORK_TYPE_WIFI = 2; // 0x2
|
||||
}
|
||||
|
||||
public static final class NetworkEvent.Builder {
|
||||
ctor public NetworkEvent.Builder();
|
||||
method @NonNull public android.media.metrics.NetworkEvent build();
|
||||
method @NonNull public android.media.metrics.NetworkEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
|
||||
method @NonNull public android.media.metrics.NetworkEvent.Builder setNetworkType(int);
|
||||
method @NonNull public android.media.metrics.NetworkEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
}
|
||||
@@ -24460,9 +24467,37 @@ package android.media.metrics {
|
||||
method @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) public int getSubErrorCode();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackErrorEvent> CREATOR;
|
||||
field public static final int ERROR_CODE_OTHER = 1; // 0x1
|
||||
field public static final int ERROR_CODE_RUNTIME = 2; // 0x2
|
||||
field public static final int ERROR_CODE_UNKNOWN = 0; // 0x0
|
||||
field public static final int ERROR_AUDIOTRACK_INIT = 17; // 0x11
|
||||
field public static final int ERROR_AUDIOTRACK_OTHER = 19; // 0x13
|
||||
field public static final int ERROR_AUDIOTRACK_WRITE = 18; // 0x12
|
||||
field public static final int ERROR_DECODER_DECODE = 14; // 0xe
|
||||
field public static final int ERROR_DECODER_INIT = 13; // 0xd
|
||||
field public static final int ERROR_DECODER_OOM = 15; // 0xf
|
||||
field public static final int ERROR_DECODER_OTHER = 16; // 0x10
|
||||
field public static final int ERROR_DRM_CONTENT_ERROR = 28; // 0x1c
|
||||
field public static final int ERROR_DRM_DISALLOWED = 26; // 0x1a
|
||||
field public static final int ERROR_DRM_LICENSE_ERROR = 25; // 0x19
|
||||
field public static final int ERROR_DRM_OTHER = 30; // 0x1e
|
||||
field public static final int ERROR_DRM_PROVISIONING_FAILED = 24; // 0x18
|
||||
field public static final int ERROR_DRM_REVOKED = 29; // 0x1d
|
||||
field public static final int ERROR_DRM_SYSTEM_ERROR = 27; // 0x1b
|
||||
field public static final int ERROR_DRM_UNAVAILABLE = 23; // 0x17
|
||||
field public static final int ERROR_MEDIA_MANIFEST = 10; // 0xa
|
||||
field public static final int ERROR_MEDIA_OTHER = 12; // 0xc
|
||||
field public static final int ERROR_MEDIA_PARSER = 11; // 0xb
|
||||
field public static final int ERROR_NETWORK_BAD_STATUS = 5; // 0x5
|
||||
field public static final int ERROR_NETWORK_CLOSED = 8; // 0x8
|
||||
field public static final int ERROR_NETWORK_CONNECT = 4; // 0x4
|
||||
field public static final int ERROR_NETWORK_DNS = 6; // 0x6
|
||||
field public static final int ERROR_NETWORK_OFFLINE = 3; // 0x3
|
||||
field public static final int ERROR_NETWORK_OTHER = 9; // 0x9
|
||||
field public static final int ERROR_NETWORK_TIMEOUT = 7; // 0x7
|
||||
field public static final int ERROR_OTHER = 1; // 0x1
|
||||
field public static final int ERROR_PLAYER_BEHIND_LIVE_WINDOW = 21; // 0x15
|
||||
field public static final int ERROR_PLAYER_OTHER = 22; // 0x16
|
||||
field public static final int ERROR_PLAYER_REMOTE = 20; // 0x14
|
||||
field public static final int ERROR_RUNTIME = 2; // 0x2
|
||||
field public static final int ERROR_UNKNOWN = 0; // 0x0
|
||||
}
|
||||
|
||||
public static final class PlaybackErrorEvent.Builder {
|
||||
@@ -24470,6 +24505,7 @@ package android.media.metrics {
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent build();
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setErrorCode(int);
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setException(@NonNull Exception);
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setSubErrorCode(@IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
}
|
||||
@@ -24478,10 +24514,12 @@ package android.media.metrics {
|
||||
method public int describeContents();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getAudioUnderrunCount();
|
||||
method public int getContentType();
|
||||
method @NonNull public byte[] getDrmSessionId();
|
||||
method public int getDrmType();
|
||||
method @NonNull public long[] getExperimentIds();
|
||||
method @IntRange(from=0xffffffff) public long getLocalBytesRead();
|
||||
method @IntRange(from=0xffffffff) public long getMediaDurationMillis();
|
||||
method @NonNull public android.os.Bundle getMetricsBundle();
|
||||
method @IntRange(from=0xffffffff) public long getNetworkBytesRead();
|
||||
method @IntRange(from=0xffffffff) public long getNetworkTransferDurationMillis();
|
||||
method public int getPlaybackType();
|
||||
@@ -24492,9 +24530,10 @@ package android.media.metrics {
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesDropped();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesPlayed();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field public static final int CONTENT_TYPE_AD = 1; // 0x1
|
||||
field public static final int CONTENT_TYPE_MAIN = 0; // 0x0
|
||||
field public static final int CONTENT_TYPE_OTHER = 2; // 0x2
|
||||
field public static final int CONTENT_TYPE_AD = 2; // 0x2
|
||||
field public static final int CONTENT_TYPE_MAIN = 1; // 0x1
|
||||
field public static final int CONTENT_TYPE_OTHER = 3; // 0x3
|
||||
field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackMetrics> CREATOR;
|
||||
field public static final int DRM_TYPE_CLEARKEY = 6; // 0x6
|
||||
field public static final int DRM_TYPE_NONE = 0; // 0x0
|
||||
@@ -24503,9 +24542,10 @@ package android.media.metrics {
|
||||
field public static final int DRM_TYPE_WIDEVINE_L1 = 3; // 0x3
|
||||
field public static final int DRM_TYPE_WIDEVINE_L3 = 4; // 0x4
|
||||
field public static final int DRM_TYPE_WV_L3_FALLBACK = 5; // 0x5
|
||||
field public static final int PLAYBACK_TYPE_LIVE = 1; // 0x1
|
||||
field public static final int PLAYBACK_TYPE_OTHER = 2; // 0x2
|
||||
field public static final int PLAYBACK_TYPE_VOD = 0; // 0x0
|
||||
field public static final int PLAYBACK_TYPE_LIVE = 2; // 0x2
|
||||
field public static final int PLAYBACK_TYPE_OTHER = 3; // 0x3
|
||||
field public static final int PLAYBACK_TYPE_UNKNOWN = 0; // 0x0
|
||||
field public static final int PLAYBACK_TYPE_VOD = 1; // 0x1
|
||||
field public static final int STREAM_SOURCE_DEVICE = 2; // 0x2
|
||||
field public static final int STREAM_SOURCE_MIXED = 3; // 0x3
|
||||
field public static final int STREAM_SOURCE_NETWORK = 1; // 0x1
|
||||
@@ -24524,9 +24564,11 @@ package android.media.metrics {
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics build();
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setAudioUnderrunCount(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setContentType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setDrmSessionId(@NonNull byte[]);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setDrmType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setLocalBytesRead(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setMediaDurationMillis(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setMetricsBundle(@NonNull android.os.Bundle);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkBytesRead(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkTransferDurationMillis(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlaybackType(int);
|
||||
@@ -24540,7 +24582,7 @@ package android.media.metrics {
|
||||
|
||||
public final class PlaybackSession implements java.lang.AutoCloseable {
|
||||
method public void close();
|
||||
method @NonNull public String getId();
|
||||
method @NonNull public android.media.metrics.LogSessionId getSessionId();
|
||||
method public void reportNetworkEvent(@NonNull android.media.metrics.NetworkEvent);
|
||||
method public void reportPlaybackErrorEvent(@NonNull android.media.metrics.PlaybackErrorEvent);
|
||||
method public void reportPlaybackMetrics(@NonNull android.media.metrics.PlaybackMetrics);
|
||||
@@ -24573,13 +24615,19 @@ package android.media.metrics {
|
||||
public static final class PlaybackStateEvent.Builder {
|
||||
ctor public PlaybackStateEvent.Builder();
|
||||
method @NonNull public android.media.metrics.PlaybackStateEvent build();
|
||||
method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
|
||||
method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setState(int);
|
||||
method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
}
|
||||
|
||||
public final class RecordingSession implements java.lang.AutoCloseable {
|
||||
method public void close();
|
||||
method @NonNull public android.media.metrics.LogSessionId getSessionId();
|
||||
}
|
||||
|
||||
public final class TrackChangeEvent extends android.media.metrics.Event implements android.os.Parcelable {
|
||||
ctor public TrackChangeEvent(int, int, @Nullable String, @Nullable String, @Nullable String, int, long, int, @Nullable String, @Nullable String, int, int, int, int);
|
||||
method public int describeContents();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getAudioSampleRate();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getBitrate();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getChannelCount();
|
||||
method @Nullable public String getCodecName();
|
||||
@@ -24588,10 +24636,10 @@ package android.media.metrics {
|
||||
method @Nullable public String getLanguage();
|
||||
method @Nullable public String getLanguageRegion();
|
||||
method @Nullable public String getSampleMimeType();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getSampleRate();
|
||||
method public int getTrackChangeReason();
|
||||
method public int getTrackState();
|
||||
method public int getTrackType();
|
||||
method @FloatRange(from=0xffffffff, to=java.lang.Float.MAX_VALUE) public float getVideoFrameRate();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getWidth();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.TrackChangeEvent> CREATOR;
|
||||
@@ -24610,6 +24658,7 @@ package android.media.metrics {
|
||||
public static final class TrackChangeEvent.Builder {
|
||||
ctor public TrackChangeEvent.Builder(int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent build();
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setAudioSampleRate(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setBitrate(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setChannelCount(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setCodecName(@NonNull String);
|
||||
@@ -24617,11 +24666,12 @@ package android.media.metrics {
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setHeight(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setLanguage(@NonNull String);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setLanguageRegion(@NonNull String);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setSampleMimeType(@NonNull String);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setSampleRate(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTrackChangeReason(int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTrackState(int);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setVideoFrameRate(@FloatRange(from=0xffffffff, to=java.lang.Float.MAX_VALUE) float);
|
||||
method @NonNull public android.media.metrics.TrackChangeEvent.Builder setWidth(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
}
|
||||
|
||||
|
||||
@@ -1475,6 +1475,14 @@ package android.media.audiopolicy {
|
||||
|
||||
}
|
||||
|
||||
package android.media.metrics {
|
||||
|
||||
public final class LogSessionId {
|
||||
method @NonNull public String getStringId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media.tv {
|
||||
|
||||
public final class TvInputManager {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.media.metrics;
|
||||
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ import android.os.Bundle;
|
||||
*/
|
||||
public abstract class Event {
|
||||
final long mTimeSinceCreatedMillis;
|
||||
Bundle mExtras;
|
||||
Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
// hide default constructor
|
||||
/* package */ Event() {
|
||||
@@ -38,7 +39,7 @@ public abstract class Event {
|
||||
|
||||
/* package */ Event(long timeSinceCreatedMillis, Bundle extras) {
|
||||
mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
mExtras = extras;
|
||||
mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,8 +51,12 @@ public abstract class Event {
|
||||
return mTimeSinceCreatedMillis;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Bundle getExtras() {
|
||||
return mExtras;
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,19 +16,28 @@
|
||||
|
||||
package android.media.metrics;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.TestApi;
|
||||
|
||||
/**
|
||||
* An instances of this class represents the ID of a log session.
|
||||
* @hide
|
||||
*/
|
||||
public class LogSessionId {
|
||||
public final class LogSessionId {
|
||||
private final String mSessionId;
|
||||
|
||||
/* package */ LogSessionId(String id) {
|
||||
/* package */ LogSessionId(@NonNull String id) {
|
||||
mSessionId = id;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@TestApi
|
||||
@NonNull
|
||||
public String getStringId() {
|
||||
return mSessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mSessionId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ public class MediaMetricsManager {
|
||||
|
||||
/**
|
||||
* Creates a recording session.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public RecordingSession createRecordingSession() {
|
||||
|
||||
@@ -32,10 +32,7 @@ import java.util.Objects;
|
||||
* Media network event.
|
||||
*/
|
||||
public final class NetworkEvent extends Event implements Parcelable {
|
||||
/** Network type is not specified. Default type. */
|
||||
public static final int NETWORK_TYPE_NONE = 0;
|
||||
// TODO: replace NONE with UNKNOWN
|
||||
/** @hide */
|
||||
/** Network type is not known. Default type. */
|
||||
public static final int NETWORK_TYPE_UNKNOWN = 0;
|
||||
/** Other network type */
|
||||
public static final int NETWORK_TYPE_OTHER = 1;
|
||||
@@ -54,7 +51,6 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
/** 5G SA network */
|
||||
public static final int NETWORK_TYPE_5G_SA = 8;
|
||||
/** Not network connected */
|
||||
/** @hide */
|
||||
public static final int NETWORK_TYPE_OFFLINE = 9;
|
||||
|
||||
private final int mNetworkType;
|
||||
@@ -62,7 +58,6 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = "NETWORK_TYPE_", value = {
|
||||
NETWORK_TYPE_NONE,
|
||||
NETWORK_TYPE_UNKNOWN,
|
||||
NETWORK_TYPE_OTHER,
|
||||
NETWORK_TYPE_WIFI,
|
||||
@@ -83,8 +78,8 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
*/
|
||||
public static String networkTypeToString(@NetworkType int value) {
|
||||
switch (value) {
|
||||
case NETWORK_TYPE_NONE:
|
||||
return "NETWORK_TYPE_NONE";
|
||||
case NETWORK_TYPE_UNKNOWN:
|
||||
return "NETWORK_TYPE_UNKNOWN";
|
||||
case NETWORK_TYPE_OTHER:
|
||||
return "NETWORK_TYPE_OTHER";
|
||||
case NETWORK_TYPE_WIFI:
|
||||
@@ -114,10 +109,10 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
|
||||
@Nullable Bundle extras) {
|
||||
@NonNull Bundle extras) {
|
||||
this.mNetworkType = type;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mExtras = extras == null ? null : extras.deepCopy();
|
||||
this.mMetricsBundle = extras == null ? null : extras.deepCopy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,6 +133,16 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
return mTimeSinceCreatedMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@Override
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NetworkEvent { "
|
||||
@@ -162,12 +167,9 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
|
||||
byte flg = 0;
|
||||
if (mExtras != null) flg |= 0x1;
|
||||
dest.writeByte(flg);
|
||||
dest.writeInt(mNetworkType);
|
||||
dest.writeLong(mTimeSinceCreatedMillis);
|
||||
if (mExtras != null) dest.writeBundle(mExtras);
|
||||
dest.writeBundle(mMetricsBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,14 +179,13 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
/* package-private */ NetworkEvent(@NonNull android.os.Parcel in) {
|
||||
byte flg = in.readByte();
|
||||
int type = in.readInt();
|
||||
long timeSinceCreatedMillis = in.readLong();
|
||||
Bundle extras = (flg & 0x2) == 0 ? null : in.readBundle();
|
||||
Bundle extras = in.readBundle();
|
||||
|
||||
this.mNetworkType = type;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mExtras = extras;
|
||||
this.mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,9 +208,9 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
* A builder for {@link NetworkEvent}
|
||||
*/
|
||||
public static final class Builder {
|
||||
private int mNetworkType = NETWORK_TYPE_NONE;
|
||||
private int mNetworkType = NETWORK_TYPE_UNKNOWN;
|
||||
private long mTimeSinceCreatedMillis = -1;
|
||||
private Bundle mExtras;
|
||||
private Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
@@ -236,18 +237,20 @@ public final class NetworkEvent extends Event implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extras for compatibility.
|
||||
* <p>Should be used by support library only.
|
||||
* @hide
|
||||
* Sets metrics-related information that is not supported by dedicated
|
||||
* methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the
|
||||
* metrics infrastructure.
|
||||
*/
|
||||
public @NonNull Builder setExtras(@NonNull Bundle extras) {
|
||||
mExtras = extras;
|
||||
public @NonNull Builder setMetricsBundle(@NonNull Bundle metricsBundle) {
|
||||
mMetricsBundle = metricsBundle;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the instance. */
|
||||
public @NonNull NetworkEvent build() {
|
||||
NetworkEvent o = new NetworkEvent(mNetworkType, mTimeSinceCreatedMillis, mExtras);
|
||||
NetworkEvent o =
|
||||
new NetworkEvent(mNetworkType, mTimeSinceCreatedMillis, mMetricsBundle);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,77 @@ import java.util.Objects;
|
||||
*/
|
||||
public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
/** Unknown error code. */
|
||||
public static final int ERROR_CODE_UNKNOWN = 0;
|
||||
public static final int ERROR_UNKNOWN = 0;
|
||||
/** Error code for other errors */
|
||||
public static final int ERROR_CODE_OTHER = 1;
|
||||
public static final int ERROR_OTHER = 1;
|
||||
/** Error code for runtime errors */
|
||||
public static final int ERROR_CODE_RUNTIME = 2;
|
||||
public static final int ERROR_RUNTIME = 2;
|
||||
|
||||
/** No network */
|
||||
public static final int ERROR_NETWORK_OFFLINE = 3;
|
||||
/** Connection opening error */
|
||||
public static final int ERROR_NETWORK_CONNECT = 4;
|
||||
/** Bad HTTP status code */
|
||||
public static final int ERROR_NETWORK_BAD_STATUS = 5;
|
||||
/** DNS resolution error */
|
||||
public static final int ERROR_NETWORK_DNS = 6;
|
||||
/** Network socket timeout */
|
||||
public static final int ERROR_NETWORK_TIMEOUT = 7;
|
||||
/** Connection closed */
|
||||
public static final int ERROR_NETWORK_CLOSED = 8;
|
||||
/** Other network errors */
|
||||
public static final int ERROR_NETWORK_OTHER = 9;
|
||||
|
||||
/** Manifest parsing error */
|
||||
public static final int ERROR_MEDIA_MANIFEST = 10;
|
||||
/**
|
||||
* Media bitstream (audio, video, text, metadata) parsing error, either malformed or
|
||||
* unsupported.
|
||||
*/
|
||||
public static final int ERROR_MEDIA_PARSER = 11;
|
||||
/** Other media errors */
|
||||
public static final int ERROR_MEDIA_OTHER = 12;
|
||||
|
||||
/** Codec initialization failed */
|
||||
public static final int ERROR_DECODER_INIT = 13;
|
||||
/** Decoding failed */
|
||||
public static final int ERROR_DECODER_DECODE = 14;
|
||||
/** Out of memory */
|
||||
public static final int ERROR_DECODER_OOM = 15;
|
||||
/** Other decoder errors */
|
||||
public static final int ERROR_DECODER_OTHER = 16;
|
||||
|
||||
/** AudioTrack initialization failed */
|
||||
public static final int ERROR_AUDIOTRACK_INIT = 17;
|
||||
/** AudioTrack writing failed */
|
||||
public static final int ERROR_AUDIOTRACK_WRITE = 18;
|
||||
/** Other AudioTrack errors */
|
||||
public static final int ERROR_AUDIOTRACK_OTHER = 19;
|
||||
|
||||
/** Exception in remote controller or player */
|
||||
public static final int ERROR_PLAYER_REMOTE = 20;
|
||||
/** Error when a Live playback falls behind the Live DVR window. */
|
||||
public static final int ERROR_PLAYER_BEHIND_LIVE_WINDOW = 21;
|
||||
/** Other player errors */
|
||||
public static final int ERROR_PLAYER_OTHER = 22;
|
||||
|
||||
/** Scheme unsupported by device */
|
||||
public static final int ERROR_DRM_UNAVAILABLE = 23;
|
||||
/** Provisioning failed */
|
||||
public static final int ERROR_DRM_PROVISIONING_FAILED = 24;
|
||||
/** Failed to acquire license */
|
||||
public static final int ERROR_DRM_LICENSE_ERROR = 25;
|
||||
/** Operation prevented by license policy */
|
||||
public static final int ERROR_DRM_DISALLOWED = 26;
|
||||
/** Failure in the DRM system */
|
||||
public static final int ERROR_DRM_SYSTEM_ERROR = 27;
|
||||
/** Incompatible content */
|
||||
public static final int ERROR_DRM_CONTENT_ERROR = 28;
|
||||
/** Device has been revoked */
|
||||
public static final int ERROR_DRM_REVOKED = 29;
|
||||
/** Other drm errors */
|
||||
public static final int ERROR_DRM_OTHER = 30;
|
||||
|
||||
|
||||
private final @Nullable String mExceptionStack;
|
||||
private final int mErrorCode;
|
||||
@@ -46,11 +112,38 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
|
||||
|
||||
/** @hide */
|
||||
// TODO: more error types
|
||||
@IntDef(prefix = "ERROR_CODE_", value = {
|
||||
ERROR_CODE_UNKNOWN,
|
||||
ERROR_CODE_OTHER,
|
||||
ERROR_CODE_RUNTIME
|
||||
@IntDef(prefix = "ERROR_", value = {
|
||||
ERROR_UNKNOWN,
|
||||
ERROR_OTHER,
|
||||
ERROR_RUNTIME,
|
||||
ERROR_NETWORK_OFFLINE,
|
||||
ERROR_NETWORK_CONNECT,
|
||||
ERROR_NETWORK_BAD_STATUS,
|
||||
ERROR_NETWORK_DNS,
|
||||
ERROR_NETWORK_TIMEOUT,
|
||||
ERROR_NETWORK_CLOSED,
|
||||
ERROR_NETWORK_OTHER,
|
||||
ERROR_MEDIA_MANIFEST,
|
||||
ERROR_MEDIA_PARSER,
|
||||
ERROR_MEDIA_OTHER,
|
||||
ERROR_DECODER_INIT,
|
||||
ERROR_DECODER_DECODE,
|
||||
ERROR_DECODER_OOM,
|
||||
ERROR_DECODER_OTHER,
|
||||
ERROR_AUDIOTRACK_INIT,
|
||||
ERROR_AUDIOTRACK_WRITE,
|
||||
ERROR_AUDIOTRACK_OTHER,
|
||||
ERROR_PLAYER_REMOTE,
|
||||
ERROR_PLAYER_BEHIND_LIVE_WINDOW,
|
||||
ERROR_PLAYER_OTHER,
|
||||
ERROR_DRM_UNAVAILABLE,
|
||||
ERROR_DRM_PROVISIONING_FAILED,
|
||||
ERROR_DRM_LICENSE_ERROR,
|
||||
ERROR_DRM_DISALLOWED,
|
||||
ERROR_DRM_SYSTEM_ERROR,
|
||||
ERROR_DRM_CONTENT_ERROR,
|
||||
ERROR_DRM_REVOKED,
|
||||
ERROR_DRM_OTHER,
|
||||
})
|
||||
@Retention(java.lang.annotation.RetentionPolicy.SOURCE)
|
||||
public @interface ErrorCode {}
|
||||
@@ -65,12 +158,12 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
int errorCode,
|
||||
int subErrorCode,
|
||||
long timeSinceCreatedMillis,
|
||||
@Nullable Bundle extras) {
|
||||
@NonNull Bundle extras) {
|
||||
this.mExceptionStack = exceptionStack;
|
||||
this.mErrorCode = errorCode;
|
||||
this.mSubErrorCode = subErrorCode;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mExtras = extras == null ? null : extras.deepCopy();
|
||||
this.mMetricsBundle = extras.deepCopy();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@@ -107,6 +200,16 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
return mTimeSinceCreatedMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@Override
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlaybackErrorEvent { "
|
||||
@@ -138,13 +241,12 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
byte flg = 0;
|
||||
if (mExceptionStack != null) flg |= 0x1;
|
||||
if (mExtras != null) flg |= 0x2;
|
||||
dest.writeByte(flg);
|
||||
if (mExceptionStack != null) dest.writeString(mExceptionStack);
|
||||
dest.writeInt(mErrorCode);
|
||||
dest.writeInt(mSubErrorCode);
|
||||
dest.writeLong(mTimeSinceCreatedMillis);
|
||||
if (mExtras != null) dest.writeBundle(mExtras);
|
||||
dest.writeBundle(mMetricsBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,13 +261,13 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
int errorCode = in.readInt();
|
||||
int subErrorCode = in.readInt();
|
||||
long timeSinceCreatedMillis = in.readLong();
|
||||
Bundle extras = (flg & 0x2) == 0 ? null : in.readBundle();
|
||||
Bundle extras = in.readBundle();
|
||||
|
||||
this.mExceptionStack = exceptionStack;
|
||||
this.mErrorCode = errorCode;
|
||||
this.mSubErrorCode = subErrorCode;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mExtras = extras;
|
||||
this.mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +292,7 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
private int mErrorCode;
|
||||
private int mSubErrorCode;
|
||||
private long mTimeSinceCreatedMillis = -1;
|
||||
private Bundle mExtras;
|
||||
private Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
@@ -235,12 +337,13 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extras for compatibility.
|
||||
* <p>Should be used by support library only.
|
||||
* @hide
|
||||
* Sets metrics-related information that is not supported by dedicated
|
||||
* methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the
|
||||
* metrics infrastructure.
|
||||
*/
|
||||
public @NonNull Builder setExtras(@NonNull Bundle extras) {
|
||||
mExtras = extras;
|
||||
public @NonNull Builder setMetricsBundle(@NonNull Bundle metricsBundle) {
|
||||
mMetricsBundle = metricsBundle;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -260,7 +363,7 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
|
||||
mErrorCode,
|
||||
mSubErrorCode,
|
||||
mTimeSinceCreatedMillis,
|
||||
mExtras);
|
||||
mMetricsBundle);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,15 +60,13 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
public static final int STREAM_TYPE_SS = 5;
|
||||
|
||||
/** Unknown playback type. */
|
||||
// TODO: change the PLAYBACK_TYPE_ values
|
||||
/** @hide */
|
||||
public static final int PLAYBACK_TYPE_UNKNOWN = 0;
|
||||
/** VOD (Video on Demand) playback type. */
|
||||
public static final int PLAYBACK_TYPE_VOD = 0;
|
||||
public static final int PLAYBACK_TYPE_VOD = 1;
|
||||
/** Live playback type. */
|
||||
public static final int PLAYBACK_TYPE_LIVE = 1;
|
||||
public static final int PLAYBACK_TYPE_LIVE = 2;
|
||||
/** Other playback type. */
|
||||
public static final int PLAYBACK_TYPE_OTHER = 2;
|
||||
public static final int PLAYBACK_TYPE_OTHER = 3;
|
||||
|
||||
/** DRM is not used. */
|
||||
public static final int DRM_TYPE_NONE = 0;
|
||||
@@ -86,15 +84,13 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
public static final int DRM_TYPE_CLEARKEY = 6;
|
||||
|
||||
/** Unknown content type. */
|
||||
// TODO: change the CONTENT_TYPE_ values
|
||||
/** @hide */
|
||||
public static final int CONTENT_TYPE_UNKNOWN = 0;
|
||||
/** Main contents. */
|
||||
public static final int CONTENT_TYPE_MAIN = 0;
|
||||
public static final int CONTENT_TYPE_MAIN = 1;
|
||||
/** Advertisement contents. */
|
||||
public static final int CONTENT_TYPE_AD = 1;
|
||||
public static final int CONTENT_TYPE_AD = 2;
|
||||
/** Other contents. */
|
||||
public static final int CONTENT_TYPE_OTHER = 2;
|
||||
public static final int CONTENT_TYPE_OTHER = 3;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@@ -170,7 +166,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
private final long mLocalBytesRead;
|
||||
private final long mNetworkTransferDurationMillis;
|
||||
private final byte[] mDrmSessionId;
|
||||
private final Bundle mExtras;
|
||||
private final @NonNull Bundle mMetricsBundle;
|
||||
|
||||
/**
|
||||
* Creates a new PlaybackMetrics.
|
||||
@@ -194,7 +190,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
long localBytesRead,
|
||||
long networkTransferDurationMillis,
|
||||
byte[] drmSessionId,
|
||||
@Nullable Bundle extras) {
|
||||
@NonNull Bundle extras) {
|
||||
this.mMediaDurationMillis = mediaDurationMillis;
|
||||
this.mStreamSource = streamSource;
|
||||
this.mStreamType = streamType;
|
||||
@@ -212,7 +208,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
this.mLocalBytesRead = localBytesRead;
|
||||
this.mNetworkTransferDurationMillis = networkTransferDurationMillis;
|
||||
this.mDrmSessionId = drmSessionId;
|
||||
this.mExtras = extras == null ? null : extras.deepCopy();
|
||||
this.mMetricsBundle = extras.deepCopy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,12 +334,23 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
return mNetworkTransferDurationMillis;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* Gets DRM session ID.
|
||||
*/
|
||||
@NonNull
|
||||
public byte[] getDrmSessionId() {
|
||||
return mDrmSessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlaybackMetrics { "
|
||||
@@ -402,7 +409,6 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
long flg = 0;
|
||||
if (mPlayerName != null) flg |= 0x80;
|
||||
if (mPlayerVersion != null) flg |= 0x100;
|
||||
if (mExtras != null) flg |= 0x200;
|
||||
dest.writeLong(flg);
|
||||
dest.writeLong(mMediaDurationMillis);
|
||||
dest.writeInt(mStreamSource);
|
||||
@@ -412,7 +418,6 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
dest.writeInt(mContentType);
|
||||
if (mPlayerName != null) dest.writeString(mPlayerName);
|
||||
if (mPlayerVersion != null) dest.writeString(mPlayerVersion);
|
||||
if (mExtras != null) dest.writeBundle(mExtras);
|
||||
dest.writeLongArray(mExperimentIds);
|
||||
dest.writeInt(mVideoFramesPlayed);
|
||||
dest.writeInt(mVideoFramesDropped);
|
||||
@@ -422,6 +427,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
dest.writeLong(mNetworkTransferDurationMillis);
|
||||
dest.writeInt(mDrmSessionId.length);
|
||||
dest.writeByteArray(mDrmSessionId);
|
||||
dest.writeBundle(mMetricsBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -440,7 +446,6 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
int contentType = in.readInt();
|
||||
String playerName = (flg & 0x80) == 0 ? null : in.readString();
|
||||
String playerVersion = (flg & 0x100) == 0 ? null : in.readString();
|
||||
Bundle extras = (flg & 0x200) == 0 ? null : in.readBundle();
|
||||
long[] experimentIds = in.createLongArray();
|
||||
int videoFramesPlayed = in.readInt();
|
||||
int videoFramesDropped = in.readInt();
|
||||
@@ -451,6 +456,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
int drmSessionIdLen = in.readInt();
|
||||
byte[] drmSessionId = new byte[drmSessionIdLen];
|
||||
in.readByteArray(drmSessionId);
|
||||
Bundle extras = in.readBundle();
|
||||
|
||||
this.mMediaDurationMillis = mediaDurationMillis;
|
||||
this.mStreamSource = streamSource;
|
||||
@@ -469,7 +475,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
this.mLocalBytesRead = localBytesRead;
|
||||
this.mNetworkTransferDurationMillis = networkTransferDurationMillis;
|
||||
this.mDrmSessionId = drmSessionId;
|
||||
this.mExtras = extras;
|
||||
this.mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<PlaybackMetrics> CREATOR =
|
||||
@@ -506,7 +512,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
private long mLocalBytesRead = -1;
|
||||
private long mNetworkTransferDurationMillis = -1;
|
||||
private byte[] mDrmSessionId = new byte[0];
|
||||
private Bundle mExtras;
|
||||
private Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
@@ -646,7 +652,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Sets DRM session ID.
|
||||
*/
|
||||
public @NonNull Builder setDrmSessionId(@NonNull byte[] drmSessionId) {
|
||||
mDrmSessionId = drmSessionId;
|
||||
@@ -654,12 +660,13 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extras for compatibility.
|
||||
* <p>Should be used by support library only.
|
||||
* @hide
|
||||
* Sets metrics-related information that is not supported by dedicated
|
||||
* methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the
|
||||
* metrics infrastructure.
|
||||
*/
|
||||
public @NonNull Builder setExtras(@NonNull Bundle extras) {
|
||||
mExtras = extras;
|
||||
public @NonNull Builder setMetricsBundle(@NonNull Bundle metricsBundle) {
|
||||
mMetricsBundle = metricsBundle;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -683,7 +690,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
mLocalBytesRead,
|
||||
mNetworkTransferDurationMillis,
|
||||
mDrmSessionId,
|
||||
mExtras);
|
||||
mMetricsBundle);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,14 +80,7 @@ public final class PlaybackSession implements AutoCloseable {
|
||||
mManager.reportTrackChangeEvent(mId, event);
|
||||
}
|
||||
|
||||
public @NonNull String getId() {
|
||||
// TODO: remove this method and use getSessionId();
|
||||
return mId;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public @NonNull LogSessionId getSessionId() {
|
||||
// TODO: remove getId() and use this method;
|
||||
return mLogSessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,10 +138,10 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
public PlaybackStateEvent(
|
||||
int state,
|
||||
long timeSinceCreatedMillis,
|
||||
@Nullable Bundle extras) {
|
||||
@NonNull Bundle extras) {
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mState = state;
|
||||
this.mExtras = extras == null ? null : extras.deepCopy();
|
||||
this.mMetricsBundle = extras.deepCopy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,6 +161,16 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
return mTimeSinceCreatedMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@Override
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) return true;
|
||||
@@ -177,12 +187,9 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
byte flg = 0;
|
||||
if (mExtras != null) flg |= 0x1;
|
||||
dest.writeByte(flg);
|
||||
dest.writeInt(mState);
|
||||
dest.writeLong(mTimeSinceCreatedMillis);
|
||||
if (mExtras != null) dest.writeBundle(mExtras);
|
||||
dest.writeBundle(mMetricsBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,14 +199,13 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
/* package-private */ PlaybackStateEvent(@NonNull Parcel in) {
|
||||
byte flg = in.readByte();
|
||||
int state = in.readInt();
|
||||
long timeSinceCreatedMillis = in.readLong();
|
||||
Bundle extras = (flg & 0x1) == 0 ? null : in.readBundle();
|
||||
Bundle extras = in.readBundle();
|
||||
|
||||
this.mState = state;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mExtras = extras;
|
||||
this.mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<PlaybackStateEvent> CREATOR =
|
||||
@@ -221,7 +227,7 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
public static final class Builder {
|
||||
private int mState = STATE_NOT_STARTED;
|
||||
private long mTimeSinceCreatedMillis = -1;
|
||||
private Bundle mExtras;
|
||||
private Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
@@ -248,12 +254,13 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extras for compatibility.
|
||||
* <p>Should be used by support library only.
|
||||
* @hide
|
||||
* Sets metrics-related information that is not supported by dedicated
|
||||
* methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the
|
||||
* metrics infrastructure.
|
||||
*/
|
||||
public @NonNull Builder setExtras(@NonNull Bundle extras) {
|
||||
mExtras = extras;
|
||||
public @NonNull Builder setMetricsBundle(@NonNull Bundle metricsBundle) {
|
||||
mMetricsBundle = metricsBundle;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -262,7 +269,7 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
|
||||
PlaybackStateEvent o = new PlaybackStateEvent(
|
||||
mState,
|
||||
mTimeSinceCreatedMillis,
|
||||
mExtras);
|
||||
mMetricsBundle);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* An instances of this class represents a session of media recording.
|
||||
* @hide
|
||||
*/
|
||||
public final class RecordingSession implements AutoCloseable {
|
||||
private final @NonNull String mId;
|
||||
@@ -42,6 +41,10 @@ public final class RecordingSession implements AutoCloseable {
|
||||
mLogSessionId = new LogSessionId(mId);
|
||||
}
|
||||
|
||||
public @NonNull LogSessionId getSessionId() {
|
||||
return mLogSessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -102,39 +102,6 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface TrackType {}
|
||||
|
||||
// TODO: remove this constructor. Use the private one below.
|
||||
public TrackChangeEvent(
|
||||
int state,
|
||||
int reason,
|
||||
@Nullable String containerMimeType,
|
||||
@Nullable String sampleMimeType,
|
||||
@Nullable String codecName,
|
||||
int bitrate,
|
||||
long timeSinceCreatedMillis,
|
||||
int type,
|
||||
@Nullable String language,
|
||||
@Nullable String languageRegion,
|
||||
int channelCount,
|
||||
int sampleRate,
|
||||
int width,
|
||||
int height) {
|
||||
this.mState = state;
|
||||
this.mReason = reason;
|
||||
this.mContainerMimeType = containerMimeType;
|
||||
this.mSampleMimeType = sampleMimeType;
|
||||
this.mCodecName = codecName;
|
||||
this.mBitrate = bitrate;
|
||||
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
|
||||
this.mType = type;
|
||||
this.mLanguage = language;
|
||||
this.mLanguageRegion = languageRegion;
|
||||
this.mChannelCount = channelCount;
|
||||
this.mAudioSampleRate = sampleRate;
|
||||
this.mWidth = width;
|
||||
this.mHeight = height;
|
||||
this.mVideoFrameRate = -1;
|
||||
}
|
||||
|
||||
private TrackChangeEvent(
|
||||
int state,
|
||||
int reason,
|
||||
@@ -151,7 +118,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
int width,
|
||||
int height,
|
||||
float videoFrameRate,
|
||||
@Nullable Bundle extras) {
|
||||
@NonNull Bundle extras) {
|
||||
this.mState = state;
|
||||
this.mReason = reason;
|
||||
this.mContainerMimeType = containerMimeType;
|
||||
@@ -167,7 +134,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
this.mWidth = width;
|
||||
this.mHeight = height;
|
||||
this.mVideoFrameRate = videoFrameRate;
|
||||
this.mExtras = extras == null ? null : extras.deepCopy();
|
||||
this.mMetricsBundle = extras.deepCopy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,11 +225,11 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets sample rate.
|
||||
* Gets audio sample rate.
|
||||
* @return the sample rate, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE)
|
||||
public int getSampleRate() {
|
||||
public int getAudioSampleRate() {
|
||||
return mAudioSampleRate;
|
||||
}
|
||||
|
||||
@@ -287,13 +254,22 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
/**
|
||||
* Gets video frame rate.
|
||||
* @return the video frame rate, or -1 if unknown.
|
||||
* @hide
|
||||
*/
|
||||
@FloatRange(from = -1, to = Float.MAX_VALUE)
|
||||
public float getVideoFrameRate() {
|
||||
return mVideoFrameRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metrics-related information that is not supported by dedicated methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the metrics infrastructure.
|
||||
*/
|
||||
@Override
|
||||
@NonNull
|
||||
public Bundle getMetricsBundle() {
|
||||
return mMetricsBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
int flg = 0;
|
||||
@@ -302,7 +278,6 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
if (mCodecName != null) flg |= 0x10;
|
||||
if (mLanguage != null) flg |= 0x100;
|
||||
if (mLanguageRegion != null) flg |= 0x200;
|
||||
if (mExtras != null) flg |= 0x400;
|
||||
dest.writeInt(flg);
|
||||
dest.writeInt(mState);
|
||||
dest.writeInt(mReason);
|
||||
@@ -319,7 +294,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
dest.writeInt(mWidth);
|
||||
dest.writeInt(mHeight);
|
||||
dest.writeFloat(mVideoFrameRate);
|
||||
if (mExtras != null) dest.writeBundle(mExtras);
|
||||
dest.writeBundle(mMetricsBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -345,7 +320,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
int width = in.readInt();
|
||||
int height = in.readInt();
|
||||
float videoFrameRate = in.readFloat();
|
||||
Bundle extras = (flg & 0x400) == 0 ? null : in.readBundle();
|
||||
Bundle extras = in.readBundle();
|
||||
|
||||
this.mState = state;
|
||||
this.mReason = reason;
|
||||
@@ -362,7 +337,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
this.mWidth = width;
|
||||
this.mHeight = height;
|
||||
this.mVideoFrameRate = videoFrameRate;
|
||||
this.mExtras = extras;
|
||||
this.mMetricsBundle = extras;
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<TrackChangeEvent> CREATOR =
|
||||
@@ -448,7 +423,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
private int mWidth = -1;
|
||||
private int mHeight = -1;
|
||||
private float mVideoFrameRate = -1;
|
||||
private Bundle mExtras;
|
||||
private Bundle mMetricsBundle = new Bundle();
|
||||
|
||||
private long mBuilderFieldsSet = 0L;
|
||||
|
||||
@@ -571,9 +546,8 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
* Sets sample rate.
|
||||
* @param value the sample rate. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setSampleRate(
|
||||
public @NonNull Builder setAudioSampleRate(
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE) int value) {
|
||||
// TODO: rename it to setAudioSampleRate
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x800;
|
||||
mAudioSampleRate = value;
|
||||
@@ -605,7 +579,6 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
/**
|
||||
* Sets video frame rate.
|
||||
* @param value the video frame rate. -1 indicates the value is unknown.
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull Builder setVideoFrameRate(
|
||||
@FloatRange(from = -1, to = Float.MAX_VALUE) float value) {
|
||||
@@ -615,12 +588,13 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extras for compatibility.
|
||||
* <p>Should be used by support library only.
|
||||
* @hide
|
||||
* Sets metrics-related information that is not supported by dedicated
|
||||
* methods.
|
||||
* <p>It is intended to be used for backwards compatibility by the
|
||||
* metrics infrastructure.
|
||||
*/
|
||||
public @NonNull Builder setExtras(@NonNull Bundle extras) {
|
||||
mExtras = extras;
|
||||
public @NonNull Builder setMetricsBundle(@NonNull Bundle metricsBundle) {
|
||||
mMetricsBundle = metricsBundle;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -645,7 +619,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
|
||||
mWidth,
|
||||
mHeight,
|
||||
mVideoFrameRate,
|
||||
mExtras);
|
||||
mMetricsBundle);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ public final class MediaMetricsManagerService extends SystemService {
|
||||
.writeLong(metrics.getNetworkBytesRead())
|
||||
.writeLong(metrics.getLocalBytesRead())
|
||||
.writeLong(metrics.getNetworkTransferDurationMillis())
|
||||
// Raw bytes type not allowed in atoms
|
||||
.writeString(Base64.encodeToString(metrics.getDrmSessionId(), Base64.DEFAULT))
|
||||
.usePooledBuffer()
|
||||
.build();
|
||||
StatsLog.write(statsEvent);
|
||||
@@ -154,9 +156,10 @@ public final class MediaMetricsManagerService extends SystemService {
|
||||
.writeString(event.getLanguage())
|
||||
.writeString(event.getLanguageRegion())
|
||||
.writeInt(event.getChannelCount())
|
||||
.writeInt(event.getSampleRate())
|
||||
.writeInt(event.getAudioSampleRate())
|
||||
.writeInt(event.getWidth())
|
||||
.writeInt(event.getHeight())
|
||||
.writeFloat(event.getVideoFrameRate())
|
||||
.usePooledBuffer()
|
||||
.build();
|
||||
StatsLog.write(statsEvent);
|
||||
|
||||
Reference in New Issue
Block a user