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

Commit e2b2432b authored by Muhammad Qureshi's avatar Muhammad Qureshi
Browse files

Use FrameworkStatsLog instead of StatsLog

As part of statsd becoming a Mainline module in R, autogenerated
StatsLog.write() calls are going away and replaced by
*StatsLog.java
that is autogenerated for each module.
This CL replaces some usages of StatsLog with
FrameworkStatsLog.

Bug: 145952197
Test: m
Change-Id: Iaa2db34a7be4c3215f62cc36661ba8ac81656baa
parent 006d3ee6
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -381,8 +381,8 @@ message Atom {
        NotificationReported notification_reported = 244;
        NotificationReported notification_reported = 244;
        NotificationPanelReported notification_panel_reported = 245;
        NotificationPanelReported notification_panel_reported = 245;
        NotificationChannelModified notification_panel_modified = 246;
        NotificationChannelModified notification_panel_modified = 246;
        IntegrityCheckResultReported integrity_check_result_reported = 247;
        IntegrityCheckResultReported integrity_check_result_reported = 247 [(module) = "framework"];
        IntegrityRulesPushed integrity_rules_pushed = 248;
        IntegrityRulesPushed integrity_rules_pushed = 248 [(module) = "framework"];
        CellBroadcastMessageReported cb_message_reported =
        CellBroadcastMessageReported cb_message_reported =
            249 [(module) = "cellbroadcast"];
            249 [(module) = "cellbroadcast"];
        CellBroadcastMessageError cb_message_error =
        CellBroadcastMessageError cb_message_error =
+3 −4
Original line number Original line Diff line number Diff line
@@ -19,10 +19,9 @@ package android.app.admin;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.ComponentName;
import android.stats.devicepolicy.nano.StringList;
import android.stats.devicepolicy.nano.StringList;
import android.util.StatsLog;


import com.android.framework.protobuf.nano.MessageNano;
import com.android.framework.protobuf.nano.MessageNano;
import com.android.internal.util.Preconditions;
import com.android.internal.util.FrameworkStatsLog;


import java.util.Arrays;
import java.util.Arrays;
import java.util.Objects;
import java.util.Objects;
@@ -197,8 +196,8 @@ public class DevicePolicyEventLogger {
     */
     */
    public void write() {
    public void write() {
        byte[] bytes = stringArrayValueToBytes(mStringArrayValue);
        byte[] bytes = stringArrayValueToBytes(mStringArrayValue);
        StatsLog.write(StatsLog.DEVICE_POLICY_EVENT, mEventId, mAdminPackageName, mIntValue,
        FrameworkStatsLog.write(FrameworkStatsLog.DEVICE_POLICY_EVENT, mEventId, mAdminPackageName,
                mBooleanValue, mTimePeriodMs, bytes);
                mIntValue, mBooleanValue, mTimePeriodMs, bytes);
    }
    }


    /**
    /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.Log;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseIntArray;
import android.util.SparseIntArray;
import android.util.StatsLog;
import android.view.contentcapture.ContentCaptureCondition;
import android.view.contentcapture.ContentCaptureCondition;
import android.view.contentcapture.ContentCaptureContext;
import android.view.contentcapture.ContentCaptureContext;
import android.view.contentcapture.ContentCaptureEvent;
import android.view.contentcapture.ContentCaptureEvent;
@@ -55,6 +54,7 @@ import android.view.contentcapture.IContentCaptureDirectManager;
import android.view.contentcapture.MainContentCaptureSession;
import android.view.contentcapture.MainContentCaptureSession;


import com.android.internal.os.IResultReceiver;
import com.android.internal.os.IResultReceiver;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.Preconditions;
import com.android.internal.util.Preconditions;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
@@ -594,7 +594,7 @@ public abstract class ContentCaptureService extends Service {
                    + rightUid);
                    + rightUid);
            long now = System.currentTimeMillis();
            long now = System.currentTimeMillis();
            if (now - mLastCallerMismatchLog > mCallerMismatchTimeout) {
            if (now - mLastCallerMismatchLog > mCallerMismatchTimeout) {
                StatsLog.write(StatsLog.CONTENT_CAPTURE_CALLER_MISMATCH_REPORTED,
                FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_CALLER_MISMATCH_REPORTED,
                        getPackageManager().getNameForUid(rightUid),
                        getPackageManager().getNameForUid(rightUid),
                        getPackageManager().getNameForUid(uid));
                        getPackageManager().getNameForUid(uid));
                mLastCallerMismatchLog = now;
                mLastCallerMismatchLog = now;
+6 −3
Original line number Original line Diff line number Diff line
@@ -28,6 +28,8 @@ import android.os.IStatsd;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;


import com.android.internal.util.FrameworkStatsLog;

/**
/**
 * StatsLog provides an API for developers to send events to statsd. The events can be used to
 * 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.
@@ -60,7 +62,7 @@ public final class StatsLog extends StatsLogInternal {
                    return false;
                    return false;
                }
                }
                service.sendAppBreadcrumbAtom(label,
                service.sendAppBreadcrumbAtom(label,
                        StatsLog.APP_BREADCRUMB_REPORTED__STATE__START);
                        FrameworkStatsLog.APP_BREADCRUMB_REPORTED__STATE__START);
                return true;
                return true;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                sService = null;
                sService = null;
@@ -88,7 +90,8 @@ public final class StatsLog extends StatsLogInternal {
                    }
                    }
                    return false;
                    return false;
                }
                }
                service.sendAppBreadcrumbAtom(label, StatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP);
                service.sendAppBreadcrumbAtom(
                        label, FrameworkStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP);
                return true;
                return true;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                sService = null;
                sService = null;
@@ -117,7 +120,7 @@ public final class StatsLog extends StatsLogInternal {
                    return false;
                    return false;
                }
                }
                service.sendAppBreadcrumbAtom(
                service.sendAppBreadcrumbAtom(
                        label, StatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED);
                        label, FrameworkStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED);
                return true;
                return true;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                sService = null;
                sService = null;
+10 −9
Original line number Original line Diff line number Diff line
@@ -16,12 +16,12 @@


package android.view;
package android.view;


import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DEEP_PRESS;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DEEP_PRESS;
import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DOUBLE_TAP;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DOUBLE_TAP;
import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LONG_PRESS;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LONG_PRESS;
import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SCROLL;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SCROLL;
import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SINGLE_TAP;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SINGLE_TAP;
import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__UNKNOWN_CLASSIFICATION;
import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__UNKNOWN_CLASSIFICATION;


import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
@@ -29,7 +29,8 @@ import android.os.Build;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.os.SystemClock;
import android.os.SystemClock;
import android.util.StatsLog;

import com.android.internal.util.FrameworkStatsLog;


/**
/**
 * Detects various gestures and events using the supplied {@link MotionEvent}s.
 * Detects various gestures and events using the supplied {@link MotionEvent}s.
@@ -887,8 +888,8 @@ public class GestureDetector {
            mHasRecordedClassification = true;
            mHasRecordedClassification = true;
            return;
            return;
        }
        }
        StatsLog.write(
        FrameworkStatsLog.write(
                StatsLog.TOUCH_GESTURE_CLASSIFIED,
                FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED,
                getClass().getName(),
                getClass().getName(),
                classification,
                classification,
                (int) (SystemClock.uptimeMillis() - mCurrentMotionEvent.getDownTime()),
                (int) (SystemClock.uptimeMillis() - mCurrentMotionEvent.getDownTime()),
Loading