Merge "Update volume logging" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-11 16:49:15 +00:00
committed by Android (Google) Code Review
3 changed files with 40 additions and 22 deletions

View File

@@ -52,26 +52,28 @@ public class Events {
public static final int EVENT_MUTE_CHANGED = 15; // (stream|int) (muted|bool)
public static final int EVENT_TOUCH_LEVEL_DONE = 16; // (stream|int) (level|bool)
public static final int EVENT_ZEN_CONFIG_CHANGED = 17; // (allow/disallow|string)
public static final int EVENT_RINGER_TOGGLE = 18; // (ringer_mode)
private static final String[] EVENT_TAGS = {
"show_dialog",
"dismiss_dialog",
"active_stream_changed",
"expand",
"key",
"collection_started",
"collection_stopped",
"icon_click",
"settings_click",
"touch_level_changed",
"level_changed",
"internal_ringer_mode_changed",
"external_ringer_mode_changed",
"zen_mode_changed",
"suppressor_changed",
"mute_changed",
"touch_level_done",
"zen_mode_config_changed",
"show_dialog",
"dismiss_dialog",
"active_stream_changed",
"expand",
"key",
"collection_started",
"collection_stopped",
"icon_click",
"settings_click",
"touch_level_changed",
"level_changed",
"internal_ringer_mode_changed",
"external_ringer_mode_changed",
"zen_mode_changed",
"suppressor_changed",
"mute_changed",
"touch_level_done",
"zen_mode_config_changed",
"ringer_toggle"
};
public static final int DISMISS_REASON_UNKNOWN = 0;
@@ -112,6 +114,7 @@ public class Events {
public static Callback sCallback;
public static void writeEvent(Context context, int tag, Object... list) {
MetricsLogger logger = new MetricsLogger();
final long time = System.currentTimeMillis();
final StringBuilder sb = new StringBuilder("writeEvent ").append(EVENT_TAGS[tag]);
if (list != null && list.length > 0) {
@@ -139,7 +142,7 @@ public class Events {
break;
case EVENT_ICON_CLICK:
MetricsLogger.action(context, MetricsEvent.ACTION_VOLUME_ICON,
(Integer) list[1]);
(Integer) list[0]);
sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ')
.append(iconStateToString((Integer) list[1]));
break;
@@ -155,10 +158,16 @@ public class Events {
break;
case EVENT_KEY:
MetricsLogger.action(context, MetricsEvent.ACTION_VOLUME_KEY,
(Integer) list[1]);
(Integer) list[0]);
sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ')
.append(list[1]);
break;
case EVENT_RINGER_TOGGLE:
logger.action(MetricsEvent.ACTION_VOLUME_RINGER_TOGGLE, (Integer) list[0]);
break;
case EVENT_SETTINGS_CLICK:
logger.action(MetricsEvent.ACTION_VOLUME_SETTINGS);
break;
case EVENT_EXTERNAL_RINGER_MODE_CHANGED:
MetricsLogger.action(context, MetricsEvent.ACTION_RINGER_MODE,
(Integer) list[0]);

View File

@@ -415,6 +415,7 @@ public class VolumeDialogImpl implements VolumeDialog {
mSettingsView.setVisibility(
mDeviceProvisionedController.isDeviceProvisioned() ? VISIBLE : GONE);
mSettingsIcon.setOnClickListener(v -> {
Events.writeEvent(mContext, Events.EVENT_SETTINGS_CLICK);
Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
dismissH(DISMISS_REASON_SETTINGS_CLICKED);
@@ -424,8 +425,6 @@ public class VolumeDialogImpl implements VolumeDialog {
public void initRingerH() {
mRingerIcon.setOnClickListener(v -> {
Events.writeEvent(mContext, Events.EVENT_ICON_CLICK, AudioManager.STREAM_RING,
mRingerIcon.getTag());
Prefs.putBoolean(mContext, Prefs.Key.TOUCHED_RINGER_TOGGLE, true);
final StreamState ss = mState.states.get(AudioManager.STREAM_RING);
if (ss == null) {
@@ -449,6 +448,7 @@ public class VolumeDialogImpl implements VolumeDialog {
mController.setStreamVolume(AudioManager.STREAM_RING, 1);
}
}
Events.writeEvent(mContext, Events.EVENT_RINGER_TOGGLE, newRingerMode);
updateRingerH();
provideTouchFeedbackH(newRingerMode);
mController.setRingerMode(newRingerMode, false);

View File

@@ -5636,6 +5636,15 @@ message MetricsEvent {
// OS: P
NOTIFICATION_SMART_REPLY_COUNT = 1384;
// Volume dialog > ringer toggle
// OS: P
ACTION_VOLUME_RINGER_TOGGLE = 1385;
// Volume dialog > settings button
// OS: P
ACTION_VOLUME_SETTINGS = 1386;
// ---- End P Constants, all P constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS