From 6418e974a13aa580de3827caec72bab83837ea22 Mon Sep 17 00:00:00 2001 From: Govinda Wasserman Date: Mon, 3 Jun 2019 12:37:43 -0400 Subject: [PATCH] Refactors logging into its own function This will allow logging behavior to be overridden. Test: Tested locally BUG:128982146 Change-Id: Iaabc4ad0b44147732e05b4b9317e49bcee91683d --- .../android/systemui/assist/AssistManager.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 67fcd68339e29..c7c10f1c22117 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -259,11 +259,7 @@ public class AssistManager implements ConfigurationChangedReceiver { int phoneState = mPhoneStateMonitor.getPhoneState(); args.putInt(INVOCATION_PHONE_STATE_KEY, phoneState); args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.uptimeMillis()); - // Logs assistant start with invocation type. - MetricsLogger.action( - new LogMaker(MetricsEvent.ASSISTANT) - .setType(MetricsEvent.TYPE_OPEN) - .setSubtype(toLoggingSubType(invocationType, phoneState))); + logStartAssist(invocationType, phoneState); startAssistInternal(args, assistComponent, isService); } @@ -449,7 +445,14 @@ public class AssistManager implements ConfigurationChangedReceiver { return toLoggingSubType(invocationType, mPhoneStateMonitor.getPhoneState()); } - private int toLoggingSubType(int invocationType, int phoneState) { + protected void logStartAssist(int invocationType, int phoneState) { + MetricsLogger.action( + new LogMaker(MetricsEvent.ASSISTANT) + .setType(MetricsEvent.TYPE_OPEN) + .setSubtype(toLoggingSubType(invocationType, phoneState))); + } + + protected final int toLoggingSubType(int invocationType, int phoneState) { // Note that this logic will break if the number of Assistant invocation types exceeds 7. // There are currently 5 invocation types, but we will be migrating to the new logging // framework in the next update.