diff options
4 files changed, 60 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 5c084f96585f..8777a9140a51 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -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()); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index aeca8401633a..83ac45c5c8c6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -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; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index 353c6b62a816..4c134516f844 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -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); diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index a2cfae9f3f11..2580e2c762a0 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -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 } |