Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 532dd036 authored by Yiyi Shen's avatar Yiyi Shen
Browse files

[OutputSwitcher] Add metrics for PAS integration

Test: atest
Bug: 385672684
Flag: com.android.media.flags.enable_output_switcher_personal_audio_sharing
Change-Id: I5030044074e41d13b46ff570588954029c4f2185
parent 44fba6c5
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -121,6 +121,22 @@ public class MediaOutputMetricLogger {
                source.isSuggestedDevice());
    }

    /**
     * Do the metric logging of stop sharing.
     */
    public void logInteractionStopSharing() {
        if (DEBUG) {
            Log.d(TAG, "logInteraction - Stop sharing");
        }

        SysUiStatsLog.write(
                SysUiStatsLog.MEDIAOUTPUT_OP_INTERACTION_REPORT,
                SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__INTERACTION_TYPE__STOP_SHARING,
                SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__TARGET__UNKNOWN_TYPE,
                getLoggingPackageName(),
                /*isSuggestedDevice = */false);
    }

    /**
     * Do the metric logging of stop casting.
     */
@@ -153,6 +169,22 @@ public class MediaOutputMetricLogger {
                source.isSuggestedDevice());
    }

    /**
     * Do the metric logging of device contraction.
     */
    public void logInteractionContraction(MediaDevice source) {
        if (DEBUG) {
            Log.d(TAG, "logInteraction - Contraction");
        }

        SysUiStatsLog.write(
                SysUiStatsLog.MEDIAOUTPUT_OP_INTERACTION_REPORT,
                SysUiStatsLog.MEDIA_OUTPUT_OP_INTERACTION_REPORTED__INTERACTION_TYPE__CONTRACTION,
                getInteractionDeviceType(source),
                getLoggingPackageName(),
                source.isSuggestedDevice());
    }

    /**
     * Do the metric logging of muting device.
     */
+7 −1
Original line number Diff line number Diff line
@@ -790,6 +790,7 @@ public class MediaSwitchingController
    }

    boolean removeDeviceFromPlayMedia(MediaDevice device) {
        mMetricLogger.logInteractionContraction(device);
        return mLocalMediaManager.removeDeviceFromPlayMedia(device);
    }

@@ -843,7 +844,12 @@ public class MediaSwitchingController
    }

    void releaseSession() {
        if (Flags.enableOutputSwitcherPersonalAudioSharing()
                && getSessionReleaseType() == RoutingSessionInfo.RELEASE_TYPE_SHARING) {
            mMetricLogger.logInteractionStopSharing();
        } else {
            mMetricLogger.logInteractionStopCasting();
        }
        mLocalMediaManager.releaseSession();
    }