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

Commit ed43bd33 authored by Shunkai Yao's avatar Shunkai Yao Committed by Eric Laurent
Browse files

Add device logger for active device and action state change

Bug: 290209153
Test: dumpsys audio with BT enable/disable
Change-Id: I9cd67bfb70fb1babb6975ab8ec84209992da4e24
Merged-In: I9cd67bfb70fb1babb6975ab8ec84209992da4e24
(cherry picked from commit 484fac0f)
parent 46f4a005
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -7591,6 +7591,10 @@ public class AudioService extends IAudioService.Stub
            throw new IllegalArgumentException("Illegal BluetoothProfile profile for device "
                    + previousDevice + " -> " + newDevice + ". Got: " + profile);
        }
        sDeviceLogger.enqueue(new EventLogger.StringEvent("BlutoothActiveDeviceChanged for "
                + BluetoothProfile.getProfileName(profile) + ", device update " + previousDevice
                + " -> " + newDevice));
        AudioDeviceBroker.BtDeviceChangedData data =
                new AudioDeviceBroker.BtDeviceChangedData(newDevice, previousDevice, info,
                        "AudioService");
@@ -9636,6 +9640,9 @@ public class AudioService extends IAudioService.Stub
                }
            } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
                state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
                sDeviceLogger.enqueue(new EventLogger.StringEvent(
                        "BluetoothAdapter ACTION_STATE_CHANGED with state " + state));
                if (state == BluetoothAdapter.STATE_OFF ||
                        state == BluetoothAdapter.STATE_TURNING_OFF) {
                    mDeviceBroker.disconnectAllBluetoothProfiles();
+5 −0
Original line number Diff line number Diff line
@@ -459,6 +459,8 @@ public class BtHelper {

    //@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
    /*package*/ synchronized void onBtProfileDisconnected(int profile) {
        AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                "BT profile " + BluetoothProfile.getProfileName(profile) + " disconnected"));
        switch (profile) {
            case BluetoothProfile.A2DP:
                mA2dp = null;
@@ -487,6 +489,9 @@ public class BtHelper {

    @GuardedBy("AudioDeviceBroker.mDeviceStateLock")
    /*package*/ synchronized void onBtProfileConnected(int profile, BluetoothProfile proxy) {
        AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                "BT profile " + BluetoothProfile.getProfileName(profile) + " connected to proxy "
                + proxy));
        if (profile == BluetoothProfile.HEADSET) {
            onHeadsetProfileConnected((BluetoothHeadset) proxy);
            return;