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

Commit 7a9091c7 authored by Jason Monk's avatar Jason Monk Committed by android-build-merger
Browse files

Merge "Add more metrics for QS" into nyc-dev am: 98bad0e5

am: d4838f65

* commit 'd4838f65':
  Add more metrics for QS

Change-Id: I1b3d67cb3625f5db20b4bbb310da40005426e69e
parents e4dda02a d4838f65
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settingslib.RestrictedLockUtils;
import com.android.systemui.qs.QSTile.State;
import com.android.systemui.qs.external.TileServices;
@@ -217,6 +219,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
    }

    protected void handleLongClick() {
        MetricsLogger.action(mContext, MetricsEvent.ACTION_QS_LONG_PRESS, getTileSpec());
        mHost.startActivityDismissingKeyguard(getLongClickIntent());
    }

+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toolbar;
import android.widget.Toolbar.OnMenuItemClickListener;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto;
import com.android.systemui.R;
import com.android.systemui.qs.QSContainer;
import com.android.systemui.qs.QSDetailClipper;
@@ -116,6 +118,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene

    public void show(int x, int y) {
        if (!isShown) {
            MetricsLogger.visible(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
            isShown = true;
            setTileSpecs();
            setVisibility(View.VISIBLE);
@@ -127,6 +130,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene

    public void hide(int x, int y) {
        if (isShown) {
            MetricsLogger.hidden(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
            isShown = false;
            mToolbar.dismissPopupMenus();
            setCustomizing(false);
@@ -149,6 +153,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    public boolean onMenuItemClick(MenuItem item) {
        switch (item.getItemId()) {
            case MENU_RESET:
                MetricsLogger.action(getContext(), MetricsProto.MetricsEvent.ACTION_QS_EDIT_RESET);
                reset();
                break;
        }
+25 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ package com.android.systemui.qs.customize;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
@@ -36,12 +37,15 @@ import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto;
import com.android.systemui.R;
import com.android.systemui.qs.QSIconView;
import com.android.systemui.qs.QSTileView;
import com.android.systemui.qs.customize.TileAdapter.Holder;
import com.android.systemui.qs.customize.TileQueryHelper.TileInfo;
import com.android.systemui.qs.customize.TileQueryHelper.TileStateListener;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.statusbar.phone.SystemUIDialog;

@@ -304,12 +308,24 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
        notifyItemMoved(from, to);
        CharSequence announcement;
        if (to >= mDividerIndex) {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE,
                    from);
            announcement = mContext.getString(R.string.accessibility_qs_edit_tile_removed,
                    fromLabel);
        } else if (from >= mDividerIndex) {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD,
                    to);
            announcement = mContext.getString(R.string.accessibility_qs_edit_tile_added,
                    fromLabel, (to + 1));
        } else {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE,
                    to);
            announcement = mContext.getString(R.string.accessibility_qs_edit_tile_moved,
                    fromLabel, (to + 1));
        }
@@ -317,6 +333,15 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
        return true;
    }

    private String strip(TileInfo tileInfo) {
        String spec = tileInfo.spec;
        if (spec.startsWith(CustomTile.PREFIX)) {
            ComponentName component = CustomTile.getComponentFromSpec(spec);
            return component.getPackageName();
        }
        return spec;
    }

    private <T> void move(int from, int to, List<T> list) {
        list.add(from > to ? to : to + 1, list.get(from));
        list.remove(from > to ? from + 1 : from);
+27 −0
Original line number Diff line number Diff line
@@ -2020,6 +2020,33 @@ message MetricsEvent {
    // Logged when a user dismisses all task in overview
    OVERVIEW_DISMISS_ALL = 357;

    // Quick Settings -> Edit
    QS_EDIT = 358;

    // Quick Settings -> Edit -> Overflow -> Reset
    ACTION_QS_EDIT_RESET = 359;

    // QS -> Edit - Drag a tile out of the active tiles.
    // The _SPEC contains either the spec of the tile or
    // the package of the 3rd party app in the PKG field.
    ACTION_QS_EDIT_REMOVE_SPEC = 360;
    ACTION_QS_EDIT_REMOVE = 361;

    // QS -> Edit - Drag a tile into the active tiles.
    // The _SPEC contains either the spec of the tile or
    // the package of the 3rd party app in the PKG field.
    ACTION_QS_EDIT_ADD_SPEC = 362;
    ACTION_QS_EDIT_ADD = 363;

    // QS -> Edit - Drag a tile within the active tiles.
    // The _SPEC contains either the spec of the tile or
    // the package of the 3rd party app in the PKG field.
    ACTION_QS_EDIT_MOVE_SPEC = 364;
    ACTION_QS_EDIT_MOVE = 365;

    // Long-press on a QS tile. Tile spec in package field.
    ACTION_QS_LONG_PRESS = 366;

    // Add new aosp constants above this line.
    // END OF AOSP CONSTANTS
  }