summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-07-16 14:15:50 -0400
committerJason Monk <jmonk@google.com>2015-07-22 14:41:02 -0400
commita403159a3bb693088c127e4ee5955fa940e75950 (patch)
tree45240affc45b44b64ad515d53c064fe5cb92a94b /packages
parent431ad737a4752e9325894211c28bb0f0f97c00a7 (diff)
downloadframeworks_base-a403159a3bb693088c127e4ee5955fa940e75950.zip
frameworks_base-a403159a3bb693088c127e4ee5955fa940e75950.tar.gz
frameworks_base-a403159a3bb693088c127e4ee5955fa940e75950.tar.bz2
Add metrics to tuner
Bug: 22462605 Change-Id: I075f9a25630a89e85dd17603297565988c38075b
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java4
4 files changed, 42 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
index 41f83f7..a2b062c 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
@@ -30,6 +30,7 @@ import android.preference.SwitchPreference;
import android.provider.Settings;
import android.view.MenuItem;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.DemoMode;
import com.android.systemui.R;
@@ -93,6 +94,18 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference
}
@Override
+ public void onResume() {
+ super.onResume();
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER_DEMO_MODE, true);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER_DEMO_MODE, false);
+ }
+
+ @Override
public void onDestroy() {
getContext().getContentResolver().unregisterContentObserver(mDemoModeObserver);
super.onDestroy();
@@ -113,15 +126,18 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean enabled = newValue == Boolean.TRUE;
if (preference == mEnabledSwitch) {
- if (newValue != Boolean.TRUE) {
+ if (!enabled) {
// Make sure we aren't in demo mode when disabling it.
mOnSwitch.setChecked(false);
stopDemoMode();
}
- setGlobal(DemoMode.DEMO_MODE_ALLOWED, newValue == Boolean.TRUE ? 1 : 0);
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_DEMO_MODE_ENABLED, enabled);
+ setGlobal(DemoMode.DEMO_MODE_ALLOWED, enabled ? 1 : 0);
} else if (preference == mOnSwitch) {
- if (newValue == Boolean.TRUE) {
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_DEMO_MODE_ON, enabled);
+ if (enabled) {
startDemoMode();
} else {
stopDemoMode();
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java b/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
index 8d19891..37ac098 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
@@ -40,6 +40,7 @@ import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ScrollView;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QSTile;
@@ -79,6 +80,16 @@ public class QsTuner extends Fragment implements Callback {
menu.add(0, MENU_RESET, 0, com.android.internal.R.string.reset);
}
+ public void onResume() {
+ super.onResume();
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER_QS, true);
+ }
+
+ public void onPause() {
+ super.onPause();
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER_QS, false);
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@@ -208,6 +219,8 @@ public class QsTuner extends Fragment implements Callback {
if (oldTile.equals(newTile)) {
return;
}
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_QS_REORDER, oldTile + ","
+ + newTile);
List<String> order = new ArrayList<>(mTileSpecs);
int index = order.indexOf(oldTile);
if (index < 0) {
@@ -220,12 +233,14 @@ public class QsTuner extends Fragment implements Callback {
}
public void remove(String tile) {
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_QS_REMOVE, tile);
List<String> tiles = new ArrayList<>(mTileSpecs);
tiles.remove(tile);
setTiles(tiles);
}
public void add(String tile) {
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_QS_ADD, tile);
List<String> tiles = new ArrayList<>(mTileSpecs);
tiles.add(tile);
setTiles(tiles);
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java
index d4cc56d..e5b550e 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java
@@ -23,6 +23,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.AttributeSet;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.tuner.TunerService.Tunable;
@@ -50,11 +51,14 @@ public class StatusBarSwitch extends SwitchPreference implements Tunable {
if (!value) {
// If not enabled add to blacklist.
if (!mBlacklist.contains(getKey())) {
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_STATUS_BAR_DISABLE,
+ getKey());
mBlacklist.add(getKey());
setList(mBlacklist);
}
} else {
if (mBlacklist.remove(getKey())) {
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_STATUS_BAR_ENABLE, getKey());
setList(mBlacklist);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
index 4bb9250..71b5de5 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
@@ -37,6 +37,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.tuner.TunerService.Tunable;
@@ -108,6 +109,7 @@ public class TunerFragment extends PreferenceFragment {
System.getUriFor(SHOW_PERCENT_SETTING), false, mSettingObserver);
registerPrefs(getPreferenceScreen());
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER, true);
}
@Override
@@ -116,6 +118,7 @@ public class TunerFragment extends PreferenceFragment {
getContext().getContentResolver().unregisterContentObserver(mSettingObserver);
unregisterPrefs(getPreferenceScreen());
+ MetricsLogger.visibility(getContext(), MetricsLogger.TUNER, false);
}
private void registerPrefs(PreferenceGroup group) {
@@ -190,6 +193,7 @@ public class TunerFragment extends PreferenceFragment {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean v = (Boolean) newValue;
+ MetricsLogger.action(getContext(), MetricsLogger.TUNER_BATTERY_PERCENTAGE, v);
System.putInt(getContext().getContentResolver(), SHOW_PERCENT_SETTING, v ? 1 : 0);
return true;
}