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

Commit d8ad795f authored by Alex Dadukin's avatar Alex Dadukin
Browse files

Move AudioEventLogger from audio to utils and rename to EventLogger

Bug: b/243116883
Test: atest CtsMediaAudioTestCases
Not-in-Aosp-first: Merge conflict with internal master. Merging manually in internal master first.
Change-Id: I9f3081cfca99935c998dd55d1d8616d0362cbb1e
parent 94cc9d60
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.util.Log;
import android.util.PrintWriterPrinter;

import com.android.internal.annotations.GuardedBy;
import com.android.server.utils.EventLogger;

import java.io.PrintWriter;
import java.util.Arrays;
@@ -343,7 +344,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
        if (AudioService.DEBUG_COMM_RTE) {
            Log.v(TAG, "setCommunicationRouteForClient: device: " + device);
        }
        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                                        "setCommunicationRouteForClient for pid: " + pid
                                        + " device: " + device
                                        + " from API: " + eventSource)).printLog(TAG));
@@ -1229,7 +1230,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
    }

    private void onSendBecomingNoisyIntent() {
        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                "broadcast ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
        mSystemServer.sendDeviceBecomingNoisyIntent();
    }
@@ -1467,7 +1468,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
                case MSG_L_BT_ACTIVE_DEVICE_CHANGE_EXT: {
                    final BtDeviceInfo info = (BtDeviceInfo) msg.obj;
                    if (info.mDevice == null) break;
                    AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
                    AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                            "msg: onBluetoothActiveDeviceChange "
                                    + " state=" + info.mState
                                    // only querying address as this is the only readily available
@@ -1857,7 +1858,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
            Log.v(TAG, "onUpdateCommunicationRoute, preferredCommunicationDevice: "
                    + preferredCommunicationDevice + " eventSource: " + eventSource);
        }
        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                "onUpdateCommunicationRoute, preferredCommunicationDevice: "
                + preferredCommunicationDevice + " eventSource: " + eventSource)));

+14 −13
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.util.Slog;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.utils.EventLogger;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -308,7 +309,7 @@ public class AudioDeviceInventory {
            address = "";
        }

        AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent("BT connected:"
        AudioService.sDeviceLogger.log(new EventLogger.StringEvent("BT connected:"
                        + " addr=" + address
                        + " profile=" + btInfo.mProfile
                        + " state=" + btInfo.mState
@@ -411,13 +412,13 @@ public class AudioDeviceInventory {
        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            address = "";
        }
        AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                "onBluetoothA2dpDeviceConfigChange addr=" + address
                    + " event=" + BtHelper.a2dpDeviceEventToString(event)));

        synchronized (mDevicesLock) {
            if (mDeviceBroker.hasScheduledA2dpConnection(btDevice)) {
                AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                        "A2dp config change ignored (scheduled connection change)")
                        .printLog(TAG));
                mmi.set(MediaMetrics.Property.EARLY_RETURN, "A2dp config change ignored")
@@ -459,7 +460,7 @@ public class AudioDeviceInventory {
                    BtHelper.getName(btDevice), a2dpCodec);

            if (res != AudioSystem.AUDIO_STATUS_OK) {
                AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                        "APM handleDeviceConfigChange failed for A2DP device addr=" + address
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                        .printLog(TAG));
@@ -471,7 +472,7 @@ public class AudioDeviceInventory {
                                BluetoothProfile.A2DP, BluetoothProfile.STATE_DISCONNECTED,
                                musicDevice, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
            } else {
                AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                        "APM handleDeviceConfigChange success for A2DP device addr=" + address
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                        .printLog(TAG));
@@ -618,7 +619,7 @@ public class AudioDeviceInventory {
            @NonNull List<AudioDeviceAttributes> devices) {
        final long identity = Binder.clearCallingIdentity();

        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                                "setPreferredDevicesForStrategySync, strategy: " + strategy
                                + " devices: " + devices)).printLog(TAG));
        final int status = mAudioSystem.setDevicesRoleForStrategy(
@@ -634,7 +635,7 @@ public class AudioDeviceInventory {
    /*package*/ int removePreferredDevicesForStrategySync(int strategy) {
        final long identity = Binder.clearCallingIdentity();

        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                "removePreferredDevicesForStrategySync, strategy: "
                + strategy)).printLog(TAG));

@@ -999,13 +1000,13 @@ public class AudioDeviceInventory {
        // TODO: log in MediaMetrics once distinction between connection failure and
        // double connection is made.
        if (res != AudioSystem.AUDIO_STATUS_OK) {
            AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                    "APM failed to make available A2DP device addr=" + address
                            + " error=" + res).printLog(TAG));
            // TODO: connection failed, stop here
            // TODO: return;
        } else {
            AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                    "A2DP device addr=" + address + " now available").printLog(TAG));
        }

@@ -1046,7 +1047,7 @@ public class AudioDeviceInventory {
        if (!deviceToRemoveKey
                .equals(mApmConnectedDevices.get(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP))) {
            // removing A2DP device not currently used by AudioPolicy, log but don't act on it
            AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
            AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                    "A2DP device " + address + " made unavailable, was not used")).printLog(TAG));
            mmi.set(MediaMetrics.Property.EARLY_RETURN,
                    "A2DP device made unavailable, was not used")
@@ -1061,13 +1062,13 @@ public class AudioDeviceInventory {
                AudioSystem.DEVICE_STATE_UNAVAILABLE, a2dpCodec);

        if (res != AudioSystem.AUDIO_STATUS_OK) {
            AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                    "APM failed to make unavailable A2DP device addr=" + address
                            + " error=" + res).printLog(TAG));
            // TODO:  failed to disconnect, stop here
            // TODO: return;
        } else {
            AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
            AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                    "A2DP device addr=" + address + " made unavailable")).printLog(TAG));
        }
        mApmConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
@@ -1313,7 +1314,7 @@ public class AudioDeviceInventory {
                    && !mDeviceBroker.hasAudioFocusUsers()) {
                // no media playback, not a "becoming noisy" situation, otherwise it could cause
                // the pausing of some apps that are playing remotely
                AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
                AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                        "dropping ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
                mmi.set(MediaMetrics.Property.DELAY_MS, 0).record(); // OK to return
                return 0;
+38 −30
Original line number Diff line number Diff line
@@ -27,9 +27,9 @@ import static android.provider.Settings.Secure.VOLUME_HUSH_MUTE;
import static android.provider.Settings.Secure.VOLUME_HUSH_OFF;
import static android.provider.Settings.Secure.VOLUME_HUSH_VIBRATE;
import static com.android.server.audio.AudioEventLogger.Event.ALOGE;
import static com.android.server.audio.AudioEventLogger.Event.ALOGI;
import static com.android.server.audio.AudioEventLogger.Event.ALOGW;
import static com.android.server.utils.EventLogger.Event.ALOGE;
import static com.android.server.utils.EventLogger.Event.ALOGI;
import static com.android.server.utils.EventLogger.Event.ALOGW;
import android.Manifest;
import android.annotation.IntDef;
@@ -185,6 +185,7 @@ import com.android.server.audio.AudioServiceEvents.VolumeEvent;
import com.android.server.pm.UserManagerInternal;
import com.android.server.pm.UserManagerInternal.UserRestrictionsListener;
import com.android.server.pm.UserManagerService;
import com.android.server.utils.EventLogger;
import com.android.server.wm.ActivityTaskManagerInternal;
import java.io.FileDescriptor;
@@ -989,7 +990,7 @@ public class AudioService extends IAudioService.Stub
    public AudioService(Context context, AudioSystemAdapter audioSystem,
            SystemServerAdapter systemServer, SettingsAdapter settings, @Nullable Looper looper,
            AppOpsManager appOps) {
        sLifecycleLogger.log(new AudioEventLogger.StringEvent("AudioService()"));
        sLifecycleLogger.log(new EventLogger.StringEvent("AudioService()"));
        mContext = context;
        mContentResolver = context.getContentResolver();
        mAppOps = appOps;
@@ -1538,14 +1539,14 @@ public class AudioService extends IAudioService.Stub
        if (!mSystemReady ||
                (AudioSystem.checkAudioFlinger() != AudioSystem.AUDIO_STATUS_OK)) {
            Log.e(TAG, "Audioserver died.");
            sLifecycleLogger.log(new AudioEventLogger.StringEvent(
            sLifecycleLogger.log(new EventLogger.StringEvent(
                    "onAudioServerDied() audioserver died"));
            sendMsg(mAudioHandler, MSG_AUDIO_SERVER_DIED, SENDMSG_NOOP, 0, 0,
                    null, 500);
            return;
        }
        Log.i(TAG, "Audioserver started.");
        sLifecycleLogger.log(new AudioEventLogger.StringEvent(
        sLifecycleLogger.log(new EventLogger.StringEvent(
                "onAudioServerDied() audioserver started"));
        updateAudioHalPids();
@@ -1775,7 +1776,7 @@ public class AudioService extends IAudioService.Stub
        // did it work? check based on status
        if (status != AudioSystem.AUDIO_STATUS_OK) {
            sLifecycleLogger.log(new AudioEventLogger.StringEvent(
            sLifecycleLogger.log(new EventLogger.StringEvent(
                    caller + ": initStreamVolume failed with " + status + " will retry")
                    .printLog(ALOGE, TAG));
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -1789,7 +1790,7 @@ public class AudioService extends IAudioService.Stub
        }
        // success
        sLifecycleLogger.log(new AudioEventLogger.StringEvent(
        sLifecycleLogger.log(new EventLogger.StringEvent(
                caller + ": initStreamVolume succeeded").printLog(ALOGI, TAG));
    }
@@ -1812,7 +1813,7 @@ public class AudioService extends IAudioService.Stub
            }
        }
        if (!success) {
            sLifecycleLogger.log(new AudioEventLogger.StringEvent(
            sLifecycleLogger.log(new EventLogger.StringEvent(
                    caller + ": initStreamVolume succeeded but invalid mix/max levels, will retry")
                    .printLog(ALOGW, TAG));
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -2763,7 +2764,7 @@ public class AudioService extends IAudioService.Stub
                "setPreferredDeviceForStrategy u/pid:%d/%d strat:%d dev:%s",
                Binder.getCallingUid(), Binder.getCallingPid(), strategy,
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
        sDeviceLogger.log(new AudioEventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        if (devices.stream().anyMatch(device ->
                device.getRole() == AudioDeviceAttributes.ROLE_INPUT)) {
            Log.e(TAG, "Unsupported input routing in " + logString);
@@ -2783,7 +2784,7 @@ public class AudioService extends IAudioService.Stub
    public int removePreferredDevicesForStrategy(int strategy) {
        final String logString =
                String.format("removePreferredDeviceForStrategy strat:%d", strategy);
        sDeviceLogger.log(new AudioEventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        final int status = mDeviceBroker.removePreferredDevicesForStrategySync(strategy);
        if (status != AudioSystem.SUCCESS) {
@@ -2849,7 +2850,7 @@ public class AudioService extends IAudioService.Stub
                "setPreferredDevicesForCapturePreset u/pid:%d/%d source:%d dev:%s",
                Binder.getCallingUid(), Binder.getCallingPid(), capturePreset,
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
        sDeviceLogger.log(new AudioEventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        if (devices.stream().anyMatch(device ->
                device.getRole() == AudioDeviceAttributes.ROLE_OUTPUT)) {
            Log.e(TAG, "Unsupported output routing in " + logString);
@@ -2870,7 +2871,7 @@ public class AudioService extends IAudioService.Stub
    public int clearPreferredDevicesForCapturePreset(int capturePreset) {
        final String logString = String.format(
                "removePreferredDeviceForCapturePreset source:%d", capturePreset);
        sDeviceLogger.log(new AudioEventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        final int status = mDeviceBroker.clearPreferredDevicesForCapturePresetSync(capturePreset);
        if (status != AudioSystem.SUCCESS) {
@@ -3771,7 +3772,7 @@ public class AudioService extends IAudioService.Stub
            return;
        }
        final AudioEventLogger.Event event = (device == null)
        final EventLogger.Event event = (device == null)
                ? new VolumeEvent(VolumeEvent.VOL_SET_STREAM_VOL, streamType,
                    index/*val1*/, flags/*val2*/, callingPackage)
                : new DeviceVolumeEvent(streamType, index, device, callingPackage);
@@ -6887,7 +6888,7 @@ public class AudioService extends IAudioService.Stub
        // verify arguments
        Objects.requireNonNull(device);
        AudioManager.enforceValidVolumeBehavior(deviceVolumeBehavior);
        sVolumeLogger.log(new AudioEventLogger.StringEvent("setDeviceVolumeBehavior: dev:"
        sVolumeLogger.log(new EventLogger.StringEvent("setDeviceVolumeBehavior: dev:"
                + AudioSystem.getOutputDeviceName(device.getInternalType()) + " addr:"
                + device.getAddress() + " behavior:"
                + AudioDeviceVolumeManager.volumeBehaviorName(deviceVolumeBehavior)
@@ -6943,7 +6944,7 @@ public class AudioService extends IAudioService.Stub
        }
        // log event and caller
        sDeviceLogger.log(new AudioEventLogger.StringEvent(
        sDeviceLogger.log(new EventLogger.StringEvent(
                "Volume behavior " + deviceVolumeBehavior + " for dev=0x"
                      + Integer.toHexString(audioSystemDeviceOut) + " from:" + caller));
        // make sure we have a volume entry for this device, and that volume is updated according
@@ -7589,7 +7590,7 @@ public class AudioService extends IAudioService.Stub
            final int status = AudioSystem.initStreamVolume(
                    streamType, mIndexMin / 10, mIndexMax / 10);
            if (status != AudioSystem.AUDIO_STATUS_OK) {
                sLifecycleLogger.log(new AudioEventLogger.StringEvent(
                sLifecycleLogger.log(new EventLogger.StringEvent(
                         "VSS() stream:" + streamType + " initStreamVolume=" + status)
                        .printLog(ALOGE, TAG));
                sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -8178,10 +8179,10 @@ public class AudioService extends IAudioService.Stub
            streamState.setIndex(index, update.mDevice, update.mCaller,
                    // trusted as index is always validated before message is posted
                    true /*hasModifyAudioSettings*/);
            sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller + " dev:0x"
            sVolumeLogger.log(new EventLogger.StringEvent(update.mCaller + " dev:0x"
                    + Integer.toHexString(update.mDevice) + " volIdx:" + index));
        } else {
            sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller
            sVolumeLogger.log(new EventLogger.StringEvent(update.mCaller
                    + " update vol on dev:0x" + Integer.toHexString(update.mDevice)));
        }
        setDeviceVolume(streamState, update.mDevice);
@@ -8628,7 +8629,7 @@ public class AudioService extends IAudioService.Stub
    private void avrcpSupportsAbsoluteVolume(String address, boolean support) {
        // address is not used for now, but may be used when multiple a2dp devices are supported
        sVolumeLogger.log(new AudioEventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
        sVolumeLogger.log(new EventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
                + address + " support=" + support).printLog(TAG));
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(support);
        setAvrcpAbsoluteVolumeSupported(support);
@@ -10049,29 +10050,36 @@ public class AudioService extends IAudioService.Stub
    static final int LOG_NB_EVENTS_DYN_POLICY = 10;
    static final int LOG_NB_EVENTS_SPATIAL = 30;
    static final AudioEventLogger sLifecycleLogger = new AudioEventLogger(LOG_NB_EVENTS_LIFECYCLE,
    static final EventLogger
            sLifecycleLogger = new EventLogger(LOG_NB_EVENTS_LIFECYCLE,
            "audio services lifecycle");
    final private AudioEventLogger mModeLogger = new AudioEventLogger(LOG_NB_EVENTS_PHONE_STATE,
    final private EventLogger
            mModeLogger = new EventLogger(LOG_NB_EVENTS_PHONE_STATE,
            "phone state (logged after successful call to AudioSystem.setPhoneState(int, int))");
    // logs for wired + A2DP device connections:
    // - wired: logged before onSetWiredDeviceConnectionState() is executed
    // - A2DP: logged at reception of method call
    /*package*/ static final AudioEventLogger sDeviceLogger = new AudioEventLogger(
    /*package*/ static final EventLogger
            sDeviceLogger = new EventLogger(
            LOG_NB_EVENTS_DEVICE_CONNECTION, "wired/A2DP/hearing aid device connection");
    static final AudioEventLogger sForceUseLogger = new AudioEventLogger(
    static final EventLogger
            sForceUseLogger = new EventLogger(
            LOG_NB_EVENTS_FORCE_USE,
            "force use (logged before setForceUse() is executed)");
    static final AudioEventLogger sVolumeLogger = new AudioEventLogger(LOG_NB_EVENTS_VOLUME,
    static final EventLogger
            sVolumeLogger = new EventLogger(LOG_NB_EVENTS_VOLUME,
            "volume changes (logged when command received by AudioService)");
    static final AudioEventLogger sSpatialLogger = new AudioEventLogger(LOG_NB_EVENTS_SPATIAL,
    static final EventLogger
            sSpatialLogger = new EventLogger(LOG_NB_EVENTS_SPATIAL,
            "spatial audio");
    final private AudioEventLogger mDynPolicyLogger = new AudioEventLogger(LOG_NB_EVENTS_DYN_POLICY,
    final private EventLogger
            mDynPolicyLogger = new EventLogger(LOG_NB_EVENTS_DYN_POLICY,
            "dynamic policy events (logged when command received by AudioService)");
    private static final String[] RINGER_MODE_NAMES = new String[] {
@@ -10656,7 +10664,7 @@ public class AudioService extends IAudioService.Stub
                pcb.asBinder().linkToDeath(app, 0/*flags*/);
                // logging after registration so we have the registration id
                mDynPolicyLogger.log((new AudioEventLogger.StringEvent("registerAudioPolicy for "
                mDynPolicyLogger.log((new EventLogger.StringEvent("registerAudioPolicy for "
                        + pcb.asBinder() + " u/pid:" + Binder.getCallingUid() + "/"
                        + Binder.getCallingPid() + " with config:" + app.toCompactLogString()))
                        .printLog(TAG));
@@ -10854,7 +10862,7 @@ public class AudioService extends IAudioService.Stub
    private void unregisterAudioPolicyInt(@NonNull IAudioPolicyCallback pcb, String operationName) {
        mDynPolicyLogger.log((new AudioEventLogger.StringEvent(operationName + " for "
        mDynPolicyLogger.log((new EventLogger.StringEvent(operationName + " for "
                + pcb.asBinder()).printLog(TAG)));
        synchronized (mAudioPolicies) {
            AudioPolicyProxy app = mAudioPolicies.remove(pcb.asBinder());
@@ -11382,7 +11390,7 @@ public class AudioService extends IAudioService.Stub
        }
        public void binderDied() {
            mDynPolicyLogger.log((new AudioEventLogger.StringEvent("AudioPolicy "
            mDynPolicyLogger.log((new EventLogger.StringEvent("AudioPolicy "
                    + mPolicyCallback.asBinder() + " died").printLog(TAG)));
            release();
        }
+6 −5
Original line number Diff line number Diff line
@@ -24,11 +24,12 @@ import android.media.AudioSystem;
import android.media.MediaMetrics;

import com.android.server.audio.AudioDeviceInventory.WiredDeviceConnectionState;
import com.android.server.utils.EventLogger;


public class AudioServiceEvents {

    final static class PhoneStateEvent extends AudioEventLogger.Event {
    final static class PhoneStateEvent extends EventLogger.Event {
        static final int MODE_SET = 0;
        static final int MODE_IN_COMMUNICATION_TIMEOUT = 1;

@@ -108,7 +109,7 @@ public class AudioServiceEvents {
        }
    }

    final static class WiredDevConnectEvent extends AudioEventLogger.Event {
    final static class WiredDevConnectEvent extends EventLogger.Event {
        final WiredDeviceConnectionState mState;

        WiredDevConnectEvent(WiredDeviceConnectionState state) {
@@ -127,7 +128,7 @@ public class AudioServiceEvents {
        }
    }

    final static class ForceUseEvent extends AudioEventLogger.Event {
    final static class ForceUseEvent extends EventLogger.Event {
        final int mUsage;
        final int mConfig;
        final String mReason;
@@ -147,7 +148,7 @@ public class AudioServiceEvents {
        }
    }

    static final class DeviceVolumeEvent extends AudioEventLogger.Event {
    static final class DeviceVolumeEvent extends EventLogger.Event {
        final int mStream;
        final int mVolIndex;
        final String mDeviceNativeType;
@@ -184,7 +185,7 @@ public class AudioServiceEvents {
        }
    }

    final static class VolumeEvent extends AudioEventLogger.Event {
    final static class VolumeEvent extends EventLogger.Event {
        static final int VOL_ADJUST_SUGG_VOL = 0;
        static final int VOL_ADJUST_STREAM_VOL = 1;
        static final int VOL_SET_STREAM_VOL = 2;
+6 −5
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.text.TextUtils;
import android.util.Log;

import com.android.internal.annotations.GuardedBy;
import com.android.server.utils.EventLogger;

import java.io.PrintWriter;
import java.util.Collections;
@@ -262,13 +263,13 @@ public class BtHelper {
    /*package*/ synchronized void setAvrcpAbsoluteVolumeIndex(int index) {
        if (mA2dp == null) {
            if (AudioService.DEBUG_VOL) {
                AudioService.sVolumeLogger.log(new AudioEventLogger.StringEvent(
                AudioService.sVolumeLogger.log(new EventLogger.StringEvent(
                        "setAvrcpAbsoluteVolumeIndex: bailing due to null mA2dp").printLog(TAG));
                return;
            }
        }
        if (!mAvrcpAbsVolSupported) {
            AudioService.sVolumeLogger.log(new AudioEventLogger.StringEvent(
            AudioService.sVolumeLogger.log(new EventLogger.StringEvent(
                    "setAvrcpAbsoluteVolumeIndex: abs vol not supported ").printLog(TAG));
            return;
        }
@@ -392,14 +393,14 @@ public class BtHelper {
    @GuardedBy("AudioDeviceBroker.mDeviceStateLock")
    /*package*/ synchronized boolean startBluetoothSco(int scoAudioMode,
                @NonNull String eventSource) {
        AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(eventSource));
        AudioService.sDeviceLogger.log(new EventLogger.StringEvent(eventSource));
        return requestScoState(BluetoothHeadset.STATE_AUDIO_CONNECTED, scoAudioMode);
    }

    // @GuardedBy("AudioDeviceBroker.mSetModeLock")
    @GuardedBy("AudioDeviceBroker.mDeviceStateLock")
    /*package*/ synchronized boolean stopBluetoothSco(@NonNull String eventSource) {
        AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(eventSource));
        AudioService.sDeviceLogger.log(new EventLogger.StringEvent(eventSource));
        return requestScoState(BluetoothHeadset.STATE_AUDIO_DISCONNECTED, SCO_MODE_VIRTUAL_CALL);
    }

@@ -674,7 +675,7 @@ public class BtHelper {
                        case BluetoothProfile.HEADSET:
                        case BluetoothProfile.HEARING_AID:
                        case BluetoothProfile.LE_AUDIO:
                            AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
                            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                                    "BT profile service: connecting "
                                    + BluetoothProfile.getProfileName(profile) + " profile"));
                            mDeviceBroker.postBtProfileConnected(profile, proxy);
Loading