From cef103b9377236a102b2a741db415e2992cbcc35 Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Tue, 7 Apr 2020 16:26:47 +0800 Subject: [PATCH] Add an interface in SettingsInjector to log metrics Bug: 137559984 Test: robotest Change-Id: Ifb7cbff3d2ade8fde01ac86fab527da9d9b57437 --- .../com/android/settingslib/location/SettingsInjector.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java index ff40d8e00603e..450bdb1619332 100644 --- a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java +++ b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java @@ -201,6 +201,12 @@ public class SettingsInjector { return new Preference(prefContext); } + /** + * Gives descendants a chance to log Preference click event + */ + protected void logPreferenceClick(Intent intent) { + } + /** * Returns the settings parsed from the attributes of the * {@link SettingInjectorService#META_DATA_NAME} tag, or null. @@ -315,6 +321,7 @@ public class SettingsInjector { // Settings > Location. Intent settingIntent = new Intent(); settingIntent.setClassName(mInfo.packageName, mInfo.settingsActivity); + logPreferenceClick(settingIntent); // Sometimes the user may navigate back to "Settings" and launch another different // injected setting after one injected setting has been launched. //