Use MetricsFeatureProvider for logging in Settings.

Bug: 31664539
Test: make RunSettingsRoboTests for regression
Test: adb logcat -b events | egrep "(sysui_|notification_)" for
      verifying log

Change-Id: Id944be7c4ff9911aebee481c2df485542f1318f0
This commit is contained in:
Fan Zhang
2016-09-22 10:43:12 -07:00
parent f91cf3cfa7
commit aa71afe597
28 changed files with 204 additions and 125 deletions

View File

@@ -27,7 +27,6 @@ import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.search.Indexable;
@@ -64,7 +63,8 @@ public class ZenModePrioritySettings extends ZenModeSettingsBase implements Inde
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mDisableListeners) return true;
final boolean val = (Boolean) newValue;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_REMINDERS, val);
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_REMINDERS,
val);
if (DEBUG) Log.d(TAG, "onPrefChange allowReminders=" + val);
savePolicy(getNewPriorityCategories(val, Policy.PRIORITY_CATEGORY_REMINDERS),
mPolicy.priorityCallSenders, mPolicy.priorityMessageSenders,
@@ -79,7 +79,7 @@ public class ZenModePrioritySettings extends ZenModeSettingsBase implements Inde
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mDisableListeners) return true;
final boolean val = (Boolean) newValue;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_EVENTS, val);
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_EVENTS, val);
if (DEBUG) Log.d(TAG, "onPrefChange allowEvents=" + val);
savePolicy(getNewPriorityCategories(val, Policy.PRIORITY_CATEGORY_EVENTS),
mPolicy.priorityCallSenders, mPolicy.priorityMessageSenders,
@@ -98,7 +98,7 @@ public class ZenModePrioritySettings extends ZenModeSettingsBase implements Inde
final boolean allowMessages = val != SOURCE_NONE;
final int allowMessagesFrom =
val == SOURCE_NONE ? mPolicy.priorityMessageSenders : val;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_MESSAGES, val);
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_MESSAGES, val);
if (DEBUG) Log.d(TAG, "onPrefChange allowMessages=" + allowMessages
+ " allowMessagesFrom=" + ZenModeConfig.sourceToString(allowMessagesFrom));
savePolicy(
@@ -118,7 +118,7 @@ public class ZenModePrioritySettings extends ZenModeSettingsBase implements Inde
final int val = Integer.parseInt((String) newValue);
final boolean allowCalls = val != SOURCE_NONE;
final int allowCallsFrom = val == SOURCE_NONE ? mPolicy.priorityCallSenders : val;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_CALLS, val);
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_CALLS, val);
if (DEBUG) Log.d(TAG, "onPrefChange allowCalls=" + allowCalls
+ " allowCallsFrom=" + ZenModeConfig.sourceToString(allowCallsFrom));
savePolicy(getNewPriorityCategories(allowCalls, Policy.PRIORITY_CATEGORY_CALLS),
@@ -137,7 +137,8 @@ public class ZenModePrioritySettings extends ZenModeSettingsBase implements Inde
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mDisableListeners) return true;
final boolean val = (Boolean) newValue;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_REPEAT_CALLS, val);
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_REPEAT_CALLS,
val);
if (DEBUG) Log.d(TAG, "onPrefChange allowRepeatCallers=" + val);
int priorityCategories = getNewPriorityCategories(val,
NotificationManager.Policy.PRIORITY_CATEGORY_REPEAT_CALLERS);