Loading src/com/android/server/telecom/BluetoothHeadsetProxy.java +9 −2 Original line number Diff line number Diff line Loading @@ -60,11 +60,18 @@ public class BluetoothHeadsetProxy { return mBluetoothHeadset.isAudioConnected(device); } public boolean connectAudio(String deviceAddress) { // TODO: update once the BT stack has this api. public boolean connectAudio() { return mBluetoothHeadset.connectAudio(); } public boolean setActiveDevice(BluetoothDevice device) { return mBluetoothHeadset.setActiveDevice(device); } public boolean isAudioOn() { return mBluetoothHeadset.isAudioOn(); } public boolean disconnectAudio() { return mBluetoothHeadset.disconnectAudio(); } Loading src/com/android/server/telecom/CallAudioRouteStateMachine.java +2 −0 Original line number Diff line number Diff line Loading @@ -778,6 +778,8 @@ public class CallAudioRouteStateMachine extends StateMachine { // Send ringer mode change because we transit to ActiveBluetoothState even // when HFP is connecting mCallAudioManager.onRingerModeChange(); // Update the in-call app on the new active BT device in case that changed. updateSystemAudioState(); return HANDLED; case SWITCH_BLUETOOTH: case USER_SWITCH_BLUETOOTH: Loading src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ public class BluetoothDeviceManager { mBluetoothHeadsetService = bluetoothHeadset; } public BluetoothDevice getDeviceFromAddress(String address) { return mConnectedDevicesByAddress.get(address); } void onDeviceConnected(BluetoothDevice device) { synchronized (mLock) { if (!mConnectedDevicesByAddress.containsKey(device.getAddress())) { Loading src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java +14 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,7 @@ package com.android.server.telecom.bluetooth; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Message; import android.telecom.Log; import android.telecom.Logging.Session; Loading Loading @@ -712,7 +708,20 @@ public class BluetoothRouteManager extends StateMachine { Log.w(this, "Trying to connect audio but no headset service exists."); return false; } return bluetoothHeadset.connectAudio(address); BluetoothDevice device = mDeviceManager.getDeviceFromAddress(address); if (device == null) { Log.w(this, "Attempting to turn on audio for a disconnected device"); return false; } boolean success = bluetoothHeadset.setActiveDevice(device); if (!success) { Log.w(LOG_TAG, "Couldn't set active device to %s", address); return false; } if (!bluetoothHeadset.isAudioOn()) { return bluetoothHeadset.connectAudio(); } return true; } private void disconnectAudio() { Loading testapps/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ android:minSdkVersion="23" android:targetSdkVersion="23" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" /> Loading Loading
src/com/android/server/telecom/BluetoothHeadsetProxy.java +9 −2 Original line number Diff line number Diff line Loading @@ -60,11 +60,18 @@ public class BluetoothHeadsetProxy { return mBluetoothHeadset.isAudioConnected(device); } public boolean connectAudio(String deviceAddress) { // TODO: update once the BT stack has this api. public boolean connectAudio() { return mBluetoothHeadset.connectAudio(); } public boolean setActiveDevice(BluetoothDevice device) { return mBluetoothHeadset.setActiveDevice(device); } public boolean isAudioOn() { return mBluetoothHeadset.isAudioOn(); } public boolean disconnectAudio() { return mBluetoothHeadset.disconnectAudio(); } Loading
src/com/android/server/telecom/CallAudioRouteStateMachine.java +2 −0 Original line number Diff line number Diff line Loading @@ -778,6 +778,8 @@ public class CallAudioRouteStateMachine extends StateMachine { // Send ringer mode change because we transit to ActiveBluetoothState even // when HFP is connecting mCallAudioManager.onRingerModeChange(); // Update the in-call app on the new active BT device in case that changed. updateSystemAudioState(); return HANDLED; case SWITCH_BLUETOOTH: case USER_SWITCH_BLUETOOTH: Loading
src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ public class BluetoothDeviceManager { mBluetoothHeadsetService = bluetoothHeadset; } public BluetoothDevice getDeviceFromAddress(String address) { return mConnectedDevicesByAddress.get(address); } void onDeviceConnected(BluetoothDevice device) { synchronized (mLock) { if (!mConnectedDevicesByAddress.containsKey(device.getAddress())) { Loading
src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java +14 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,7 @@ package com.android.server.telecom.bluetooth; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Message; import android.telecom.Log; import android.telecom.Logging.Session; Loading Loading @@ -712,7 +708,20 @@ public class BluetoothRouteManager extends StateMachine { Log.w(this, "Trying to connect audio but no headset service exists."); return false; } return bluetoothHeadset.connectAudio(address); BluetoothDevice device = mDeviceManager.getDeviceFromAddress(address); if (device == null) { Log.w(this, "Attempting to turn on audio for a disconnected device"); return false; } boolean success = bluetoothHeadset.setActiveDevice(device); if (!success) { Log.w(LOG_TAG, "Couldn't set active device to %s", address); return false; } if (!bluetoothHeadset.isAudioOn()) { return bluetoothHeadset.connectAudio(); } return true; } private void disconnectAudio() { Loading
testapps/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ android:minSdkVersion="23" android:targetSdkVersion="23" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" /> Loading