Loading packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +1 −1 Original line number Diff line number Diff line Loading @@ -164,7 +164,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac return Long.max(mShowAndGoEndsAt - SystemClock.elapsedRealtime(), 0); } boolean areHandlesShowing() { public boolean areHandlesShowing() { return mHandlesShowing; } Loading packages/SystemUI/src/com/android/systemui/assist/AssistLogger.kt 0 → 100644 +142 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.assist import android.content.ComponentName import android.content.Context import android.content.pm.PackageManager import android.util.Log import com.android.internal.app.AssistUtils import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import com.android.internal.logging.UiEventLogger import com.android.internal.util.FrameworkStatsLog import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.assist.AssistantInvocationEvent.Companion.deviceStateFromLegacyDeviceState import com.android.systemui.assist.AssistantInvocationEvent.Companion.eventFromLegacyInvocationType import javax.inject.Inject import javax.inject.Singleton /** Class for reporting events related to Assistant sessions. */ @Singleton open class AssistLogger @Inject constructor( protected val context: Context, protected val uiEventLogger: UiEventLogger, private val assistUtils: AssistUtils, private val phoneStateMonitor: PhoneStateMonitor, private val assistHandleBehaviorController: AssistHandleBehaviorController ) { private val instanceIdSequence = InstanceIdSequence(INSTANCE_ID_MAX) private var currentInstanceId: InstanceId? = null fun reportAssistantInvocationEventFromLegacy( legacyInvocationType: Int, isInvocationComplete: Boolean, assistantComponent: ComponentName? = null, legacyDeviceState: Int? = null ) { val deviceState = if (legacyDeviceState == null) { null } else { deviceStateFromLegacyDeviceState(legacyDeviceState) } reportAssistantInvocationEvent( eventFromLegacyInvocationType(legacyInvocationType, isInvocationComplete), assistantComponent, deviceState) } fun reportAssistantInvocationEvent( invocationEvent: AssistantInvocationEvent, assistantComponent: ComponentName? = null, deviceState: Int? = null ) { val assistComponentFinal = assistantComponent ?: getAssistantComponentForCurrentUser() val assistantUid = getAssistantUid(assistComponentFinal) val deviceStateFinal = deviceState ?: deviceStateFromLegacyDeviceState(phoneStateMonitor.phoneState) FrameworkStatsLog.write( FrameworkStatsLog.ASSISTANT_INVOCATION_REPORTED, invocationEvent.id, assistantUid, assistComponentFinal.flattenToString(), getOrCreateInstanceId().id, deviceStateFinal, assistHandleBehaviorController.areHandlesShowing()) reportAssistantInvocationExtraData() } fun reportAssistantSessionEvent(sessionEvent: AssistantSessionEvent) { val assistantComponent = getAssistantComponentForCurrentUser() val assistantUid = getAssistantUid(assistantComponent) uiEventLogger.logWithInstanceId( sessionEvent, assistantUid, assistantComponent.flattenToString(), getOrCreateInstanceId()) if (SESSION_END_EVENTS.contains(sessionEvent)) { clearInstanceId() } } protected open fun reportAssistantInvocationExtraData() { } protected fun getOrCreateInstanceId(): InstanceId { val instanceId = currentInstanceId ?: instanceIdSequence.newInstanceId() currentInstanceId = instanceId return instanceId } protected fun clearInstanceId() { currentInstanceId = null } protected fun getAssistantComponentForCurrentUser(): ComponentName { return assistUtils.getAssistComponentForUser(KeyguardUpdateMonitor.getCurrentUser()) } protected fun getAssistantUid(assistantComponent: ComponentName): Int { var assistantUid = 0 try { assistantUid = context.packageManager.getApplicationInfo( assistantComponent.packageName, /* flags = */ 0).uid } catch (e: PackageManager.NameNotFoundException) { Log.e(TAG, "Unable to find Assistant UID", e) } return assistantUid } companion object { protected const val TAG = "AssistLogger" private const val INSTANCE_ID_MAX = 1 shl 20 private val SESSION_END_EVENTS = setOf( AssistantSessionEvent.ASSISTANT_SESSION_INVOCATION_CANCELLED, AssistantSessionEvent.ASSISTANT_SESSION_CLOSE) } } No newline at end of file packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +20 −42 Original line number Diff line number Diff line Loading @@ -40,11 +40,8 @@ import android.widget.ImageView; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionListener; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.util.FrameworkStatsLog; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.settingslib.applications.InterestingConfigChanges; import com.android.systemui.R; Loading Loading @@ -124,7 +121,6 @@ public class AssistManager { private static final long TIMEOUT_SERVICE = 2500; private static final long TIMEOUT_ACTIVITY = 1000; private static final int INSTANCE_ID_MAX = 1 << 20; protected final Context mContext; private final WindowManager mWindowManager; Loading @@ -134,8 +130,7 @@ public class AssistManager { private final AssistHandleBehaviorController mHandleController; private final UiController mUiController; protected final Lazy<SysUiState> mSysUiState; protected final InstanceIdSequence mInstanceIdSequence = new InstanceIdSequence(INSTANCE_ID_MAX); protected final AssistLogger mAssistLogger; private AssistOrbContainer mView; private final DeviceProvisionedController mDeviceProvisionedController; Loading Loading @@ -202,7 +197,9 @@ public class AssistManager { PhoneStateMonitor phoneStateMonitor, OverviewProxyService overviewProxyService, ConfigurationController configurationController, Lazy<SysUiState> sysUiState) { Lazy<SysUiState> sysUiState, DefaultUiController defaultUiController, AssistLogger assistLogger) { mContext = context; mDeviceProvisionedController = controller; mCommandQueue = commandQueue; Loading @@ -211,6 +208,7 @@ public class AssistManager { mAssistDisclosure = new AssistDisclosure(context, new Handler()); mPhoneStateMonitor = phoneStateMonitor; mHandleController = handleController; mAssistLogger = assistLogger; configurationController.addCallback(mConfigurationListener); Loading @@ -221,7 +219,7 @@ public class AssistManager { mConfigurationListener.onConfigChanged(context.getResources().getConfiguration()); mShouldEnableOrb = !ActivityManager.isLowRamDeviceStatic(); mUiController = new DefaultUiController(mContext); mUiController = defaultUiController; mSysUiState = sysUiState; Loading @@ -248,6 +246,8 @@ public class AssistManager { if (VERBOSE) { Log.v(TAG, "Voice open"); } mAssistLogger.reportAssistantSessionEvent( AssistantSessionEvent.ASSISTANT_SESSION_UPDATE); } @Override Loading @@ -255,6 +255,8 @@ public class AssistManager { if (VERBOSE) { Log.v(TAG, "Voice closed"); } mAssistLogger.reportAssistantSessionEvent( AssistantSessionEvent.ASSISTANT_SESSION_CLOSE); } @Override Loading Loading @@ -298,15 +300,19 @@ public class AssistManager { if (args == null) { args = new Bundle(); } int invocationType = args.getInt(INVOCATION_TYPE_KEY, 0); if (invocationType == INVOCATION_TYPE_GESTURE) { int legacyInvocationType = args.getInt(INVOCATION_TYPE_KEY, 0); if (legacyInvocationType == INVOCATION_TYPE_GESTURE) { mHandleController.onAssistantGesturePerformed(); } int phoneState = mPhoneStateMonitor.getPhoneState(); args.putInt(INVOCATION_PHONE_STATE_KEY, phoneState); int legacyDeviceState = mPhoneStateMonitor.getPhoneState(); args.putInt(INVOCATION_PHONE_STATE_KEY, legacyDeviceState); args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.elapsedRealtime()); logStartAssist(/* instanceId = */ null, invocationType, phoneState); logStartAssistLegacy(invocationType, phoneState); mAssistLogger.reportAssistantInvocationEventFromLegacy( legacyInvocationType, /* isInvocationComplete = */ true, assistComponent, legacyDeviceState); logStartAssistLegacy(legacyInvocationType, legacyDeviceState); startAssistInternal(args, assistComponent, isService); } Loading Loading @@ -506,34 +512,6 @@ public class AssistManager { return toLoggingSubType(invocationType, mPhoneStateMonitor.getPhoneState()); } protected void logStartAssist( @Nullable InstanceId instanceId, int invocationType, int deviceState) { InstanceId currentInstanceId = instanceId == null ? mInstanceIdSequence.newInstanceId() : instanceId; ComponentName assistantComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); int assistantUid = 0; try { assistantUid = mContext.getPackageManager() .getApplicationInfo( assistantComponent.getPackageName(), /* flags = */ 0) .uid; } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Unable to find Assistant UID", e); } FrameworkStatsLog.write( FrameworkStatsLog.ASSISTANT_INVOCATION_REPORTED, AssistantInvocationEvent.Companion.eventIdFromLegacyInvocationType(invocationType), assistantUid, assistantComponent.flattenToString(), currentInstanceId.getId(), AssistantInvocationEvent.Companion.deviceStateFromLegacyDeviceState(deviceState), mHandleController.areHandlesShowing()); } protected void logStartAssistLegacy(int invocationType, int phoneState) { MetricsLogger.action( new LogMaker(MetricsEvent.ASSISTANT) Loading packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt +43 −21 Original line number Diff line number Diff line Loading @@ -50,15 +50,26 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent ASSISTANT_INVOCATION_HOME_LONG_PRESS(447), @UiEvent(doc = "Assistant invoked by physical gesture") ASSISTANT_INVOCATION_PHYSICAL_GESTURE(448); ASSISTANT_INVOCATION_PHYSICAL_GESTURE(448), @UiEvent(doc = "Assistant invocation started by unknown method") ASSISTANT_INVOCATION_START_UNKNOWN(530), @UiEvent(doc = "Assistant invocation started by touch gesture") ASSISTANT_INVOCATION_START_TOUCH_GESTURE(531), @UiEvent(doc = "Assistant invocation started by physical gesture") ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE(532); override fun getId(): Int { return id } companion object { fun eventIdFromLegacyInvocationType(legacyInvocationType: Int): Int { return when (legacyInvocationType) { fun eventFromLegacyInvocationType(legacyInvocationType: Int, isInvocationComplete: Boolean) : AssistantInvocationEvent { return if (isInvocationComplete) { when (legacyInvocationType) { AssistManager.INVOCATION_TYPE_GESTURE -> ASSISTANT_INVOCATION_TOUCH_GESTURE Loading @@ -76,7 +87,18 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent else -> ASSISTANT_INVOCATION_UNKNOWN }.id } } else { when (legacyInvocationType) { AssistManager.INVOCATION_TYPE_GESTURE -> ASSISTANT_INVOCATION_START_TOUCH_GESTURE AssistManager.INVOCATION_TYPE_OTHER -> ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE else -> ASSISTANT_INVOCATION_START_UNKNOWN } } } fun deviceStateFromLegacyDeviceState(legacyDeviceState: Int): Int { Loading packages/SystemUI/src/com/android/systemui/assist/AssistantSessionEvent.kt 0 → 100644 +48 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.assist import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger enum class AssistantSessionEvent(private val id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "Unknown assistant session event") ASSISTANT_SESSION_UNKNOWN(523), @UiEvent(doc = "Assistant session dismissed due to timeout") ASSISTANT_SESSION_TIMEOUT_DISMISS(524), @UiEvent(doc = "User began a gesture for invoking the Assistant") ASSISTANT_SESSION_INVOCATION_START(525), @UiEvent(doc = "User stopped a gesture for invoking the Assistant before the gesture was completed") ASSISTANT_SESSION_INVOCATION_CANCELLED(526), @UiEvent(doc = "User manually dismissed the Assistant session") ASSISTANT_SESSION_USER_DISMISS(527), @UiEvent(doc = "The Assistant session has changed modes") ASSISTANT_SESSION_UPDATE(528), @UiEvent(doc = "The Assistant session completed") ASSISTANT_SESSION_CLOSE(529); override fun getId(): Int { return id } } No newline at end of file Loading
packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +1 −1 Original line number Diff line number Diff line Loading @@ -164,7 +164,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac return Long.max(mShowAndGoEndsAt - SystemClock.elapsedRealtime(), 0); } boolean areHandlesShowing() { public boolean areHandlesShowing() { return mHandlesShowing; } Loading
packages/SystemUI/src/com/android/systemui/assist/AssistLogger.kt 0 → 100644 +142 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.assist import android.content.ComponentName import android.content.Context import android.content.pm.PackageManager import android.util.Log import com.android.internal.app.AssistUtils import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import com.android.internal.logging.UiEventLogger import com.android.internal.util.FrameworkStatsLog import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.assist.AssistantInvocationEvent.Companion.deviceStateFromLegacyDeviceState import com.android.systemui.assist.AssistantInvocationEvent.Companion.eventFromLegacyInvocationType import javax.inject.Inject import javax.inject.Singleton /** Class for reporting events related to Assistant sessions. */ @Singleton open class AssistLogger @Inject constructor( protected val context: Context, protected val uiEventLogger: UiEventLogger, private val assistUtils: AssistUtils, private val phoneStateMonitor: PhoneStateMonitor, private val assistHandleBehaviorController: AssistHandleBehaviorController ) { private val instanceIdSequence = InstanceIdSequence(INSTANCE_ID_MAX) private var currentInstanceId: InstanceId? = null fun reportAssistantInvocationEventFromLegacy( legacyInvocationType: Int, isInvocationComplete: Boolean, assistantComponent: ComponentName? = null, legacyDeviceState: Int? = null ) { val deviceState = if (legacyDeviceState == null) { null } else { deviceStateFromLegacyDeviceState(legacyDeviceState) } reportAssistantInvocationEvent( eventFromLegacyInvocationType(legacyInvocationType, isInvocationComplete), assistantComponent, deviceState) } fun reportAssistantInvocationEvent( invocationEvent: AssistantInvocationEvent, assistantComponent: ComponentName? = null, deviceState: Int? = null ) { val assistComponentFinal = assistantComponent ?: getAssistantComponentForCurrentUser() val assistantUid = getAssistantUid(assistComponentFinal) val deviceStateFinal = deviceState ?: deviceStateFromLegacyDeviceState(phoneStateMonitor.phoneState) FrameworkStatsLog.write( FrameworkStatsLog.ASSISTANT_INVOCATION_REPORTED, invocationEvent.id, assistantUid, assistComponentFinal.flattenToString(), getOrCreateInstanceId().id, deviceStateFinal, assistHandleBehaviorController.areHandlesShowing()) reportAssistantInvocationExtraData() } fun reportAssistantSessionEvent(sessionEvent: AssistantSessionEvent) { val assistantComponent = getAssistantComponentForCurrentUser() val assistantUid = getAssistantUid(assistantComponent) uiEventLogger.logWithInstanceId( sessionEvent, assistantUid, assistantComponent.flattenToString(), getOrCreateInstanceId()) if (SESSION_END_EVENTS.contains(sessionEvent)) { clearInstanceId() } } protected open fun reportAssistantInvocationExtraData() { } protected fun getOrCreateInstanceId(): InstanceId { val instanceId = currentInstanceId ?: instanceIdSequence.newInstanceId() currentInstanceId = instanceId return instanceId } protected fun clearInstanceId() { currentInstanceId = null } protected fun getAssistantComponentForCurrentUser(): ComponentName { return assistUtils.getAssistComponentForUser(KeyguardUpdateMonitor.getCurrentUser()) } protected fun getAssistantUid(assistantComponent: ComponentName): Int { var assistantUid = 0 try { assistantUid = context.packageManager.getApplicationInfo( assistantComponent.packageName, /* flags = */ 0).uid } catch (e: PackageManager.NameNotFoundException) { Log.e(TAG, "Unable to find Assistant UID", e) } return assistantUid } companion object { protected const val TAG = "AssistLogger" private const val INSTANCE_ID_MAX = 1 shl 20 private val SESSION_END_EVENTS = setOf( AssistantSessionEvent.ASSISTANT_SESSION_INVOCATION_CANCELLED, AssistantSessionEvent.ASSISTANT_SESSION_CLOSE) } } No newline at end of file
packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +20 −42 Original line number Diff line number Diff line Loading @@ -40,11 +40,8 @@ import android.widget.ImageView; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionListener; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.util.FrameworkStatsLog; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.settingslib.applications.InterestingConfigChanges; import com.android.systemui.R; Loading Loading @@ -124,7 +121,6 @@ public class AssistManager { private static final long TIMEOUT_SERVICE = 2500; private static final long TIMEOUT_ACTIVITY = 1000; private static final int INSTANCE_ID_MAX = 1 << 20; protected final Context mContext; private final WindowManager mWindowManager; Loading @@ -134,8 +130,7 @@ public class AssistManager { private final AssistHandleBehaviorController mHandleController; private final UiController mUiController; protected final Lazy<SysUiState> mSysUiState; protected final InstanceIdSequence mInstanceIdSequence = new InstanceIdSequence(INSTANCE_ID_MAX); protected final AssistLogger mAssistLogger; private AssistOrbContainer mView; private final DeviceProvisionedController mDeviceProvisionedController; Loading Loading @@ -202,7 +197,9 @@ public class AssistManager { PhoneStateMonitor phoneStateMonitor, OverviewProxyService overviewProxyService, ConfigurationController configurationController, Lazy<SysUiState> sysUiState) { Lazy<SysUiState> sysUiState, DefaultUiController defaultUiController, AssistLogger assistLogger) { mContext = context; mDeviceProvisionedController = controller; mCommandQueue = commandQueue; Loading @@ -211,6 +208,7 @@ public class AssistManager { mAssistDisclosure = new AssistDisclosure(context, new Handler()); mPhoneStateMonitor = phoneStateMonitor; mHandleController = handleController; mAssistLogger = assistLogger; configurationController.addCallback(mConfigurationListener); Loading @@ -221,7 +219,7 @@ public class AssistManager { mConfigurationListener.onConfigChanged(context.getResources().getConfiguration()); mShouldEnableOrb = !ActivityManager.isLowRamDeviceStatic(); mUiController = new DefaultUiController(mContext); mUiController = defaultUiController; mSysUiState = sysUiState; Loading @@ -248,6 +246,8 @@ public class AssistManager { if (VERBOSE) { Log.v(TAG, "Voice open"); } mAssistLogger.reportAssistantSessionEvent( AssistantSessionEvent.ASSISTANT_SESSION_UPDATE); } @Override Loading @@ -255,6 +255,8 @@ public class AssistManager { if (VERBOSE) { Log.v(TAG, "Voice closed"); } mAssistLogger.reportAssistantSessionEvent( AssistantSessionEvent.ASSISTANT_SESSION_CLOSE); } @Override Loading Loading @@ -298,15 +300,19 @@ public class AssistManager { if (args == null) { args = new Bundle(); } int invocationType = args.getInt(INVOCATION_TYPE_KEY, 0); if (invocationType == INVOCATION_TYPE_GESTURE) { int legacyInvocationType = args.getInt(INVOCATION_TYPE_KEY, 0); if (legacyInvocationType == INVOCATION_TYPE_GESTURE) { mHandleController.onAssistantGesturePerformed(); } int phoneState = mPhoneStateMonitor.getPhoneState(); args.putInt(INVOCATION_PHONE_STATE_KEY, phoneState); int legacyDeviceState = mPhoneStateMonitor.getPhoneState(); args.putInt(INVOCATION_PHONE_STATE_KEY, legacyDeviceState); args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.elapsedRealtime()); logStartAssist(/* instanceId = */ null, invocationType, phoneState); logStartAssistLegacy(invocationType, phoneState); mAssistLogger.reportAssistantInvocationEventFromLegacy( legacyInvocationType, /* isInvocationComplete = */ true, assistComponent, legacyDeviceState); logStartAssistLegacy(legacyInvocationType, legacyDeviceState); startAssistInternal(args, assistComponent, isService); } Loading Loading @@ -506,34 +512,6 @@ public class AssistManager { return toLoggingSubType(invocationType, mPhoneStateMonitor.getPhoneState()); } protected void logStartAssist( @Nullable InstanceId instanceId, int invocationType, int deviceState) { InstanceId currentInstanceId = instanceId == null ? mInstanceIdSequence.newInstanceId() : instanceId; ComponentName assistantComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); int assistantUid = 0; try { assistantUid = mContext.getPackageManager() .getApplicationInfo( assistantComponent.getPackageName(), /* flags = */ 0) .uid; } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Unable to find Assistant UID", e); } FrameworkStatsLog.write( FrameworkStatsLog.ASSISTANT_INVOCATION_REPORTED, AssistantInvocationEvent.Companion.eventIdFromLegacyInvocationType(invocationType), assistantUid, assistantComponent.flattenToString(), currentInstanceId.getId(), AssistantInvocationEvent.Companion.deviceStateFromLegacyDeviceState(deviceState), mHandleController.areHandlesShowing()); } protected void logStartAssistLegacy(int invocationType, int phoneState) { MetricsLogger.action( new LogMaker(MetricsEvent.ASSISTANT) Loading
packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt +43 −21 Original line number Diff line number Diff line Loading @@ -50,15 +50,26 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent ASSISTANT_INVOCATION_HOME_LONG_PRESS(447), @UiEvent(doc = "Assistant invoked by physical gesture") ASSISTANT_INVOCATION_PHYSICAL_GESTURE(448); ASSISTANT_INVOCATION_PHYSICAL_GESTURE(448), @UiEvent(doc = "Assistant invocation started by unknown method") ASSISTANT_INVOCATION_START_UNKNOWN(530), @UiEvent(doc = "Assistant invocation started by touch gesture") ASSISTANT_INVOCATION_START_TOUCH_GESTURE(531), @UiEvent(doc = "Assistant invocation started by physical gesture") ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE(532); override fun getId(): Int { return id } companion object { fun eventIdFromLegacyInvocationType(legacyInvocationType: Int): Int { return when (legacyInvocationType) { fun eventFromLegacyInvocationType(legacyInvocationType: Int, isInvocationComplete: Boolean) : AssistantInvocationEvent { return if (isInvocationComplete) { when (legacyInvocationType) { AssistManager.INVOCATION_TYPE_GESTURE -> ASSISTANT_INVOCATION_TOUCH_GESTURE Loading @@ -76,7 +87,18 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent else -> ASSISTANT_INVOCATION_UNKNOWN }.id } } else { when (legacyInvocationType) { AssistManager.INVOCATION_TYPE_GESTURE -> ASSISTANT_INVOCATION_START_TOUCH_GESTURE AssistManager.INVOCATION_TYPE_OTHER -> ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE else -> ASSISTANT_INVOCATION_START_UNKNOWN } } } fun deviceStateFromLegacyDeviceState(legacyDeviceState: Int): Int { Loading
packages/SystemUI/src/com/android/systemui/assist/AssistantSessionEvent.kt 0 → 100644 +48 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.assist import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger enum class AssistantSessionEvent(private val id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "Unknown assistant session event") ASSISTANT_SESSION_UNKNOWN(523), @UiEvent(doc = "Assistant session dismissed due to timeout") ASSISTANT_SESSION_TIMEOUT_DISMISS(524), @UiEvent(doc = "User began a gesture for invoking the Assistant") ASSISTANT_SESSION_INVOCATION_START(525), @UiEvent(doc = "User stopped a gesture for invoking the Assistant before the gesture was completed") ASSISTANT_SESSION_INVOCATION_CANCELLED(526), @UiEvent(doc = "User manually dismissed the Assistant session") ASSISTANT_SESSION_USER_DISMISS(527), @UiEvent(doc = "The Assistant session has changed modes") ASSISTANT_SESSION_UPDATE(528), @UiEvent(doc = "The Assistant session completed") ASSISTANT_SESSION_CLOSE(529); override fun getId(): Int { return id } } No newline at end of file