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

Commit 13b7a1a0 authored by Ray Essick's avatar Ray Essick Committed by Automerger Merge Worker
Browse files

Merge "Integrate feedback from MediaMetrics API reviews" into tm-dev am: 48d5cfa8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17324036

Change-Id: I7e3bd6f8d54a105d97ae7fb63bc35ebc5bb9545b
parents bc735028 48d5cfa8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24461,6 +24461,7 @@ package android.media.metrics {
    method public void close();
    method @NonNull public android.media.metrics.LogSessionId getSessionId();
    method public void reportBundleMetrics(@NonNull android.os.PersistableBundle);
    field public static final String KEY_STATSD_ATOM = "bundlesession-statsd-atom";
  }
  public final class EditingSession implements java.lang.AutoCloseable {
@@ -24484,6 +24485,7 @@ package android.media.metrics {
    method @NonNull public android.media.metrics.PlaybackSession createPlaybackSession();
    method @NonNull public android.media.metrics.RecordingSession createRecordingSession();
    method @NonNull public android.media.metrics.TranscodingSession createTranscodingSession();
    method @NonNull public void releaseSessionId(@NonNull String);
    field public static final long INVALID_TIMESTAMP = -1L; // 0xffffffffffffffffL
  }
+14 −0
Original line number Diff line number Diff line
@@ -32,6 +32,15 @@ public final class BundleSession implements AutoCloseable {
    private final @NonNull MediaMetricsManager mManager;
    private final @NonNull LogSessionId mLogSessionId;

    /**
     * A key describing the statsd atom into which to place this bundle's other contents.
     * The associated value is an integer.
     *
     * @see #reportBundleMetrics
     */

    public static final String KEY_STATSD_ATOM = "bundlesession-statsd-atom";

    /** @hide */
    public BundleSession(@NonNull String id, @NonNull MediaMetricsManager manager) {
        mId = id;
@@ -44,6 +53,10 @@ public final class BundleSession implements AutoCloseable {
    /**
     * Reports metrics via bundle.
     *
     * The key {@link #KEY_STATSD_ATOM} references an integer value that
     * indicates the statsd atom for the data in this bundle. Other keys
     * and their types are defined on a per-atom basis.
     *
     */
    public void reportBundleMetrics(@NonNull PersistableBundle metrics) {
        mManager.reportBundleMetrics(mId, metrics);
@@ -68,5 +81,6 @@ public final class BundleSession implements AutoCloseable {

    @Override
    public void close() {
        mManager.releaseSessionId(mLogSessionId.getStringId());
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -59,5 +59,6 @@ public final class EditingSession implements AutoCloseable {

    @Override
    public void close() {
        mManager.releaseSessionId(mLogSessionId.getStringId());
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -41,4 +41,6 @@ interface IMediaMetricsManager {
    String getEditingSessionId(int userId);
    String getBundleSessionId(int userId);
    void reportBundleMetrics(in String sessionId, in PersistableBundle metrics, int userId);

    void releaseSessionId(in String sessionId, int userId);
}
+12 −0
Original line number Diff line number Diff line
@@ -170,6 +170,18 @@ public final class MediaMetricsManager {
        }
    }

    /**
     * Creates a generic bundle session.
     */
    @NonNull
    public void releaseSessionId(@NonNull String sessionId) {
        try {
            mService.releaseSessionId(sessionId, mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Reports error event.
     * @hide
Loading