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

Commit bc6f53f0 authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "Media metrics APIs: changes based on API review" into sc-dev

parents 8b7253d3 ccb090fe
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -24614,7 +24614,6 @@ package android.media.effect {
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();
  }
@@ -24624,7 +24623,7 @@ package android.media.metrics {
    field @NonNull public static final android.media.metrics.LogSessionId LOG_SESSION_ID_NONE;
  }
  public class MediaMetricsManager {
  public final 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
+4 −6
Original line number Diff line number Diff line
@@ -32,19 +32,17 @@ public abstract class Event {
        mTimeSinceCreatedMillis = MediaMetricsManager.INVALID_TIMESTAMP;
    }

    // TODO: remove
    protected Event(long timeSinceCreatedMillis) {
        mTimeSinceCreatedMillis = timeSinceCreatedMillis;
    }

    /* package */ Event(long timeSinceCreatedMillis, Bundle extras) {
        mTimeSinceCreatedMillis = timeSinceCreatedMillis;
        mMetricsBundle = extras;
    }

    /**
     * Gets time since the corresponding instance is created in millisecond.
     * Gets time since the corresponding log session is created in millisecond.
     * @return the timestamp since the instance is created, or -1 if unknown.
     * @see LogSessionId
     * @see PlaybackSession
     * @see RecordingSession
     */
    @IntRange(from = -1)
    public long getTimeSinceCreatedMillis() {
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import android.os.RemoteException;
 * This class gives information about, and interacts with media metrics.
 */
@SystemService(Context.MEDIA_METRICS_SERVICE)
public class MediaMetricsManager {
public final class MediaMetricsManager {
    public static final long INVALID_TIMESTAMP = -1;

    private static final String TAG = "MediaMetricsManager";
+7 −6
Original line number Diff line number Diff line
@@ -105,10 +105,8 @@ public final class NetworkEvent extends Event implements Parcelable {

    /**
     * Creates a new NetworkEvent.
     *
     * @hide
     */
    public NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
    private NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
            @NonNull Bundle extras) {
        this.mNetworkType = type;
        this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
@@ -124,8 +122,11 @@ public final class NetworkEvent extends Event implements Parcelable {
    }

    /**
     * Gets timestamp since the creation in milliseconds.
     * Gets timestamp since the creation of the log session in milliseconds.
     * @return the timestamp since the creation in milliseconds, or -1 if unknown.
     * @see LogSessionId
     * @see PlaybackSession
     * @see RecordingSession
     */
    @Override
    @IntRange(from = -1)
@@ -177,8 +178,7 @@ public final class NetworkEvent extends Event implements Parcelable {
        return 0;
    }

    /** @hide */
    /* package-private */ NetworkEvent(@NonNull android.os.Parcel in) {
    private NetworkEvent(@NonNull android.os.Parcel in) {
        int type = in.readInt();
        long timeSinceCreatedMillis = in.readLong();
        Bundle extras = in.readBundle();
@@ -230,6 +230,7 @@ public final class NetworkEvent extends Event implements Parcelable {
         * Sets timestamp since the creation in milliseconds.
         * @param value the timestamp since the creation in milliseconds.
         *              -1 indicates the value is unknown.
         * @see #getTimeSinceCreatedMillis()
         */
        public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
            mTimeSinceCreatedMillis = value;
+6 −6
Original line number Diff line number Diff line
@@ -150,10 +150,8 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {

    /**
     * Creates a new PlaybackErrorEvent.
     *
     * @hide
     */
    public PlaybackErrorEvent(
    private PlaybackErrorEvent(
            @Nullable String exceptionStack,
            int errorCode,
            int subErrorCode,
@@ -191,8 +189,10 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
    }

    /**
     * Gets the timestamp since creation in milliseconds.
     * Gets the timestamp since creation of the playback session in milliseconds.
     * @return the timestamp since the playback is created, or -1 if unknown.
     * @see LogSessionId
     * @see PlaybackSession
     */
    @Override
    @IntRange(from = -1)
@@ -254,8 +254,7 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
        return 0;
    }

    /** @hide */
    /* package-private */ PlaybackErrorEvent(@NonNull Parcel in) {
    private PlaybackErrorEvent(@NonNull Parcel in) {
        byte flg = in.readByte();
        String exceptionStack = (flg & 0x1) == 0 ? null : in.readString();
        int errorCode = in.readInt();
@@ -330,6 +329,7 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
         * Set the timestamp since creation in milliseconds.
         * @param value the timestamp since the creation in milliseconds.
         *              -1 indicates the value is unknown.
         * @see #getTimeSinceCreatedMillis()
         */
        public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
            mTimeSinceCreatedMillis = value;
Loading