DO NOT MERGE: Downbranch merge conflict [Output Switcher] Log new events

Test: N/A
Bug: 223486955
Change-Id: I3157aec71e70032d4dd3a1ac063ee6cb5d7d921f
This commit is contained in:
shaoweishen
2022-05-11 08:53:03 +00:00
committed by Shaowei Shen
parent 045ab2fc57
commit d7be851eba
2 changed files with 67 additions and 0 deletions

View File

@@ -573,6 +573,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
}
boolean addDeviceToPlayMedia(MediaDevice device) {
mMetricLogger.logInteractionExpansion(device);
return mLocalMediaManager.addDeviceToPlayMedia(device);
}
@@ -613,6 +614,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
}
void releaseSession() {
mMetricLogger.logInteractionStopCasting();
mLocalMediaManager.releaseSession();
}
@@ -627,6 +629,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
}
void adjustVolume(MediaDevice device, int volume) {
mMetricLogger.logInteractionAdjustVolume(device);
ThreadUtils.postOnBackgroundThread(() -> {
device.requestSetVolume(volume);
});

View File

@@ -95,6 +95,49 @@ public class MediaOutputMetricLogger {
mAppliedDeviceCountWithinRemoteGroup);
}
/**
* Do the metric logging of volume adjustment.
* @param source the device been adjusted
*/
public void logInteractionAdjustVolume(MediaDevice source) {
if (DEBUG) {
Log.d(TAG, "logInteraction - AdjustVolume");
}
SysUiStatsLog.write(
SysUiStatsLog.MEDIAOUTPUT_OP_INTERACTION_REPORT,
SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__INTERACTION_TYPE__ADJUST_VOLUME,
getInteractionDeviceType(source));
}
/**
* Do the metric logging of stop casting.
*/
public void logInteractionStopCasting() {
if (DEBUG) {
Log.d(TAG, "logInteraction - Stop casting");
}
SysUiStatsLog.write(
SysUiStatsLog.MEDIAOUTPUT_OP_INTERACTION_REPORT,
SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__INTERACTION_TYPE__STOP_CASTING,
SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__UNKNOWN_TYPE);
}
/**
* Do the metric logging of device expansion.
*/
public void logInteractionExpansion(MediaDevice source) {
if (DEBUG) {
Log.d(TAG, "logInteraction - Expansion");
}
SysUiStatsLog.write(
SysUiStatsLog.MEDIAOUTPUT_OP_INTERACTION_REPORT,
SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__INTERACTION_TYPE__EXPANSION,
getInteractionDeviceType(source));
}
/**
* Do the metric logging of content switching failure.
* @param deviceList media device list for device count updating
@@ -185,6 +228,27 @@ public class MediaOutputMetricLogger {
}
}
private int getInteractionDeviceType(MediaDevice device) {
switch (device.getDeviceType()) {
case MediaDevice.MediaDeviceType.TYPE_PHONE_DEVICE:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__BUILTIN_SPEAKER;
case MediaDevice.MediaDeviceType.TYPE_3POINT5_MM_AUDIO_DEVICE:
return SysUiStatsLog
.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__WIRED_3POINT5_MM_AUDIO;
case MediaDevice.MediaDeviceType.TYPE_USB_C_AUDIO_DEVICE:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__USB_C_AUDIO;
case MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__BLUETOOTH;
case MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__REMOTE_SINGLE;
case MediaDevice.MediaDeviceType.TYPE_CAST_GROUP_DEVICE:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__REMOTE_GROUP;
default:
return SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__UNKNOWN_TYPE;
}
}
private int getLoggingSwitchOpSubResult(int reason) {
switch (reason) {
case REASON_REJECTED: