Merge "MediaMetricsManager: Authorize log session ids" into sc-v2-dev
This commit is contained in:
@@ -53,6 +53,7 @@ public class MediaMetrics {
|
||||
public static final String AUDIO_VOLUME = AUDIO + SEPARATOR + "volume";
|
||||
public static final String AUDIO_VOLUME_EVENT = AUDIO_VOLUME + SEPARATOR + "event";
|
||||
public static final String AUDIO_MODE = AUDIO + SEPARATOR + "mode";
|
||||
public static final String METRICS_MANAGER = "metrics" + SEPARATOR + "manager";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,10 +121,11 @@ public class MediaMetrics {
|
||||
createKey("gainDb", Double.class);
|
||||
public static final Key<String> GROUP =
|
||||
createKey("group", String.class);
|
||||
// For volume
|
||||
public static final Key<Integer> INDEX = createKey("index", Integer.class);
|
||||
public static final Key<Integer> MAX_INDEX = createKey("maxIndex", Integer.class);
|
||||
public static final Key<Integer> MIN_INDEX = createKey("minIndex", Integer.class);
|
||||
|
||||
public static final Key<Integer> INDEX = createKey("index", Integer.class); // volume
|
||||
public static final Key<String> LOG_SESSION_ID = createKey("logSessionId", String.class);
|
||||
public static final Key<Integer> MAX_INDEX = createKey("maxIndex", Integer.class); // vol
|
||||
public static final Key<Integer> MIN_INDEX = createKey("minIndex", Integer.class); // vol
|
||||
public static final Key<String> MODE =
|
||||
createKey("mode", String.class); // audio_mode
|
||||
public static final Key<String> MUTE =
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.media.metrics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.MediaMetrics;
|
||||
import android.media.metrics.IMediaMetricsManager;
|
||||
import android.media.metrics.NetworkEvent;
|
||||
import android.media.metrics.PlaybackErrorEvent;
|
||||
@@ -65,6 +66,8 @@ public final class MediaMetricsManagerService extends SystemService {
|
||||
private static final int LOGGING_LEVEL_NO_UID = 1000;
|
||||
private static final int LOGGING_LEVEL_BLOCKED = 99999;
|
||||
|
||||
private static final String mMetricsId = MediaMetrics.Name.METRICS_MANAGER;
|
||||
|
||||
private static final String FAILED_TO_GET = "failed_to_get";
|
||||
private final SecureRandom mSecureRandom;
|
||||
@GuardedBy("mLock")
|
||||
@@ -199,6 +202,12 @@ public final class MediaMetricsManagerService extends SystemService {
|
||||
mSecureRandom.nextBytes(byteId);
|
||||
String id = Base64.encodeToString(
|
||||
byteId, Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE);
|
||||
|
||||
// Authorize these session ids in the native mediametrics service.
|
||||
new MediaMetrics.Item(mMetricsId)
|
||||
.set(MediaMetrics.Property.EVENT, "create")
|
||||
.set(MediaMetrics.Property.LOG_SESSION_ID, id)
|
||||
.record();
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user