diff options
author | Chris Wren <cwren@android.com> | 2015-05-06 17:50:34 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2015-05-07 15:14:28 -0400 |
commit | 457a21cdeac04565a0c40ad8c43a928c1182ddd1 (patch) | |
tree | 5b7f235a696b8c686bbb2f1ea17eeacb7e638dd6 /packages | |
parent | 49f06f5f0d514d32da184f82fc08f58ade81df99 (diff) | |
download | frameworks_base-457a21cdeac04565a0c40ad8c43a928c1182ddd1.zip frameworks_base-457a21cdeac04565a0c40ad8c43a928c1182ddd1.tar.gz frameworks_base-457a21cdeac04565a0c40ad8c43a928c1182ddd1.tar.bz2 |
add logging to quick settings tiles
QS Grid visibility
Tiles that are visibile in the grid
Taps on tiles
Detail visibility for DND, Users, and Data
Bug: 20264417
Change-Id: I95e65484a9be0a53a071bc12ce8195120582621e
Diffstat (limited to 'packages')
15 files changed, 159 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index b5c1ca8..f352849 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -33,6 +33,7 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.TextView; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.FontSizeUtils; import com.android.systemui.R; import com.android.systemui.qs.QSTile.DetailAdapter; @@ -182,8 +183,11 @@ public class QSPanel extends ViewGroup { public void setExpanded(boolean expanded) { if (mExpanded == expanded) return; mExpanded = expanded; + MetricsLogger.visibility(mContext, MetricsLogger.QS_PANEL, mExpanded); if (!mExpanded) { closeDetail(); + } else { + logTiles(); } } @@ -365,9 +369,11 @@ public class QSPanel extends ViewGroup { mDetailContent.removeAllViews(); mDetail.bringToFront(); mDetailContent.addView(r.detailView); + MetricsLogger.visible(mContext, detailAdapter.getMetricsCategory()); setDetailRecord(r); listener = mHideGridContentWhenDone; } else { + MetricsLogger.hidden(mContext, mDetailRecord.detailAdapter.getMetricsCategory()); mClosingDetail = true; setGridContentVisibility(true); listener = mTeardownDetailWhenDone; @@ -387,9 +393,21 @@ public class QSPanel extends ViewGroup { } } mBrightnessView.setVisibility(newVis); + if (mGridContentVisible != visible) { + MetricsLogger.visibility(mContext, MetricsLogger.QS_PANEL, newVis); + } mGridContentVisible = visible; } + private void logTiles() { + for (int i = 0; i < mRecords.size(); i++) { + TileRecord tileRecord = mRecords.get(i); + if (tileRecord.tile.getState().visible) { + MetricsLogger.visible(mContext, tileRecord.tile.getMetricsCategory()); + } + } + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index b9574dc..452fd44 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -29,6 +29,7 @@ import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.qs.QSTile.State; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; @@ -66,9 +67,17 @@ 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); + /** + * Declare the category of this tile. + * + * Categories are defined in {@link com.android.internal.logging.MetricsLogger} + * or if there is no relevant existing category you may define one in + * {@link com.android.systemui.qs.QSTile}. + */ + abstract public int getMetricsCategory(); + protected QSTile(Host host) { mHost = host; mContext = host.getContext(); @@ -97,6 +106,7 @@ public abstract class QSTile<TState extends State> implements Listenable { View createDetailView(Context context, View convertView, ViewGroup parent); Intent getSettingsIntent(); void setToggleState(boolean state); + int getMetricsCategory(); } // safe to call from any thread @@ -160,6 +170,10 @@ public abstract class QSTile<TState extends State> implements Listenable { handleRefreshState(null); } + protected void handleClick() { + MetricsLogger.action(mContext, getMetricsCategory(), getMetricsPackage()); + }; + protected void handleSecondaryClick() { // optional } @@ -168,6 +182,10 @@ 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 2bc31fc..6744154 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java @@ -23,6 +23,7 @@ import android.content.IntentFilter; import android.net.ConnectivityManager; import android.provider.Settings.Global; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.GlobalSetting; import com.android.systemui.qs.QSTile; @@ -55,6 +56,7 @@ public class AirplaneModeTile extends QSTile<QSTile.BooleanState> { @Override public void handleClick() { + super.handleClick(); setEnabled(!mState.value); mEnable.setAllowAnimation(true); mDisable.setAllowAnimation(true); @@ -85,6 +87,11 @@ public class AirplaneModeTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_AIRPLANEMODE; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_airplane_changed_on); 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 b42b5f6..8eb624f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -25,6 +25,7 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.systemui.R; import com.android.systemui.qs.QSDetailItems; @@ -74,6 +75,7 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); final boolean isEnabled = (Boolean)mState.value; mController.setBluetoothEnabled(!isEnabled); } @@ -132,6 +134,11 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_BLUETOOTH; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_bluetooth_changed_on); @@ -182,6 +189,11 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_BLUETOOTH_DETAILS; + } + + @Override public View createDetailView(Context context, View convertView, ViewGroup parent) { mItems = QSDetailItems.convertOrInflate(context, convertView, parent); mItems.setTagSuffix("Bluetooth"); 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 5bf6fb5..a3d7bcc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -24,6 +24,7 @@ import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.QSDetailItems; import com.android.systemui.qs.QSDetailItems.Item; @@ -85,6 +86,7 @@ public class CastTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); showDetail(true); } @@ -113,6 +115,11 @@ public class CastTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_CAST; + } + + @Override protected String composeChangeAnnouncement() { if (!mState.value) { // We only announce when it's turned off to avoid vocal overflow. @@ -164,6 +171,11 @@ public class CastTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_CAST_DETAILS; + } + + @Override public View createDetailView(Context context, View convertView, ViewGroup parent) { mItems = QSDetailItems.convertOrInflate(context, convertView, parent); mItems.setTagSuffix("Cast"); 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 30f92b9..0026141 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -24,6 +24,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; @@ -75,6 +76,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override protected void handleClick() { + super.handleClick(); if (mDataController.isMobileDataSupported()) { showDetail(true); } else { @@ -118,6 +120,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> { state.label); } + @Override + public int getMetricsCategory() { + return MetricsLogger.QS_CELLULAR; + } + // Remove the period from the network name public static String removeTrailingPeriod(String string) { if (string == null) return null; @@ -227,6 +234,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_DATAUSAGEDETAIL; + } + + @Override public View createDetailView(Context context, View convertView, ViewGroup parent) { final DataUsageDetailView v = (DataUsageDetailView) (convertView != null ? convertView 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 4a33f55..6fa094e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java @@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles; import android.provider.Settings.Secure; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.qs.QSTile; @@ -86,6 +87,7 @@ public class ColorInversionTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); mSetting.setValue(mState.value ? 0 : 1); mEnable.setAllowAnimation(true); mDisable.setAllowAnimation(true); @@ -115,6 +117,11 @@ public class ColorInversionTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_COLORINVERSION; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString( 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 5145bc7..e708a72 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -29,6 +29,7 @@ import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.qs.QSTile; @@ -88,6 +89,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { @Override public void handleClick() { + super.handleClick(); if (mState.value) { mController.setZen(Global.ZEN_MODE_OFF, null, TAG); } else { @@ -135,6 +137,11 @@ public class DndTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_DND; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_dnd_changed_on); @@ -209,6 +216,11 @@ public class DndTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_DND_DETAILS; + } + + @Override public View createDetailView(Context context, View convertView, ViewGroup parent) { final ZenModePanel zmp = convertView != null ? (ZenModePanel) convertView : (ZenModePanel) LayoutInflater.from(context).inflate( 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 cb78deb..a1f3cde 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles; import android.app.ActivityManager; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.statusbar.policy.FlashlightController; @@ -59,6 +60,7 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements @Override protected void handleClick() { + super.handleClick(); if (ActivityManager.isUserAMonkey()) { return; } @@ -84,6 +86,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_FLASHLIGHT; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_flashlight_changed_on); 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 6063f80..b864ff4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java @@ -20,6 +20,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.qs.UsageTracker; @@ -68,6 +69,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); final boolean isEnabled = (Boolean) mState.value; mController.setHotspotEnabled(!isEnabled); mEnable.setAllowAnimation(true); @@ -97,6 +99,11 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_HOTSPOT; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_hotspot_changed_on); 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 2736530..20b5f04 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java @@ -29,6 +29,7 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.qs.QSTile; import java.util.Arrays; @@ -42,6 +43,7 @@ public class IntentTile extends QSTile<QSTile.State> { private PendingIntent mOnLongClick; private String mOnLongClickUri; private int mCurrentUserId; + private String mIntentPackage; private IntentTile(Host host, String action) { super(host); @@ -82,6 +84,7 @@ public class IntentTile extends QSTile<QSTile.State> { @Override protected void handleClick() { + super.handleClick(); sendIntent("click", mOnClick, mOnClickUri); } @@ -133,6 +136,17 @@ public class IntentTile extends QSTile<QSTile.State> { mOnClickUri = intent.getStringExtra("onClickUri"); mOnLongClick = intent.getParcelableExtra("onLongClick"); mOnLongClickUri = intent.getStringExtra("onLongClickUri"); + mIntentPackage = intent.getStringExtra("package"); + } + + @Override + public int getMetricsCategory() { + return MetricsLogger.QS_INTENT; + } + + @Override + protected String getMetricsPackage() { + return mIntentPackage == null ? "" : mIntentPackage; } private final BroadcastReceiver mReceiver = new BroadcastReceiver() { 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 11ec722..ab22ada 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.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.QSTile; import com.android.systemui.statusbar.policy.KeyguardMonitor; @@ -58,6 +59,7 @@ public class LocationTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); final boolean wasEnabled = (Boolean) mState.value; mController.setLocationEnabled(!wasEnabled); mEnable.setAllowAnimation(true); @@ -87,6 +89,11 @@ public class LocationTile extends QSTile<QSTile.BooleanState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_LOCATION; + } + + @Override protected String composeChangeAnnouncement() { if (mState.value) { return mContext.getString(R.string.accessibility_quick_settings_location_changed_on); 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 f46b9a6..7e3fe76 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles; import android.content.res.Configuration; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.statusbar.policy.RotationLockController; @@ -58,6 +59,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { + super.handleClick(); if (mController == null) return; final boolean newState = !mState.value; mController.setRotationLocked(newState); @@ -92,6 +94,11 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { R.string.accessibility_rotation_lock_off); } + @Override + public int getMetricsCategory() { + return MetricsLogger.QS_ROTATIONLOCK; + } + /** * Get the correct accessibility string based on the state * 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 d589366..228c293 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -26,6 +26,7 @@ import android.util.Log; import android.view.View; import android.view.ViewGroup; +import com.android.internal.logging.MetricsLogger; import com.android.settingslib.wifi.AccessPoint; import com.android.systemui.R; import com.android.systemui.qs.QSDetailItems; @@ -93,6 +94,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleClick() { + super.handleClick(); mState.copyTo(mStateBeforeClick); mController.setWifiEnabled(!mState.enabled); } @@ -159,6 +161,11 @@ public class WifiTile extends QSTile<QSTile.SignalState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_WIFI; + } + + @Override protected boolean shouldAnnouncementBeDelayed() { return mStateBeforeClick.enabled == mState.enabled; } @@ -274,6 +281,11 @@ public class WifiTile extends QSTile<QSTile.SignalState> { } @Override + public int getMetricsCategory() { + return MetricsLogger.QS_WIFI_DETAILS; + } + + @Override public View createDetailView(Context context, View convertView, ViewGroup parent) { if (DEBUG) Log.d(TAG, "createDetailView convertView=" + (convertView != null)); mAccessPoints = null; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 194bcfa..ad27c6e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -43,6 +43,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; +import com.android.internal.logging.MetricsLogger; import com.android.internal.util.UserIcons; import com.android.systemui.BitmapHelper; import com.android.systemui.GuestResumeSessionReceiver; @@ -548,6 +549,11 @@ public class UserSwitcherController { @Override public void setToggleState(boolean state) { } + + @Override + public int getMetricsCategory() { + return MetricsLogger.QS_USERDETAIL; + } }; private final KeyguardMonitor.Callback mCallback = new KeyguardMonitor.Callback() { |