diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2022-02-28 01:04:12 -0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2022-02-28 01:04:12 -0800 |
commit | eca69592755cd9d5714fa77ffca25e2a37a7334f (patch) | |
tree | 94eeb1a855681600a23f7d4c2da76419b44a9476 | |
parent | c26c0618c4b3dc703a26f1f49aa0b6f1c4040565 (diff) | |
parent | 764ab48c0858414bcfc2d34e9847624adcae8228 (diff) |
Merge 764ab48c0858414bcfc2d34e9847624adcae8228 on remote branch
Change-Id: I6eb6aae9ff05453b3651377d81f598b6a164a85c
4 files changed, 21 insertions, 14 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java index ce3cc911a..41c13e692 100644 --- a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java +++ b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java @@ -247,7 +247,7 @@ final class A2dpStateMachine extends StateMachine { Log.i(TAG, "Incoming A2DP Connecting request accepted: " + mDevice); transitionTo(mConnecting); MediaAudioIntf mMediaAudio = MediaAudioIntf.get(); - mMediaAudio.connect(mDevice); + mMediaAudio.autoConnect(mDevice); } else { // Reject the connection and stay in Disconnected state itself Log.w(TAG, "Incoming A2DP Connecting request rejected: " + mDevice); @@ -260,7 +260,7 @@ final class A2dpStateMachine extends StateMachine { Log.i(TAG, "Incoming A2DP Connected request accepted: " + mDevice); transitionTo(mConnected); MediaAudioIntf mMediaAudio = MediaAudioIntf.get(); - mMediaAudio.connect(mDevice); + mMediaAudio.autoConnect(mDevice); } else { // Reject the connection and stay in Disconnected state itself Log.w(TAG, "Incoming A2DP Connected request rejected: " + mDevice); @@ -457,7 +457,7 @@ final class A2dpStateMachine extends StateMachine { Log.w(TAG, "Disconnecting interrupted: device is connected: " + mDevice); transitionTo(mConnected); MediaAudioIntf mMediaAudio = MediaAudioIntf.get(); - mMediaAudio.connect(mDevice); + mMediaAudio.autoConnect(mDevice); } else { // Reject the connection and stay in Disconnecting state Log.w(TAG, "Incoming A2DP Connected request rejected: " + mDevice); @@ -469,7 +469,7 @@ final class A2dpStateMachine extends StateMachine { Log.i(TAG, "Disconnecting interrupted: try to reconnect: " + mDevice); transitionTo(mConnecting); MediaAudioIntf mMediaAudio = MediaAudioIntf.get(); - mMediaAudio.connect(mDevice); + mMediaAudio.autoConnect(mDevice); } else { // Reject the connection and stay in Disconnecting state Log.w(TAG, "Incoming A2DP Connecting request rejected: " + mDevice); diff --git a/src/com/android/bluetooth/btservice/PhonePolicy.java b/src/com/android/bluetooth/btservice/PhonePolicy.java index c461d4aef..d9b2a6eff 100644 --- a/src/com/android/bluetooth/btservice/PhonePolicy.java +++ b/src/com/android/bluetooth/btservice/PhonePolicy.java @@ -41,6 +41,7 @@ import com.android.bluetooth.a2dp.A2dpService; import com.android.bluetooth.a2dpsink.A2dpSinkService; import com.android.bluetooth.apm.ApmConstIntf; import com.android.bluetooth.apm.MediaAudioIntf; +import com.android.bluetooth.apm.CallAudioIntf; import com.android.bluetooth.btservice.InteropUtil; import com.android.bluetooth.btservice.storage.DatabaseManager; import com.android.bluetooth.hearingaid.HearingAidService; @@ -932,7 +933,12 @@ class PhonePolicy { (hsService.getConnectionPolicy(device) >= BluetoothProfile.CONNECTION_POLICY_ALLOWED)) { debugLog("Retrying connection to HS with device " + device); mHeadsetRetrySet.add(device); - hsService.connect(device); + if (ApmConstIntf.getLeAudioEnabled()) { + CallAudioIntf mCallAudio = CallAudioIntf.get(); + mCallAudio.connect(device); + } else { + hsService.connect(device); + } } else { debugLog("do not initiate connect as A2dp is not connected"); } @@ -962,8 +968,12 @@ class PhonePolicy { (a2dpService.getConnectionPolicy(device) >= BluetoothProfile.CONNECTION_POLICY_ALLOWED)) { debugLog("Retrying connection to A2DP with device " + device); mA2dpRetrySet.add(device); - a2dpService.connect(device); - } else { + if (ApmConstIntf.getLeAudioEnabled()) { + MediaAudioIntf mMediaAudio = MediaAudioIntf.get(); + mMediaAudio.connect(device); + } else { + a2dpService.connect(device); + } debugLog("do not initiate connect as HFP is not connected"); } } diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java index 76f54dc2b..6131bdd93 100644 --- a/src/com/android/bluetooth/gatt/GattService.java +++ b/src/com/android/bluetooth/gatt/GattService.java @@ -1317,10 +1317,7 @@ public class GattService extends ProfileService { if (!hasPermission && client.callingPackage != null && client.callingPackage.equals("com.android.bluetooth")) { - if (client.filters.size() == 1 && - client.filters.get(0).getGroupFilteringValue()) { - hasPermission = true; - } + hasPermission = true; } if (!hasPermission || !matchesFilters(client, result)) { diff --git a/src/com/android/bluetooth/hfp/HeadsetService.java b/src/com/android/bluetooth/hfp/HeadsetService.java index 528c6895a..177a0c955 100644 --- a/src/com/android/bluetooth/hfp/HeadsetService.java +++ b/src/com/android/bluetooth/hfp/HeadsetService.java @@ -2515,13 +2515,13 @@ public class HeadsetService extends ProfileService { if(availableDevices.size() > 0) { Log.i(TAG, "Update the phoneStateChanged status to connecting and " + "connected devices"); - doForEachConnectedConnectingStateMachine( - stateMachine -> stateMachine.sendMessage(HeadsetStateMachine.CALL_STATE_CHANGED, - new HeadsetCallState(numActive, numHeld, callState, number, type, name))); mStateMachinesThread.getThreadHandler().post(() -> { mSystemInterface.getHeadsetPhoneState().setNumActiveCall(numActive); mSystemInterface.getHeadsetPhoneState().setNumHeldCall(numHeld); mSystemInterface.getHeadsetPhoneState().setCallState(callState); + doForEachConnectedConnectingStateMachine( + stateMachine -> stateMachine.sendMessage(HeadsetStateMachine.CALL_STATE_CHANGED, + new HeadsetCallState(numActive, numHeld, callState, number, type, name))); if (!(mSystemInterface.isInCall() || mSystemInterface.isRinging())) { Log.i(TAG, "no call, sending resume A2DP message to state machines"); for (BluetoothDevice device : availableDevices) { |