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

Commit 77781d3a authored by Chris Wren's avatar Chris Wren
Browse files

a step toward enforcing unique metrics log IDs

First of several change lists:
1. Add in the new proto (this CL)
2. Migrate the existing code over to the proto.
3. Remove MetricsConstants once it is unused.

Bug: 26442178
Change-Id: Ic24829246af8ec5b202e39a85960aac5cf336c33
parent 313b825f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -442,6 +442,7 @@ LOCAL_INTERMEDIATE_SOURCES := \

LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core-oj core-libart conscrypt okhttp core-junit bouncycastle ext
LOCAL_STATIC_JAVA_LIBRARIES := framework-protos

LOCAL_MODULE := framework

+51 −8
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@ package com.android.internal.logging;
 */
public interface MetricsConstants {
    // These constants must match those in the analytic pipeline, do not edit.
    // Add temporary values to the top of MetricsLogger instead.
    public static final int VIEW_UNKNOWN = 0;
    // define metric categories in frameworks/base/core/proto/src/metrics_constants.proto.
    public static final int MAIN_SETTINGS = 1;
    public static final int ACCESSIBILITY = 2;
    public static final int ACCESSIBILITY_CAPTION_PROPERTIES = 3;
@@ -65,7 +64,7 @@ public interface MetricsConstants {
    public static final int DEVELOPMENT = 39;
    public static final int DEVICEINFO = 40;
    public static final int DEVICEINFO_IMEI_INFORMATION = 41;
    public static final int DEVICEINFO_MEMORY = 42;
    public static final int DEVICEINFO_STORAGE = 42;
    public static final int DEVICEINFO_SIM_STATUS = 43;
    public static final int DEVICEINFO_STATUS = 44;
    public static final int DEVICEINFO_USB = 45;
@@ -134,7 +133,6 @@ public interface MetricsConstants {
    public static final int WIFI_INFO = 108;
    public static final int WIFI_P2P = 109;
    public static final int WIRELESS = 110;
    public static final int QS_PANEL = 111;
    public static final int QS_AIRPLANEMODE = 112;
    public static final int QS_BLUETOOTH = 113;
    public static final int QS_CAST = 114;
@@ -282,10 +280,55 @@ public interface MetricsConstants {
    public static final int ACTION_WIGGLE_CAMERA_GESTURE = 256;
    public static final int QS_WORKMODE = 257;
    public static final int BACKGROUND_CHECK_SUMMARY = 258;
    public static final int QS_LOCK_TILE = 259;
    public static final int QS_USER_TILE = 260;
    public static final int QS_BATTERY_TILE = 261;
    public static final int NOTIFICATION_ZEN_MODE_VISUAL_INTERRUPTIONS = 262;
    public static final int ACTION_ZEN_ALLOW_PEEK = 263;
    public static final int ACTION_ZEN_ALLOW_LIGHTS = 264;
    public static final int NOTIFICATION_TOPIC_NOTIFICATION = 265;
    public static final int ACTION_DEFAULT_SMS_APP_CHANGED = 266;
    public static final int QS_COLOR_MATRIX = 267;
    public static final int QS_CUSTOM = 268;
    public static final int ACTION_ZEN_ALLOW_SCREEN_ON = 269;

    // These constants must match those in the analytic pipeline, do not edit.
    // Add temporary values to the top of MetricsLogger instead.
    /**
     * Logged when the user docks a window from recents by longpressing a task and dragging it to
     * the dock area.
     */
    public static final int ACTION_WINDOW_DOCK_DRAG_DROP = 270;

    /**
     * Logged when the user docks a fullscreen window by long pressing recents which also opens
     * recents on the lower/right side.
     */
    public static final int ACTION_WINDOW_DOCK_LONGPRESS = 271;

    /**
     * Logged when the user docks a window by dragging from the navbar which also opens recents on
     * the lower/right side.
     */
    public static final int ACTION_WINDOW_DOCK_SWIPE = 272;

    /**
     * Logged when the user launches a profile-specific app and we intercept it with the confirm
     * credentials UI.
     */
    public static final int PROFILE_CHALLENGE = 273;
    public static final int QS_BATTERY_DETAIL = 274;

    /**
     * Logged when the user goes into the overview history.
     */
    public static final int OVERVIEW_HISTORY = 275;

    //aliases
    public static final int DEVICEINFO_STORAGE = DEVICEINFO_MEMORY;
    /**
     * Logged when the user pages through overview.
     */
    public static final int ACTION_OVERVIEW_PAGE = 276;

    /**
     * Logged when the user launches a task from overview.
     */
    public static final int ACTION_OVERVIEW_SELECT = 277;
}
+5 −53
Original line number Diff line number Diff line
@@ -15,69 +15,21 @@
 */
package com.android.internal.logging;


import android.content.Context;
import android.os.Build;
import android.view.View;

import com.android.internal.logging.MetricsProto.MetricsEvent;

/**
 * Log all the things.
 *
 * @hide
 */
public class MetricsLogger implements MetricsConstants {
    // Temporary constants go here, to await migration to MetricsConstants.
    public static final int QS_USER_TILE = 258;
    public static final int QS_BATTERY_TILE = 259;
    public static final int NOTIFICATION_ZEN_MODE_VISUAL_INTERRUPTIONS = 260;
    public static final int ACTION_ZEN_ALLOW_PEEK = 261;
    public static final int ACTION_ZEN_ALLOW_LIGHTS = 262;
    public static final int NOTIFICATION_TOPIC_NOTIFICATION = 263;
    public static final int ACTION_DEFAULT_SMS_APP_CHANGED = 264;
    public static final int QS_COLOR_MATRIX = 265;
    public static final int QS_CUSTOM = 266;
    public static final int ACTION_ZEN_ALLOW_SCREEN_ON = 267;

    /**
     * Logged when the user docks a window from recents by longpressing a task and dragging it to
     * the dock area.
     */
    public static final int ACTION_WINDOW_DOCK_DRAG_DROP = 268;

    /**
     * Logged when the user docks a fullscreen window by long pressing recents which also opens
     * recents on the lower/right side.
     */
    public static final int ACTION_WINDOW_DOCK_LONGPRESS = 269;

    /**
     * Logged when the user docks a window by dragging from the navbar which also opens recents on
     * the lower/right side.
     */
    public static final int ACTION_WINDOW_DOCK_SWIPE = 270;

    /**
     * Logged when the user launches a profile-specific app and we intercept it with the confirm
     * credentials UI.
     */
    public static final int PROFILE_CHALLENGE = 271;
    public static final int QS_BATTERY_DETAIL = 272;

    /**
     * Logged when the user goes into the overview history.
     */
    public static final int OVERVIEW_HISTORY = 273;

    /**
     * Logged when the user pages through overview.
     */
    public static final int ACTION_OVERVIEW_PAGE = 274;

    /**
     * Logged when the user launches a task from overview.
     */
    public static final int ACTION_OVERVIEW_SELECT = 275;
public class MetricsLogger implements com.android.internal.logging.MetricsConstants {
    // define metric categories in frameworks/base/core/proto/src/metrics_constants.proto.

    public static final int VIEW_UNKNOWN = MetricsEvent.VIEW_UNKNOWN;

    public static void visible(Context context, int category) throws IllegalArgumentException {
        if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
+2 −1
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v7-recyclerview \
    android-support-v7-preference \
    android-support-v7-appcompat \
    android-support-v14-preference
    android-support-v14-preference \
    framework-protos

LOCAL_JAVA_LIBRARIES := telephony-common

+4 −2
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile.DetailAdapter;
@@ -245,7 +247,7 @@ public class QSPanel extends FrameLayout implements Tunable {
    public void setExpanded(boolean expanded) {
        if (mExpanded == expanded) return;
        mExpanded = expanded;
        MetricsLogger.visibility(mContext, MetricsLogger.QS_PANEL, mExpanded);
        MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, mExpanded);
        if (!mExpanded) {
            closeDetail();
        } else {
@@ -498,7 +500,7 @@ public class QSPanel extends FrameLayout implements Tunable {
        int newVis = visible ? VISIBLE : INVISIBLE;
        mQsContainer.setVisibility(newVis);
        if (mGridContentVisible != visible) {
            MetricsLogger.visibility(mContext, MetricsLogger.QS_PANEL, newVis);
            MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, newVis);
        }
        mGridContentVisible = visible;
    }
Loading