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

Commit eb5ffc23 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Id8e98194 into eclair

* changes:
  Fix issues 2333450 and 2333559:
parents e3449553 eb14a783
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -282,7 +282,8 @@ public:
        FORCE_BT_SCO,
        FORCE_BT_A2DP,
        FORCE_WIRED_ACCESSORY,
        FORCE_BT_DOCK,
        FORCE_BT_CAR_DOCK,
        FORCE_BT_DESK_DOCK,
        NUM_FORCE_CONFIG,
        FORCE_DEFAULT = FORCE_NONE
    };
+20 −3
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class AudioService extends IAudioService.Stub {
    private boolean mMediaServerOk;

    /** cached value of the BT dock address to recognize undocking events */
    private static String sBtDockAddress;
    private static String sBtDockAddress = "";

    private SoundPool mSoundPool;
    private Object mSoundEffectsLock = new Object();
@@ -231,6 +231,7 @@ public class AudioService extends IAudioService.Stub {
    // Forced device usage for communications
    private int mForcedUseForComm;


    ///////////////////////////////////////////////////////////////////////////
    // Construction
    ///////////////////////////////////////////////////////////////////////////
@@ -1414,9 +1415,25 @@ public class AudioService extends IAudioService.Stub {
                             (state == BluetoothA2dp.STATE_CONNECTED ||
                              state == BluetoothA2dp.STATE_PLAYING)) {
                    if (btDevice.isBluetoothDock()) {
                        Log.v(TAG, "Recognized docking to BT dock");
                        Log.v(TAG, "Recognized connection to BT dock");
                        sBtDockAddress = address;
                        AudioSystem.setForceUse(AudioSystem.FOR_DOCK, AudioSystem.FORCE_BT_DOCK);
                        Intent i = context.registerReceiver(null, new IntentFilter(Intent.ACTION_DOCK_EVENT));
                        if (i != null) {
                            int dockState = i.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED);
                            int config;
                            switch (dockState) {
                                case Intent.EXTRA_DOCK_STATE_DESK:
                                    config = AudioSystem.FORCE_BT_DESK_DOCK;
                                    break;
                                case Intent.EXTRA_DOCK_STATE_CAR:
                                    config = AudioSystem.FORCE_BT_CAR_DOCK;
                                    break;
                                case Intent.EXTRA_DOCK_STATE_UNDOCKED:
                                default:
                                    config = AudioSystem.FORCE_NONE;
                            }
                            AudioSystem.setForceUse(AudioSystem.FOR_DOCK, config);
                        }
                    }
                    AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
                                                         AudioSystem.DEVICE_STATE_AVAILABLE,
+2 −1
Original line number Diff line number Diff line
@@ -271,7 +271,8 @@ public class AudioSystem
    public static final int FORCE_BT_SCO = 3;
    public static final int FORCE_BT_A2DP = 4;
    public static final int FORCE_WIRED_ACCESSORY = 5;
    public static final int FORCE_BT_DOCK = 6;
    public static final int FORCE_BT_CAR_DOCK = 6;
    public static final int FORCE_BT_DESK_DOCK = 7;
    public static final int FORCE_DEFAULT = FORCE_NONE;

    // usage for serForceUse