From 8af3a2416e40a9a1cfc1dd2114a771ef1bca918b Mon Sep 17 00:00:00 2001 From: Shaotang Li Date: Thu, 2 Aug 2018 11:18:00 +0800 Subject: [PATCH] Add new metrics in power menu These include, 1. An event indicating that power menu is shown. 2. An event indicating that user taps the emergency dialer icon. Bug: 112168722 Bug: 111378820 Test: manual and check the result of 'adb logcat -b events | grep sysui_multi_action' Change-Id: I958ed1af65f559e4999517031cd80fbb1c417108 Merged-In: I958ed1af65f559e4999517031cd80fbb1c417108 --- .../android/systemui/globalactions/GlobalActionsDialog.java | 9 ++++++++- proto/src/metrics_constants.proto | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index f4cdbac9f223..3eb49be71fa2 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -102,7 +102,7 @@ import java.util.List; * is provisioned. */ class GlobalActionsDialog implements DialogInterface.OnDismissListener, - DialogInterface.OnClickListener { + DialogInterface.OnClickListener, DialogInterface.OnShowListener { static public final String SYSTEM_DIALOG_REASON_KEY = "reason"; static public final String SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS = "globalactions"; @@ -399,6 +399,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, dialog.setKeyguardShowing(mKeyguardShowing); dialog.setOnDismissListener(this); + dialog.setOnShowListener(this); return dialog; } @@ -457,6 +458,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, @Override public void onPress() { + MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU); Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE, @@ -863,6 +865,11 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, item.onPress(); } + /** {@inheritDoc} */ + public void onShow(DialogInterface dialog) { + MetricsLogger.visible(mContext, MetricsEvent.POWER_MENU); + } + /** * The adapter used for the list within the global actions dialog, taking * into account whether the keyguard is showing via diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index b990175fd616..d79d833f2233 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -6482,6 +6482,16 @@ message MetricsEvent { // OS: Q FIELD_EMERGENCY_DIALER_SHORTCUT_TAPS_INTERVAL = 1567; + // OPEN: Power menu is opened + // CATEGORY: GLOBAL_SYSTEM_UI + // OS: Q + POWER_MENU = 1568; + + // ACTION: User tapped emergency dialer icon in the power menu. + // CATEGORY: GLOBAL_SYSTEM_UI + // OS: Q + ACTION_EMERGENCY_DIALER_FROM_POWER_MENU = 1569; + // ---- End Q Constants, all Q constants go above this line ---- // Add new aosp constants above this line. -- 2.11.0