Merge commit '0ac895d970e70a1300efb853802f4d2b3443ee22' of persistent-https://googleplex-android.git.corp.google.com/platform/frameworks/base into merge_conflict
Change-Id: Ia69d97ab86a7a37318fdb2512f4756d6ef438c0e Merged-In: I306dfc37155caf0c3d9c5db23e1fdc9d5d37399e
This commit is contained in:
@@ -164,7 +164,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
|
|||||||
return Long.max(mShowAndGoEndsAt - SystemClock.elapsedRealtime(), 0);
|
return Long.max(mShowAndGoEndsAt - SystemClock.elapsedRealtime(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean areHandlesShowing() {
|
public boolean areHandlesShowing() {
|
||||||
return mHandlesShowing;
|
return mHandlesShowing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,11 +40,8 @@ import android.widget.ImageView;
|
|||||||
import com.android.internal.app.AssistUtils;
|
import com.android.internal.app.AssistUtils;
|
||||||
import com.android.internal.app.IVoiceInteractionSessionListener;
|
import com.android.internal.app.IVoiceInteractionSessionListener;
|
||||||
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
|
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.MetricsLogger;
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.internal.util.FrameworkStatsLog;
|
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.settingslib.applications.InterestingConfigChanges;
|
import com.android.settingslib.applications.InterestingConfigChanges;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -124,7 +121,6 @@ public class AssistManager {
|
|||||||
|
|
||||||
private static final long TIMEOUT_SERVICE = 2500;
|
private static final long TIMEOUT_SERVICE = 2500;
|
||||||
private static final long TIMEOUT_ACTIVITY = 1000;
|
private static final long TIMEOUT_ACTIVITY = 1000;
|
||||||
private static final int INSTANCE_ID_MAX = 1 << 20;
|
|
||||||
|
|
||||||
protected final Context mContext;
|
protected final Context mContext;
|
||||||
private final WindowManager mWindowManager;
|
private final WindowManager mWindowManager;
|
||||||
@@ -134,8 +130,7 @@ public class AssistManager {
|
|||||||
private final AssistHandleBehaviorController mHandleController;
|
private final AssistHandleBehaviorController mHandleController;
|
||||||
private final UiController mUiController;
|
private final UiController mUiController;
|
||||||
protected final Lazy<SysUiState> mSysUiState;
|
protected final Lazy<SysUiState> mSysUiState;
|
||||||
protected final InstanceIdSequence mInstanceIdSequence =
|
protected final AssistLogger mAssistLogger;
|
||||||
new InstanceIdSequence(INSTANCE_ID_MAX);
|
|
||||||
|
|
||||||
private AssistOrbContainer mView;
|
private AssistOrbContainer mView;
|
||||||
private final DeviceProvisionedController mDeviceProvisionedController;
|
private final DeviceProvisionedController mDeviceProvisionedController;
|
||||||
@@ -202,7 +197,9 @@ public class AssistManager {
|
|||||||
PhoneStateMonitor phoneStateMonitor,
|
PhoneStateMonitor phoneStateMonitor,
|
||||||
OverviewProxyService overviewProxyService,
|
OverviewProxyService overviewProxyService,
|
||||||
ConfigurationController configurationController,
|
ConfigurationController configurationController,
|
||||||
Lazy<SysUiState> sysUiState) {
|
Lazy<SysUiState> sysUiState,
|
||||||
|
DefaultUiController defaultUiController,
|
||||||
|
AssistLogger assistLogger) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDeviceProvisionedController = controller;
|
mDeviceProvisionedController = controller;
|
||||||
mCommandQueue = commandQueue;
|
mCommandQueue = commandQueue;
|
||||||
@@ -211,6 +208,7 @@ public class AssistManager {
|
|||||||
mAssistDisclosure = new AssistDisclosure(context, new Handler());
|
mAssistDisclosure = new AssistDisclosure(context, new Handler());
|
||||||
mPhoneStateMonitor = phoneStateMonitor;
|
mPhoneStateMonitor = phoneStateMonitor;
|
||||||
mHandleController = handleController;
|
mHandleController = handleController;
|
||||||
|
mAssistLogger = assistLogger;
|
||||||
|
|
||||||
configurationController.addCallback(mConfigurationListener);
|
configurationController.addCallback(mConfigurationListener);
|
||||||
|
|
||||||
@@ -221,7 +219,7 @@ public class AssistManager {
|
|||||||
mConfigurationListener.onConfigChanged(context.getResources().getConfiguration());
|
mConfigurationListener.onConfigChanged(context.getResources().getConfiguration());
|
||||||
mShouldEnableOrb = !ActivityManager.isLowRamDeviceStatic();
|
mShouldEnableOrb = !ActivityManager.isLowRamDeviceStatic();
|
||||||
|
|
||||||
mUiController = new DefaultUiController(mContext);
|
mUiController = defaultUiController;
|
||||||
|
|
||||||
mSysUiState = sysUiState;
|
mSysUiState = sysUiState;
|
||||||
|
|
||||||
@@ -248,6 +246,8 @@ public class AssistManager {
|
|||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
Log.v(TAG, "Voice open");
|
Log.v(TAG, "Voice open");
|
||||||
}
|
}
|
||||||
|
mAssistLogger.reportAssistantSessionEvent(
|
||||||
|
AssistantSessionEvent.ASSISTANT_SESSION_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -255,6 +255,8 @@ public class AssistManager {
|
|||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
Log.v(TAG, "Voice closed");
|
Log.v(TAG, "Voice closed");
|
||||||
}
|
}
|
||||||
|
mAssistLogger.reportAssistantSessionEvent(
|
||||||
|
AssistantSessionEvent.ASSISTANT_SESSION_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -298,15 +300,19 @@ public class AssistManager {
|
|||||||
if (args == null) {
|
if (args == null) {
|
||||||
args = new Bundle();
|
args = new Bundle();
|
||||||
}
|
}
|
||||||
int invocationType = args.getInt(INVOCATION_TYPE_KEY, 0);
|
int legacyInvocationType = args.getInt(INVOCATION_TYPE_KEY, 0);
|
||||||
if (invocationType == INVOCATION_TYPE_GESTURE) {
|
if (legacyInvocationType == INVOCATION_TYPE_GESTURE) {
|
||||||
mHandleController.onAssistantGesturePerformed();
|
mHandleController.onAssistantGesturePerformed();
|
||||||
}
|
}
|
||||||
int phoneState = mPhoneStateMonitor.getPhoneState();
|
int legacyDeviceState = mPhoneStateMonitor.getPhoneState();
|
||||||
args.putInt(INVOCATION_PHONE_STATE_KEY, phoneState);
|
args.putInt(INVOCATION_PHONE_STATE_KEY, legacyDeviceState);
|
||||||
args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.elapsedRealtime());
|
args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.elapsedRealtime());
|
||||||
logStartAssist(/* instanceId = */ null, invocationType, phoneState);
|
mAssistLogger.reportAssistantInvocationEventFromLegacy(
|
||||||
logStartAssistLegacy(invocationType, phoneState);
|
legacyInvocationType,
|
||||||
|
/* isInvocationComplete = */ true,
|
||||||
|
assistComponent,
|
||||||
|
legacyDeviceState);
|
||||||
|
logStartAssistLegacy(legacyInvocationType, legacyDeviceState);
|
||||||
startAssistInternal(args, assistComponent, isService);
|
startAssistInternal(args, assistComponent, isService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,34 +512,6 @@ public class AssistManager {
|
|||||||
return toLoggingSubType(invocationType, mPhoneStateMonitor.getPhoneState());
|
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) {
|
protected void logStartAssistLegacy(int invocationType, int phoneState) {
|
||||||
MetricsLogger.action(
|
MetricsLogger.action(
|
||||||
new LogMaker(MetricsEvent.ASSISTANT)
|
new LogMaker(MetricsEvent.ASSISTANT)
|
||||||
|
|||||||
@@ -50,15 +50,26 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent
|
|||||||
ASSISTANT_INVOCATION_HOME_LONG_PRESS(447),
|
ASSISTANT_INVOCATION_HOME_LONG_PRESS(447),
|
||||||
|
|
||||||
@UiEvent(doc = "Assistant invoked by physical gesture")
|
@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 {
|
override fun getId(): Int {
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun eventIdFromLegacyInvocationType(legacyInvocationType: Int): Int {
|
fun eventFromLegacyInvocationType(legacyInvocationType: Int, isInvocationComplete: Boolean)
|
||||||
return when (legacyInvocationType) {
|
: AssistantInvocationEvent {
|
||||||
|
return if (isInvocationComplete) {
|
||||||
|
when (legacyInvocationType) {
|
||||||
AssistManager.INVOCATION_TYPE_GESTURE ->
|
AssistManager.INVOCATION_TYPE_GESTURE ->
|
||||||
ASSISTANT_INVOCATION_TOUCH_GESTURE
|
ASSISTANT_INVOCATION_TOUCH_GESTURE
|
||||||
|
|
||||||
@@ -76,7 +87,18 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent
|
|||||||
|
|
||||||
else ->
|
else ->
|
||||||
ASSISTANT_INVOCATION_UNKNOWN
|
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 {
|
fun deviceStateFromLegacyDeviceState(legacyDeviceState: Int): Int {
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,7 +104,7 @@ public final class PhoneStateMonitor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPhoneState() {
|
public int getPhoneState() {
|
||||||
int phoneState;
|
int phoneState;
|
||||||
if (isShadeFullscreen()) {
|
if (isShadeFullscreen()) {
|
||||||
phoneState = getPhoneLockscreenState();
|
phoneState = getPhoneLockscreenState();
|
||||||
|
|||||||
@@ -38,15 +38,21 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|||||||
import com.android.systemui.Dependency;
|
import com.android.systemui.Dependency;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.assist.AssistHandleViewController;
|
import com.android.systemui.assist.AssistHandleViewController;
|
||||||
|
import com.android.systemui.assist.AssistLogger;
|
||||||
import com.android.systemui.assist.AssistManager;
|
import com.android.systemui.assist.AssistManager;
|
||||||
|
import com.android.systemui.assist.AssistantSessionEvent;
|
||||||
import com.android.systemui.statusbar.NavigationBarController;
|
import com.android.systemui.statusbar.NavigationBarController;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default UiController implementation. Shows white edge lights along the bottom of the phone,
|
* Default UiController implementation. Shows white edge lights along the bottom of the phone,
|
||||||
* expanding from the corners to meet in the center.
|
* expanding from the corners to meet in the center.
|
||||||
*/
|
*/
|
||||||
|
@Singleton
|
||||||
public class DefaultUiController implements AssistManager.UiController {
|
public class DefaultUiController implements AssistManager.UiController {
|
||||||
|
|
||||||
private static final String TAG = "DefaultUiController";
|
private static final String TAG = "DefaultUiController";
|
||||||
@@ -58,6 +64,7 @@ public class DefaultUiController implements AssistManager.UiController {
|
|||||||
|
|
||||||
protected final FrameLayout mRoot;
|
protected final FrameLayout mRoot;
|
||||||
protected InvocationLightsView mInvocationLightsView;
|
protected InvocationLightsView mInvocationLightsView;
|
||||||
|
protected final AssistLogger mAssistLogger;
|
||||||
|
|
||||||
private final WindowManager mWindowManager;
|
private final WindowManager mWindowManager;
|
||||||
private final WindowManager.LayoutParams mLayoutParams;
|
private final WindowManager.LayoutParams mLayoutParams;
|
||||||
@@ -69,7 +76,9 @@ public class DefaultUiController implements AssistManager.UiController {
|
|||||||
|
|
||||||
private ValueAnimator mInvocationAnimator = new ValueAnimator();
|
private ValueAnimator mInvocationAnimator = new ValueAnimator();
|
||||||
|
|
||||||
public DefaultUiController(Context context) {
|
@Inject
|
||||||
|
public DefaultUiController(Context context, AssistLogger assistLogger) {
|
||||||
|
mAssistLogger = assistLogger;
|
||||||
mRoot = new FrameLayout(context);
|
mRoot = new FrameLayout(context);
|
||||||
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
|
||||||
@@ -142,6 +151,11 @@ public class DefaultUiController implements AssistManager.UiController {
|
|||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
Log.v(TAG, "Invocation started: type=" + type);
|
Log.v(TAG, "Invocation started: type=" + type);
|
||||||
}
|
}
|
||||||
|
mAssistLogger.reportAssistantInvocationEventFromLegacy(
|
||||||
|
type,
|
||||||
|
/* isInvocationComplete = */ false,
|
||||||
|
/* assistantComponent = */ null,
|
||||||
|
/* legacyDeviceState = */ null);
|
||||||
MetricsLogger.action(new LogMaker(MetricsEvent.ASSISTANT)
|
MetricsLogger.action(new LogMaker(MetricsEvent.ASSISTANT)
|
||||||
.setType(MetricsEvent.TYPE_ACTION)
|
.setType(MetricsEvent.TYPE_ACTION)
|
||||||
.setSubtype(Dependency.get(AssistManager.class).toLoggingSubType(type)));
|
.setSubtype(Dependency.get(AssistManager.class).toLoggingSubType(type)));
|
||||||
@@ -152,6 +166,8 @@ public class DefaultUiController implements AssistManager.UiController {
|
|||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
Log.v(TAG, "Invocation cancelled: type=" + type);
|
Log.v(TAG, "Invocation cancelled: type=" + type);
|
||||||
}
|
}
|
||||||
|
mAssistLogger.reportAssistantSessionEvent(
|
||||||
|
AssistantSessionEvent.ASSISTANT_SESSION_INVOCATION_CANCELLED);
|
||||||
MetricsLogger.action(new LogMaker(MetricsEvent.ASSISTANT)
|
MetricsLogger.action(new LogMaker(MetricsEvent.ASSISTANT)
|
||||||
.setType(MetricsEvent.TYPE_DISMISS)
|
.setType(MetricsEvent.TYPE_DISMISS)
|
||||||
.setSubtype(DISMISS_REASON_INVOCATION_CANCELLED));
|
.setSubtype(DISMISS_REASON_INVOCATION_CANCELLED));
|
||||||
|
|||||||
Reference in New Issue
Block a user