diff options
author | Chris Wren <cwren@android.com> | 2015-05-08 17:23:47 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2015-05-08 22:25:40 -0400 |
commit | 9e7283f6a31bc2beb75c84c6173968a46582c563 (patch) | |
tree | 0bbb8f1b16ff3185ac931dbc4e0aa2ed24735ee0 | |
parent | a0698b617f1efc71d5301f98aead822e266ec5d6 (diff) | |
download | frameworks_base-9e7283f6a31bc2beb75c84c6173968a46582c563.zip frameworks_base-9e7283f6a31bc2beb75c84c6173968a46582c563.tar.gz frameworks_base-9e7283f6a31bc2beb75c84c6173968a46582c563.tar.bz2 |
log more settings actions
airplane: quick and slow settings
bluetooth: quick and slow settings
cellular data: quick and slow settings
dnd: quick and slow settings
wifi: quick settings (slow already done)
cast: quick settings
user: quick settings
include state of the toggle in the action log
Back away slowly from the over-generalization of logging
around handleClick, the semantics of mState are particular
to the individual tiles.
Bug: 20264417
Change-Id: I4cecbd3361af64d08de9fb41b8dca210a8086a80
16 files changed, 62 insertions, 26 deletions
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java index 9277f9b..69fab0d 100644 --- a/core/java/com/android/internal/logging/MetricsLogger.java +++ b/core/java/com/android/internal/logging/MetricsLogger.java @@ -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"); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 452fd44..3b217df 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java index 6744154..49f8d1c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index 8eb624f..ed954bb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index a3d7bcc..c06ea66 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 0026141..1721335 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -76,7 +76,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override protected void handleClick() { - super.handleClick(); + MetricsLogger.action(mContext, getMetricsCategory()); if (mDataController.isMobileDataSupported()) { showDetail(true); } else { @@ -230,6 +230,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override public void setToggleState(boolean state) { + MetricsLogger.action(mContext, MetricsLogger.QS_CELLULAR_TOGGLE, state); mDataController.setMobileDataEnabled(state); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java index 6fa094e..c6fc6ff 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java @@ -87,7 +87,7 @@ public class ColorInversionTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { - super.handleClick(); + MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); mSetting.setValue(mState.value ? 0 : 1); mEnable.setAllowAnimation(true); mDisable.setAllowAnimation(true); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index e708a72..5e6083a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -89,7 +89,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { @Override public void handleClick() { - super.handleClick(); + MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); if (mState.value) { mController.setZen(Global.ZEN_MODE_OFF, null, TAG); } else { @@ -209,6 +209,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { @Override public void setToggleState(boolean state) { + MetricsLogger.action(mContext, MetricsLogger.QS_DND_TOGGLE, state); if (!state) { mController.setZen(Global.ZEN_MODE_OFF, null, TAG); showDetail(false); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java index a1f3cde..0369ab5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -60,10 +60,10 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements @Override protected void handleClick() { - super.handleClick(); if (ActivityManager.isUserAMonkey()) { return; } + MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); boolean newState = !mState.value; refreshState(newState ? UserBoolean.USER_TRUE : UserBoolean.USER_FALSE); mFlashlightController.setFlashlight(newState); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java index b864ff4..f28a24b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java @@ -69,8 +69,8 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { - super.handleClick(); final boolean isEnabled = (Boolean) mState.value; + MetricsLogger.action(mContext, getMetricsCategory(), !isEnabled); mController.setHotspotEnabled(!isEnabled); mEnable.setAllowAnimation(true); mDisable.setAllowAnimation(true); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java index 20b5f04..19f4df6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java @@ -84,7 +84,7 @@ public class IntentTile extends QSTile<QSTile.State> { @Override protected void handleClick() { - super.handleClick(); + MetricsLogger.action(mContext, getMetricsCategory(), mIntentPackage); sendIntent("click", mOnClick, mOnClickUri); } @@ -137,6 +137,7 @@ public class IntentTile extends QSTile<QSTile.State> { mOnLongClick = intent.getParcelableExtra("onLongClick"); mOnLongClickUri = intent.getStringExtra("onLongClickUri"); mIntentPackage = intent.getStringExtra("package"); + mIntentPackage = mIntentPackage == null ? "" : mIntentPackage; } @Override @@ -144,11 +145,6 @@ public class IntentTile extends QSTile<QSTile.State> { return MetricsLogger.QS_INTENT; } - @Override - protected String getMetricsPackage() { - return mIntentPackage == null ? "" : mIntentPackage; - } - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java index ab22ada..e6fade4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java @@ -59,8 +59,8 @@ public class LocationTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { - super.handleClick(); final boolean wasEnabled = (Boolean) mState.value; + MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled); mController.setLocationEnabled(!wasEnabled); mEnable.setAllowAnimation(true); mDisable.setAllowAnimation(true); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 7e3fe76..7c378f0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -59,8 +59,8 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { - super.handleClick(); if (mController == null) return; + MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); final boolean newState = !mState.value; mController.setRotationLocked(newState); refreshState(newState ? UserBoolean.USER_TRUE : UserBoolean.USER_FALSE); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java index 6bad652..d4f54b6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java @@ -16,6 +16,7 @@ package com.android.systemui.qs.tiles; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.PseudoGridView; import com.android.systemui.statusbar.policy.UserSwitcherController; @@ -84,6 +85,7 @@ public class UserDetailView extends PseudoGridView { public void onClick(View view) { UserSwitcherController.UserRecord tag = (UserSwitcherController.UserRecord) view.getTag(); + MetricsLogger.action(mContext, MetricsLogger.QS_SWITCH_USER); switchTo(tag); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 228c293..c3f9e33 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -94,8 +94,8 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleClick() { - super.handleClick(); mState.copyTo(mStateBeforeClick); + MetricsLogger.action(mContext, getMetricsCategory(), !mState.enabled); mController.setWifiEnabled(!mState.enabled); } @@ -276,6 +276,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override public void setToggleState(boolean state) { if (DEBUG) Log.d(TAG, "setToggleState " + state); + MetricsLogger.action(mContext, MetricsLogger.QS_WIFI_TOGGLE, state); mController.setWifiEnabled(state); showDetail(false); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index 9f9c9ac..b3b6725 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -48,6 +48,7 @@ import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.statusbar.policy.ZenModeController; @@ -598,6 +599,7 @@ public class ZenModePanel extends LinearLayout { if (childTag == null || childTag == tag) continue; childTag.rb.setChecked(false); } + MetricsLogger.action(mContext, MetricsLogger.QS_DND_CONDITION_SELECT); select(tag.condition); announceConditionSelection(tag); } @@ -700,6 +702,7 @@ public class ZenModePanel extends LinearLayout { } private void onClickTimeButton(View row, ConditionTag tag, boolean up) { + MetricsLogger.action(mContext, MetricsLogger.QS_DND_TIME, up); Condition newCondition = null; final int N = MINUTE_BUCKETS.length; if (mBucketIndex == -1) { @@ -907,6 +910,7 @@ public class ZenModePanel extends LinearLayout { public void onSelected(final Object value) { if (value != null && mZenButtons.isShown() && isAttachedToWindow()) { final int zen = (Integer) value; + MetricsLogger.action(mContext, MetricsLogger.QS_DND_ZEN_SELECT, zen); if (DEBUG) Log.d(mTag, "mZenButtonsCallback selected=" + zen); final Uri realConditionId = getRealConditionId(mSessionExitCondition); AsyncTask.execute(new Runnable() { |