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

Commit 02d8eb4b authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioService: do not mute music systematically in setBluetoothA2dpOn" into main

parents e2d3dbdb e63e133e
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -274,8 +274,11 @@ public class AudioDeviceBroker {
    }
    }


    /*package*/ void setBluetoothA2dpOn_Async(boolean on, String source) {
    /*package*/ void setBluetoothA2dpOn_Async(boolean on, String source) {
        mBluetoothA2dpEnabled.set(on);
        boolean wasOn = mBluetoothA2dpEnabled.getAndSet(on);
        sendLMsgNoDelay(MSG_L_SET_FORCE_BT_A2DP_USE, SENDMSG_REPLACE, source);
        // do not mute music if we do not anticipate a change in A2DP ON state
        sendLMsgNoDelay(wasOn == on
                ? MSG_L_SET_FORCE_BT_A2DP_USE_NO_MUTE : MSG_L_SET_FORCE_BT_A2DP_USE,
                SENDMSG_REPLACE, source);
    }
    }


    /**
    /**
@@ -1803,6 +1806,7 @@ public class AudioDeviceBroker {
                    onSetForceUse(msg.arg1, msg.arg2, false, (String) msg.obj);
                    onSetForceUse(msg.arg1, msg.arg2, false, (String) msg.obj);
                    break;
                    break;
                case MSG_L_SET_FORCE_BT_A2DP_USE:
                case MSG_L_SET_FORCE_BT_A2DP_USE:
                case MSG_L_SET_FORCE_BT_A2DP_USE_NO_MUTE:
                    int forcedUsage = mBluetoothA2dpEnabled.get()
                    int forcedUsage = mBluetoothA2dpEnabled.get()
                            ? AudioSystem.FORCE_NONE : AudioSystem.FORCE_NO_BT_A2DP;
                            ? AudioSystem.FORCE_NONE : AudioSystem.FORCE_NO_BT_A2DP;
                    onSetForceUse(AudioSystem.FOR_MEDIA, forcedUsage, true, (String) msg.obj);
                    onSetForceUse(AudioSystem.FOR_MEDIA, forcedUsage, true, (String) msg.obj);
@@ -2139,8 +2143,7 @@ public class AudioDeviceBroker {
    private static final int MSG_I_UPDATE_LE_AUDIO_GROUP_ADDRESSES = 57;
    private static final int MSG_I_UPDATE_LE_AUDIO_GROUP_ADDRESSES = 57;
    private static final int MSG_L_SYNCHRONIZE_ADI_DEVICES_IN_INVENTORY = 58;
    private static final int MSG_L_SYNCHRONIZE_ADI_DEVICES_IN_INVENTORY = 58;
    private static final int MSG_IL_UPDATED_ADI_DEVICE_STATE = 59;
    private static final int MSG_IL_UPDATED_ADI_DEVICE_STATE = 59;

    private static final int MSG_L_SET_FORCE_BT_A2DP_USE_NO_MUTE = 60;



    private static boolean isMessageHandledUnderWakelock(int msgId) {
    private static boolean isMessageHandledUnderWakelock(int msgId) {
        switch(msgId) {
        switch(msgId) {