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

Commit 542731ff authored by Chris Wren's avatar Chris Wren Committed by Android Git Automerger
Browse files

am 100cf21f: am df2e2809: Merge "log more settings actions" into mnc-dev

* commit '100cf21f':
  log more settings actions
parents 4df01973 100cf21f
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.view.View;
 */
public class MetricsLogger implements MetricsConstants {
    // These constants are temporary, they should migrate to MetricsConstants.
    // next value is 148;
    // next value is 179;

    public static final int NOTIFICATION_ZEN_MODE_SCHEDULE_RULE = 144;
    public static final int NOTIFICATION_ZEN_MODE_EXTERNAL_RULE = 145;
@@ -38,6 +38,32 @@ public class MetricsLogger implements MetricsConstants {
    public static final int QS_BLUETOOTH_DETAILS = 150;
    public static final int QS_CAST_DETAILS = 151;
    public static final int QS_WIFI_DETAILS = 152;
    public static final int QS_WIFI_TOGGLE = 153;
    public static final int QS_BLUETOOTH_TOGGLE = 154;
    public static final int QS_CELLULAR_TOGGLE = 155;
    public static final int QS_SWITCH_USER = 156;
    public static final int QS_CAST_SELECT = 157;
    public static final int QS_CAST_DISCONNECT = 158;
    public static final int ACTION_BLUETOOTH_TOGGLE = 159;
    public static final int ACTION_BLUETOOTH_SCAN = 160;
    public static final int ACTION_BLUETOOTH_RENAME = 161;
    public static final int ACTION_BLUETOOTH_FILES = 162;
    public static final int QS_DND_TIME = 163;
    public static final int QS_DND_CONDITION_SELECT = 164;
    public static final int QS_DND_ZEN_SELECT = 165;
    public static final int QS_DND_TOGGLE = 166;
    public static final int ACTION_ZEN_ALLOW_REMINDERS = 167;
    public static final int ACTION_ZEN_ALLOW_EVENTS = 168;
    public static final int ACTION_ZEN_ALLOW_MESSAGES = 169;
    public static final int ACTION_ZEN_ALLOW_CALLS = 170;
    public static final int ACTION_ZEN_ALLOW_REPEAT_CALLS = 171;
    public static final int ACTION_ZEN_ADD_RULE = 172;
    public static final int ACTION_ZEN_ADD_RULE_OK = 173;
    public static final int ACTION_ZEN_DELETE_RULE = 174;
    public static final int ACTION_ZEN_DELETE_RULE_OK = 175;
    public static final int ACTION_ZEN_ENABLE_RULE = 176;
    public static final int ACTION_AIRPLANE_TOGGLE = 177;
    public static final int ACTION_CELL_DATA_TOGGLE = 178;

    public static void visible(Context context, int category) throws IllegalArgumentException {
        if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
@@ -71,6 +97,14 @@ public class MetricsLogger implements MetricsConstants {
        action(context, category, "");
    }

    public static void action(Context context, int category, int value) {
        action(context, category, Integer.toString(value));
    }

    public static void action(Context context, int category, boolean value) {
        action(context, category, Boolean.toString(value));
    }

    public static void action(Context context, int category, String pkg) {
        if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
            throw new IllegalArgumentException("Must define metric category");
+2 −8
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
@@ -67,6 +68,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
    private boolean mAnnounceNextStateChange;

    abstract protected TState newTileState();
    abstract protected void handleClick();
    abstract protected void handleUpdateState(TState state, Object arg);

    /**
@@ -170,10 +172,6 @@ public abstract class QSTile<TState extends State> implements Listenable {
        handleRefreshState(null);
    }

    protected void handleClick() {
        MetricsLogger.action(mContext, getMetricsCategory(), getMetricsPackage());
    };

    protected void handleSecondaryClick() {
        // optional
    }
@@ -182,10 +180,6 @@ public abstract class QSTile<TState extends State> implements Listenable {
        // optional
    }

    protected String getMetricsPackage() {
        return "";
    }

    protected void handleRefreshState(Object arg) {
        handleUpdateState(mTmpState, arg);
        final boolean changed = mTmpState.copyTo(mState);
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class AirplaneModeTile extends QSTile<QSTile.BooleanState> {

    @Override
    public void handleClick() {
        super.handleClick();
        MetricsLogger.action(mContext, getMetricsCategory(), !mState.value);
        setEnabled(!mState.value);
        mEnable.setAllowAnimation(true);
        mDisable.setAllowAnimation(true);
+2 −1
Original line number Diff line number Diff line
@@ -75,8 +75,8 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> {

    @Override
    protected void handleClick() {
        super.handleClick();
        final boolean isEnabled = (Boolean)mState.value;
        MetricsLogger.action(mContext, getMetricsCategory(), !isEnabled);
        mController.setBluetoothEnabled(!isEnabled);
    }

@@ -184,6 +184,7 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> {

        @Override
        public void setToggleState(boolean state) {
            MetricsLogger.action(mContext, MetricsLogger.QS_BLUETOOTH_TOGGLE, state);
            mController.setBluetoothEnabled(state);
            showDetail(false);
        }
+3 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public class CastTile extends QSTile<QSTile.BooleanState> {

    @Override
    protected void handleClick() {
        super.handleClick();
        MetricsLogger.action(mContext, getMetricsCategory());
        showDetail(true);
    }

@@ -246,6 +246,7 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
        @Override
        public void onDetailItemClick(Item item) {
            if (item == null || item.tag == null) return;
            MetricsLogger.action(mContext, MetricsLogger.QS_CAST_SELECT);
            final CastDevice device = (CastDevice) item.tag;
            mController.startCasting(device);
        }
@@ -253,6 +254,7 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
        @Override
        public void onDetailItemDisconnect(Item item) {
            if (item == null || item.tag == null) return;
            MetricsLogger.action(mContext, MetricsLogger.QS_CAST_DISCONNECT);
            final CastDevice device = (CastDevice) item.tag;
            mController.stopCasting(device);
        }
Loading