Merge change 21985 into eclair
* changes: Fix AudioService on HFP power off due to new Bluetooth API.
This commit is contained in:
@@ -1391,21 +1391,26 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
} else if (action.equals(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION)) {
|
} else if (action.equals(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION)) {
|
||||||
int state = intent.getIntExtra(BluetoothIntent.HEADSET_STATE,
|
int state = intent.getIntExtra(BluetoothIntent.HEADSET_STATE,
|
||||||
BluetoothHeadset.STATE_ERROR);
|
BluetoothHeadset.STATE_ERROR);
|
||||||
BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothIntent.DEVICE);
|
|
||||||
String address = btDevice.getAddress();
|
|
||||||
int device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO;
|
int device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO;
|
||||||
int btClass = btDevice.getBluetoothClass();
|
BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothIntent.DEVICE);
|
||||||
if (BluetoothClass.Device.Major.getDeviceMajor(btClass) == BluetoothClass.Device.Major.AUDIO_VIDEO) {
|
String address = null;
|
||||||
switch (BluetoothClass.Device.getDevice(btClass)) {
|
int btClass = BluetoothClass.ERROR;
|
||||||
case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET:
|
if (btDevice != null) {
|
||||||
case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE:
|
address = btDevice.getAddress();
|
||||||
device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
|
btClass = btDevice.getBluetoothClass();
|
||||||
break;
|
if (BluetoothClass.Device.Major.getDeviceMajor(btClass) ==
|
||||||
case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO:
|
BluetoothClass.Device.Major.AUDIO_VIDEO) {
|
||||||
device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
|
switch (BluetoothClass.Device.getDevice(btClass)) {
|
||||||
break;
|
case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET:
|
||||||
default:
|
case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE:
|
||||||
break;
|
device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
|
||||||
|
break;
|
||||||
|
case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO:
|
||||||
|
device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user