diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2022-06-30 04:44:54 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2022-06-30 04:44:54 -0700 |
commit | 29031f624fb2ec76efe8aafd706544726bc45dda (patch) | |
tree | 90fe93cbc951688418f40b70403abbfd07334369 | |
parent | 0ca5a2d5b398b0eeef260b3e8200505a65e9c83a (diff) | |
parent | 3e62b8a1cf62983bafb8de3bfbf6181422b5689d (diff) |
Merge 3e62b8a1cf62983bafb8de3bfbf6181422b5689d on remote branch
Change-Id: I19cc3f4314460f9c694950affe53adc6c6f63acc
4 files changed, 31 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/apm/CallAudioIntf.java b/src/com/android/bluetooth/apm/CallAudioIntf.java index caa6c9660..6904e2c28 100644 --- a/src/com/android/bluetooth/apm/CallAudioIntf.java +++ b/src/com/android/bluetooth/apm/CallAudioIntf.java @@ -118,6 +118,28 @@ public class CallAudioIntf { return false; } + public boolean autoConnect(BluetoothDevice device) { + if(CallAudio == null) + return false; + + Class[] arg = new Class[1]; + arg[0] = BluetoothDevice.class; + + try { + Method autoConnect = CallAudio.getDeclaredMethod("autoConnect", arg); + Boolean ret = (Boolean)autoConnect.invoke(mCallAudio, device); + return ret; + } catch(IllegalAccessException e) { + Log.i(TAG, "Exception" + e); + } catch(NoSuchMethodException e) { + Log.i(TAG, "Exception" + e); + } catch(InvocationTargetException e) { + Log.i(TAG, "Exception" + e); + } + + return false; + } + public boolean disconnect(BluetoothDevice device) { if(CallAudio == null) return false; diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java index 451f4f415..ac43b9b65 100644 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -1944,6 +1944,7 @@ public class AdapterService extends Service { service, attributionSource, "AdapterService setDiscoverableTimeout")) { return false; } + enforceBluetoothPrivilegedPermission(service); return service.mAdapterProperties.setDiscoverableTimeout(timeout); } diff --git a/src/com/android/bluetooth/btservice/BondStateMachine.java b/src/com/android/bluetooth/btservice/BondStateMachine.java index 927040222..f10d32571 100644 --- a/src/com/android/bluetooth/btservice/BondStateMachine.java +++ b/src/com/android/bluetooth/btservice/BondStateMachine.java @@ -563,7 +563,8 @@ final class BondStateMachine extends StateMachine { } } - if (newState == BluetoothDevice.BOND_BONDED ) { + if ((newState == BluetoothDevice.BOND_BONDED ) + ||(newState == BluetoothDevice.BOND_NONE)){ mAdapterProperties.updateSdpProgress(device, true /* SDP Completed */); } Intent intent = new Intent(BluetoothDevice.ACTION_BOND_STATE_CHANGED); diff --git a/src/com/android/bluetooth/btservice/PhonePolicy.java b/src/com/android/bluetooth/btservice/PhonePolicy.java index 73d40ed4a..c3ee05e1e 100644 --- a/src/com/android/bluetooth/btservice/PhonePolicy.java +++ b/src/com/android/bluetooth/btservice/PhonePolicy.java @@ -733,7 +733,12 @@ class PhonePolicy { int headsetConnectionPolicy = hsService.getConnectionPolicy(device); if (headsetConnectionPolicy == BluetoothProfile.CONNECTION_POLICY_ALLOWED) { debugLog("autoConnectHeadset: Connecting HFP with " + device); - hsService.connect(device); + if(ApmConstIntf.getLeAudioEnabled()) { + CallAudioIntf mCallAudio = CallAudioIntf.get(); + mCallAudio.autoConnect(device); + } else { + hsService.connect(device); + } } else { debugLog("autoConnectHeadset: skipped auto-connect HFP with device " + device + " headsetConnectionPolicy " + headsetConnectionPolicy); |