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

Commit c0df1f23 authored by Maurice Lam's avatar Maurice Lam
Browse files

Revert "Small fixes to StatsManager API."

This reverts commit 16dcd33a.

Reason for revert: b/73975175

Bug: 73975175
Change-Id: I5bcccde100900b1370c2e43b8bcfc7d1697e5c72
parent 16dcd33a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -364,6 +364,7 @@ package android.app {
  }

  public final class StatsManager {
    method public boolean addConfiguration(long, byte[], java.lang.String, java.lang.String);
    method public boolean addConfiguration(long, byte[]);
    method public byte[] getData(long);
    method public byte[] getMetadata();
+13 −7
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package android.app;

import android.Manifest;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.os.IBinder;
@@ -75,6 +74,14 @@ public final class StatsManager {
    public StatsManager() {
    }

    /**
     * Temporary. Will be deleted.
     */
    @RequiresPermission(Manifest.permission.DUMP)
    public boolean addConfiguration(long configKey, byte[] config, String a, String b) {
        return addConfiguration(configKey, config);
    }

    /**
     * Clients can send a configuration and simultaneously registers the name of a broadcast
     * receiver that listens for when it should request data.
@@ -219,11 +226,10 @@ public final class StatsManager {
     * the retrieved metrics from statsd memory.
     *
     * @param configKey Configuration key to retrieve data from.
     * @return Serialized ConfigMetricsReportList proto. Returns null on failure (eg, if statsd
     * crashed).
     * @return Serialized ConfigMetricsReportList proto. Returns null on failure.
     */
    @RequiresPermission(Manifest.permission.DUMP)
    public @Nullable byte[] getData(long configKey) {
    public byte[] getData(long configKey) {
        synchronized (this) {
            try {
                IStatsManager service = getIStatsManagerLocked();
@@ -233,7 +239,7 @@ public final class StatsManager {
                }
                return service.getData(configKey);
            } catch (RemoteException e) {
                if (DEBUG) Slog.d(TAG, "Failed to connect to statsd when getting data");
                if (DEBUG) Slog.d(TAG, "Failed to connecto statsd when getting data");
                return null;
            }
        }
@@ -244,10 +250,10 @@ public final class StatsManager {
     * the actual metrics themselves (metrics must be collected via {@link #getData(String)}.
     * This getter is not destructive and will not reset any metrics/counters.
     *
     * @return Serialized StatsdStatsReport proto. Returns null on failure (eg, if statsd crashed).
     * @return Serialized StatsdStatsReport proto. Returns null on failure.
     */
    @RequiresPermission(Manifest.permission.DUMP)
    public @Nullable byte[] getMetadata() {
    public byte[] getMetadata() {
        synchronized (this) {
            try {
                IStatsManager service = getIStatsManagerLocked();
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ package android.util;

/**
 * StatsLog provides an API for developers to send events to statsd. The events can be used to
 * define custom metrics inside statsd.
 * define custom metrics inside statsd. We will rate-limit how often the calls can be made inside
 * statsd.
 */
public final class StatsLog extends StatsLogInternal {
    private static final String TAG = "StatsManager";