summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNSS_WLAN Service <cnssbldsw@qualcomm.com>2022-06-07 10:15:19 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2022-06-07 10:15:19 -0700
commit3e62b8a1cf62983bafb8de3bfbf6181422b5689d (patch)
tree90fe93cbc951688418f40b70403abbfd07334369
parentcbf1e819bfe3e3855b7de2467339f52f06c376cb (diff)
parent23bde9f0d28724807efd4534d13d9a23f5c47854 (diff)
Merge "Btservice/PhonePolicy: AutoConnect enablement in HeadsetService. Apm/CallAudioIntf: AutoConnect Reflection Function." into bt-sys.lnx.12.0
-rw-r--r--src/com/android/bluetooth/apm/CallAudioIntf.java22
-rw-r--r--src/com/android/bluetooth/btservice/PhonePolicy.java7
2 files changed, 28 insertions, 1 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/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);