summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/app/Android.bp1
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpService.java28
-rw-r--r--android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java12
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java4
-rw-r--r--android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java16
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java40
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java16
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/LeAudioService.java38
-rw-r--r--android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java2
-rw-r--r--android/app/src/com/android/bluetooth/vc/VolumeControlService.java21
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java34
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java312
-rw-r--r--android/pandora/mmi2grpc/pyrightconfig.json14
-rw-r--r--flags/bta_dm.aconfig7
-rw-r--r--flags/framework.aconfig7
-rw-r--r--flags/hfp.aconfig7
-rw-r--r--flags/leaudio.aconfig16
-rw-r--r--flags/sdp.aconfig7
-rw-r--r--flags/security.aconfig7
-rw-r--r--framework/api/current.txt14
-rw-r--r--framework/api/system-current.txt6
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java18
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java150
-rw-r--r--framework/java/android/bluetooth/BluetoothHapClient.java38
-rw-r--r--framework/java/android/bluetooth/BluetoothHeadsetClient.java53
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudio.java15
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java7
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java95
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcast.java26
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java103
-rw-r--r--framework/java/android/bluetooth/BluetoothMapClient.java77
-rw-r--r--framework/java/android/bluetooth/BluetoothPbapClient.java65
-rw-r--r--framework/java/android/bluetooth/BluetoothSap.java24
-rw-r--r--framework/java/android/bluetooth/BluetoothVolumeControl.java6
-rw-r--r--framework/java/android/bluetooth/le/DistanceMeasurementManager.java3
-rw-r--r--framework/java/android/bluetooth/le/DistanceMeasurementSession.java19
-rw-r--r--system/bta/le_audio/client.cc4
-rw-r--r--system/bta/le_audio/le_audio_client_test.cc13
-rw-r--r--system/gd/hci/distance_measurement_manager.cc8
-rw-r--r--system/stack/smp/smp_act.cc19
41 files changed, 652 insertions, 704 deletions
diff --git a/android/app/Android.bp b/android/app/Android.bp
index fc10ee7097..de61bbf48b 100644
--- a/android/app/Android.bp
+++ b/android/app/Android.bp
@@ -341,6 +341,7 @@ android_app {
"-Xep:EqualsHashCode:ERROR",
"-Xep:FallThrough:ERROR",
"-Xep:Finalize:ERROR",
+ "-Xep:GuardedBy:ERROR",
"-Xep:HidingField:ERROR",
"-Xep:InconsistentHashCode:ERROR",
"-Xep:InlineMeInliner:ERROR",
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
index 4ddd7ba140..45d667e37e 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -524,11 +524,13 @@ public class A2dpService extends ProfileService {
@VisibleForTesting
public boolean setSilenceMode(@NonNull BluetoothDevice device, boolean silence) {
Log.d(TAG, "setSilenceMode(" + device + "): " + silence);
- if (silence && Objects.equals(mActiveDevice, device)) {
- removeActiveDevice(true);
- } else if (!silence && mActiveDevice == null) {
- // Set the device as the active device if currently no active device.
- setActiveDevice(device);
+ synchronized (mStateMachines) {
+ if (silence && Objects.equals(mActiveDevice, device)) {
+ removeActiveDevice(true);
+ } else if (!silence && mActiveDevice == null) {
+ // Set the device as the active device if currently no active device.
+ setActiveDevice(device);
+ }
}
if (!mNativeInterface.setSilenceDevice(device, silence)) {
Log.e(TAG, "Cannot set " + device + " silence mode " + silence + " in native layer");
@@ -752,7 +754,9 @@ public class A2dpService extends ProfileService {
public void setCodecConfigPreference(BluetoothDevice device, BluetoothCodecConfig codecConfig) {
Log.d(TAG, "setCodecConfigPreference(" + device + "): " + Objects.toString(codecConfig));
if (device == null) {
- device = mActiveDevice;
+ synchronized (mStateMachines) {
+ device = mActiveDevice;
+ }
}
if (device == null) {
Log.e(TAG, "setCodecConfigPreference: Invalid device");
@@ -779,7 +783,9 @@ public class A2dpService extends ProfileService {
public void enableOptionalCodecs(BluetoothDevice device) {
Log.d(TAG, "enableOptionalCodecs(" + device + ")");
if (device == null) {
- device = mActiveDevice;
+ synchronized (mStateMachines) {
+ device = mActiveDevice;
+ }
}
if (device == null) {
Log.e(TAG, "enableOptionalCodecs: Invalid device");
@@ -807,7 +813,9 @@ public class A2dpService extends ProfileService {
public void disableOptionalCodecs(BluetoothDevice device) {
Log.d(TAG, "disableOptionalCodecs(" + device + ")");
if (device == null) {
- device = mActiveDevice;
+ synchronized (mStateMachines) {
+ device = mActiveDevice;
+ }
}
if (device == null) {
Log.e(TAG, "disableOptionalCodecs: Invalid device");
@@ -1685,7 +1693,9 @@ public class A2dpService extends ProfileService {
@Override
public void dump(StringBuilder sb) {
super.dump(sb);
- ProfileService.println(sb, "mActiveDevice: " + mActiveDevice);
+ synchronized (mStateMachines) {
+ ProfileService.println(sb, "mActiveDevice: " + mActiveDevice);
+ }
ProfileService.println(sb, "mMaxConnectedAudioDevices: " + mMaxConnectedAudioDevices);
if (mA2dpCodecConfig != null) {
ProfileService.println(sb, "codecConfigPriorities:");
diff --git a/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java b/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
index d696b608d3..1cbde5ec5e 100644
--- a/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
+++ b/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
@@ -233,10 +233,8 @@ public class MediaPlayerList {
} else {
// Build the list of browsable players and afterwards, build the list of media players
Intent intent = new Intent(android.service.media.MediaBrowserService.SERVICE_INTERFACE);
- if (Flags.keepStoppedMediaBrowserService()) {
- // Don't query stopped apps, that would end up unstopping them
- intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
- }
+ // Don't query stopped apps, that would end up unstopping them
+ intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
List<ResolveInfo> playerList =
mContext.getApplicationContext()
.getPackageManager()
@@ -856,10 +854,8 @@ public class MediaPlayerList {
.getPackageManager()
.queryIntentActivities(intentPlayer, 0);
- if (Flags.keepStoppedMediaBrowserService()) {
- // Don't query stopped apps, that would end up unstopping them
- intentBrowsable.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
- }
+ // Don't query stopped apps, that would end up unstopping them
+ intentBrowsable.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
List<ResolveInfo> browsablePlayerList =
mContext.getApplicationContext()
.getPackageManager()
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
index caad2c7d77..4d366ac130 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
@@ -59,9 +59,9 @@ public class AvrcpNativeInterface {
if (sInstance == null) {
sInstance = new AvrcpNativeInterface();
}
- }
- return sInstance;
+ return sInstance;
+ }
}
/** Set singleton instance. */
diff --git a/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
index b964318759..8118b67d40 100644
--- a/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
+++ b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
@@ -1200,22 +1200,30 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac
@VisibleForTesting
BluetoothDevice getA2dpActiveDevice() {
- return mA2dpActiveDevice;
+ synchronized (mLock) {
+ return mA2dpActiveDevice;
+ }
}
@VisibleForTesting
BluetoothDevice getHfpActiveDevice() {
- return mHfpActiveDevice;
+ synchronized (mLock) {
+ return mHfpActiveDevice;
+ }
}
@VisibleForTesting
Set<BluetoothDevice> getHearingAidActiveDevices() {
- return mHearingAidActiveDevices;
+ synchronized (mLock) {
+ return mHearingAidActiveDevices;
+ }
}
@VisibleForTesting
BluetoothDevice getLeAudioActiveDevice() {
- return mLeAudioActiveDevice;
+ synchronized (mLock) {
+ return mLeAudioActiveDevice;
+ }
}
@GuardedBy("mLock")
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 20b74fd8c4..cd15b65c41 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -2129,28 +2129,28 @@ class HeadsetStateMachine extends StateMachine {
callSetup = phoneState.getNumHeldCall();
}
- if (Flags.pretendNetworkService()) {
- logd("processAtCind: pretendNetworkService enabled");
- boolean isCallOngoing =
- (phoneState.getNumActiveCall() > 0)
- || (phoneState.getNumHeldCall() > 0)
- || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_ALERTING
- || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_DIALING
- || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_INCOMING;
- if ((isCallOngoing
- && (!mHeadsetService.isVirtualCallStarted())
- && (phoneState.getCindService()
- == HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE))) {
- logi(
- "processAtCind: If regular call is in progress/active/held while no network"
+ // During wifi call, a regular call in progress while no network service,
+ // pretend service availability and signal strength.
+ boolean isCallOngoing =
+ (phoneState.getNumActiveCall() > 0)
+ || (phoneState.getNumHeldCall() > 0)
+ || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_ALERTING
+ || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_DIALING
+ || phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_INCOMING;
+ if ((isCallOngoing
+ && (!mHeadsetService.isVirtualCallStarted())
+ && (phoneState.getCindService()
+ == HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE))) {
+ logi(
+ "processAtCind: If regular call is in progress/active/held while no network"
+ " during BT-ON, pretend service availability and signal strength");
- service = HeadsetHalConstants.NETWORK_STATE_AVAILABLE;
- signal = 3;
- } else {
- service = phoneState.getCindService();
- signal = phoneState.getCindSignal();
- }
+ service = HeadsetHalConstants.NETWORK_STATE_AVAILABLE;
+ signal = 3; // use a non-zero signal strength
+ } else {
+ service = phoneState.getCindService();
+ signal = phoneState.getCindSignal();
}
+
mNativeInterface.cindResponse(
device,
service,
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
index df37212211..9897e6921c 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
@@ -860,16 +860,20 @@ public class HeadsetClientService extends ProfileService {
+ allowed
+ ", "
+ Utils.getUidPidString());
- HeadsetClientStateMachine sm = mStateMachineMap.get(device);
- if (sm != null) {
- sm.setAudioRouteAllowed(allowed);
+ synchronized (mStateMachineMap) {
+ HeadsetClientStateMachine sm = mStateMachineMap.get(device);
+ if (sm != null) {
+ sm.setAudioRouteAllowed(allowed);
+ }
}
}
public boolean getAudioRouteAllowed(BluetoothDevice device) {
- HeadsetClientStateMachine sm = mStateMachineMap.get(device);
- if (sm != null) {
- return sm.getAudioRouteAllowed();
+ synchronized (mStateMachineMap) {
+ HeadsetClientStateMachine sm = mStateMachineMap.get(device);
+ if (sm != null) {
+ return sm.getAudioRouteAllowed();
+ }
}
return false;
}
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
index 47396668ad..229fc303d8 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
@@ -249,7 +249,7 @@ public class LeAudioService extends ProfileService {
mLostLeadDeviceWhileStreaming = null;
mCurrentLeadDevice = null;
mInbandRingtoneEnabled = isInbandRingtonEnabled;
- mAvailableContexts = 0;
+ mAvailableContexts = Flags.leaudioUnicastNoAvailableContexts() ? null : 0;
mInputSelectableConfig = new ArrayList<>();
mOutputSelectableConfig = new ArrayList<>();
mInactivatedDueToContextType = false;
@@ -721,11 +721,11 @@ public class LeAudioService extends ProfileService {
setLeAudioService(null);
// Unregister broadcast callbacks
- if (mBroadcastCallbacks != null) {
+ synchronized (mBroadcastCallbacks) {
mBroadcastCallbacks.kill();
}
- if (mLeAudioCallbacks != null) {
+ synchronized (mLeAudioCallbacks) {
mLeAudioCallbacks.kill();
}
@@ -2952,9 +2952,13 @@ public class LeAudioService extends ProfileService {
return;
}
- boolean ringtoneContextAvailable =
- ((groupDescriptor.mAvailableContexts & BluetoothLeAudio.CONTEXT_TYPE_RINGTONE)
- != 0);
+ boolean ringtoneContextAvailable;
+ if (groupDescriptor.mAvailableContexts != null) {
+ ringtoneContextAvailable = ((groupDescriptor.mAvailableContexts &
+ BluetoothLeAudio.CONTEXT_TYPE_RINGTONE) != 0);
+ } else {
+ ringtoneContextAvailable = false;
+ }
Log.d(
TAG,
@@ -3492,9 +3496,10 @@ public class LeAudioService extends ProfileService {
BluetoothLeAudio.GROUP_STATUS_INACTIVE));
}
}
+
+ boolean isInitial = descriptor.mAvailableContexts == null;
boolean availableContextChanged =
- Integer.bitCount(descriptor.mAvailableContexts)
- != Integer.bitCount(available_contexts);
+ isInitial ? true : descriptor.mAvailableContexts != available_contexts;
descriptor.mDirection = direction;
descriptor.mAvailableContexts = available_contexts;
@@ -3519,6 +3524,13 @@ public class LeAudioService extends ProfileService {
+ " due to unavailable context types");
descriptor.mInactivatedDueToContextType = true;
setActiveGroupWithDevice(null, false);
+ } else if (isInitial) {
+ Log.i(
+ TAG,
+ " New group "
+ + groupId
+ + " with no context types available");
+ descriptor.mInactivatedDueToContextType = true;
}
return;
}
@@ -4144,7 +4156,7 @@ public class LeAudioService extends ProfileService {
if (getConnectedPeerDevices(groupId).isEmpty()) {
descriptor.mIsConnected = false;
- descriptor.mInactivatedDueToContextType = false;
+ descriptor.mAvailableContexts = Flags.leaudioUnicastNoAvailableContexts() ? null : 0;
if (descriptor.isActive()) {
/* Notify Native layer */
removeActiveDevice(hasFallbackDevice);
@@ -4495,7 +4507,7 @@ public class LeAudioService extends ProfileService {
Log.e(TAG, "getGroupId: No valid descriptor for groupId: " + groupId);
return false;
}
- return descriptor.mAvailableContexts != 0;
+ return descriptor.mAvailableContexts != null && descriptor.mAvailableContexts != 0;
} finally {
mGroupReadLock.unlock();
}
@@ -4871,7 +4883,7 @@ public class LeAudioService extends ProfileService {
}
private void notifyUnicastCodecConfigChanged(int groupId, BluetoothLeAudioCodecStatus status) {
- if (mLeAudioCallbacks != null) {
+ synchronized (mLeAudioCallbacks) {
int n = mLeAudioCallbacks.beginBroadcast();
for (int i = 0; i < n; i++) {
try {
@@ -5649,7 +5661,7 @@ public class LeAudioService extends ProfileService {
Objects.requireNonNull(source, "source cannot be null");
LeAudioService service = getServiceAndEnforceConnect(source);
- if ((service == null) || (service.mBroadcastCallbacks == null)) {
+ if (service == null) {
return;
}
@@ -5666,7 +5678,7 @@ public class LeAudioService extends ProfileService {
Objects.requireNonNull(source, "source cannot be null");
LeAudioService service = getServiceAndEnforceConnect(source);
- if ((service == null) || (service.mBroadcastCallbacks == null)) {
+ if (service == null) {
return;
}
diff --git a/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java b/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
index 93979d35b3..23c65367f6 100644
--- a/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
+++ b/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
@@ -108,6 +108,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory {
}
}
+ @GuardedBy("this")
private void stopIpClientLocked() {
// Mark all previous start requests as obsolete
mIpClientStartIndex++;
@@ -121,6 +122,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory {
}
}
+ @GuardedBy("this")
private BtIpClientCallback startIpClientLocked() {
mIpClientStartIndex++;
final BtIpClientCallback callback = new BtIpClientCallback(mIpClientStartIndex);
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
index 29df7b9bab..be358982c7 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
@@ -213,8 +213,10 @@ public class VolumeControlService extends ProfileService {
mVolumeControlNativeInterface = null;
mAdapterService = null;
- if (mCallbacks != null) {
- mCallbacks.kill();
+ synchronized (mCallbacks) {
+ if (mCallbacks != null) {
+ mCallbacks.kill();
+ }
}
}
@@ -852,16 +854,21 @@ public class VolumeControlService extends ProfileService {
// notify group devices volume changed
LeAudioService leAudioService = mFactory.getLeAudioService();
if (leAudioService != null) {
- notifyDevicesVolumeChanged(
- mCallbacks,
- leAudioService.getGroupDevices(groupId),
- Optional.of(volume));
+ synchronized (mCallbacks) {
+ notifyDevicesVolumeChanged(
+ mCallbacks,
+ leAudioService.getGroupDevices(groupId),
+ Optional.of(volume));
+ }
} else {
Log.w(TAG, "leAudioService not available");
}
} else {
// notify device volume changed
- notifyDevicesVolumeChanged(mCallbacks, Arrays.asList(device), Optional.of(volume));
+ synchronized (mCallbacks) {
+ notifyDevicesVolumeChanged(
+ mCallbacks, Arrays.asList(device), Optional.of(volume));
+ }
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
index ab367e5c41..34077ad0c1 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
@@ -1288,7 +1288,6 @@ public class HeadsetStateMachineTest {
/** A test to verify that we correctly send CIND response when a call is in progress */
@Test
public void testCindEventWhenCallIsInProgress() {
- mSetFlagsRule.enableFlags(Flags.FLAG_PRETEND_NETWORK_SERVICE);
when(mPhoneState.getCindService())
.thenReturn(HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE);
when(mHeadsetService.isVirtualCallStarted()).thenReturn(false);
@@ -1300,29 +1299,16 @@ public class HeadsetStateMachineTest {
HeadsetStateMachine.STACK_EVENT,
new HeadsetStackEvent(HeadsetStackEvent.EVENT_TYPE_AT_CIND, mTestDevice));
// wait state machine to process the message
- if (Flags.pretendNetworkService()) {
- verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS))
- .cindResponse(
- eq(mTestDevice),
- eq(HeadsetHalConstants.NETWORK_STATE_AVAILABLE),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt());
- } else {
- verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS))
- .cindResponse(
- eq(mTestDevice),
- eq(HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt(),
- anyInt());
- }
+ verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS))
+ .cindResponse(
+ eq(mTestDevice),
+ eq(HeadsetHalConstants.NETWORK_STATE_AVAILABLE),
+ anyInt(),
+ anyInt(),
+ anyInt(),
+ anyInt(),
+ anyInt(),
+ anyInt());
}
/** A test to verify that we correctly handles key pressed event from a HSP headset */
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
index 297909e221..cc44b8b9af 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
@@ -56,6 +56,7 @@ import android.media.BluetoothProfileConnectionInfo;
import android.os.Handler;
import android.os.Looper;
import android.os.ParcelUuid;
+import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.sysprop.BluetoothProperties;
@@ -3109,6 +3110,317 @@ public class LeAudioServiceTest {
any(BluetoothProfileConnectionInfo.class));
}
+ /**
+ * Test the group is activated once the available contexts are back.
+ *
+ * Scenario:
+ * 1. Have a group of 2 devices that initially does not expose any available contexts.
+ * The group shall be inactive at this point.
+ * 2. Once the available contexts are updated with non-zero value,
+ * the group shall become active.
+ * 3. The available contexts are changed to zero. Group becomes inactive.
+ * 4. The available contexts are back again. Group becomes active.
+ */
+ @Test
+ @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
+ public void testActivateGroupWhenAvailableContextAreBack_Scenario1() {
+ int groupId = 1;
+ /* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
+ int direction = 1;
+ int snkAudioLocation = 3;
+ int srcAudioLocation = 4;
+ int availableContexts = 5 + BluetoothLeAudio.CONTEXT_TYPE_RINGTONE;
+
+ doReturn(true).when(mNativeInterface).connectLeAudio(any(BluetoothDevice.class));
+ connectTestDevice(mLeftDevice, groupId);
+ connectTestDevice(mRightDevice, groupId);
+
+ // Checks group device lists for groupId 1
+ List<BluetoothDevice> groupDevicesById = mService.getGroupDevices(groupId);
+
+ assertThat(groupDevicesById.size()).isEqualTo(2);
+ assertThat(groupDevicesById.contains(mLeftDevice)).isTrue();
+ assertThat(groupDevicesById.contains(mRightDevice)).isTrue();
+
+ // Add location support
+ LeAudioStackEvent audioConfChangedEvent =
+ new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_AUDIO_CONF_CHANGED);
+ audioConfChangedEvent.valueInt1 = direction;
+ audioConfChangedEvent.valueInt2 = groupId;
+ audioConfChangedEvent.valueInt3 = snkAudioLocation;
+ audioConfChangedEvent.valueInt4 = srcAudioLocation;
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ assertThat(mService.setActiveDevice(mLeftDevice)).isFalse();
+ verify(mNativeInterface, times(0)).groupSetActive(groupId);
+
+ // Expect device to be active
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+
+ reset(mAudioManager);
+ reset(mNativeInterface);
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(-1);
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_INACTIVE);
+
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ eq(null),
+ any(BluetoothDevice.class),
+ any(BluetoothProfileConnectionInfo.class));
+
+ reset(mNativeInterface);
+ reset(mAudioManager);
+
+ // Expect device to be active
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+ reset(mNativeInterface);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+ }
+
+ /**
+ * Test the group is activated once the available contexts are back.
+ *
+ * Scenario:
+ * 1. Have a group of 2 devices. The available contexts are non-zero.
+ * The group shall be active at this point.
+ * 2. Once the available contexts are updated with zero value,
+ * the group shall become inactive.
+ * 3. All group devices are disconnected.
+ * 4. Group devices are reconnected. The available contexts are still zero.
+ * 4. The available contexts are updated with non-zero value. Group becomes active.
+ */
+ @Test
+ @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
+ public void testActivateDeviceWhenAvailableContextAreBack_Scenario2() {
+ int groupId = 1;
+ /* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
+ int direction = 1;
+ int snkAudioLocation = 3;
+ int srcAudioLocation = 4;
+ int availableContexts = 5 + BluetoothLeAudio.CONTEXT_TYPE_RINGTONE;
+
+ doReturn(true).when(mNativeInterface).connectLeAudio(any(BluetoothDevice.class));
+ connectTestDevice(mLeftDevice, groupId);
+ connectTestDevice(mRightDevice, groupId);
+
+ // Checks group device lists for groupId 1
+ List<BluetoothDevice> groupDevicesById = mService.getGroupDevices(groupId);
+
+ assertThat(groupDevicesById.size()).isEqualTo(2);
+ assertThat(groupDevicesById.contains(mLeftDevice)).isTrue();
+ assertThat(groupDevicesById.contains(mRightDevice)).isTrue();
+
+ // Add location support
+ LeAudioStackEvent audioConfChangedEvent =
+ new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_AUDIO_CONF_CHANGED);
+ audioConfChangedEvent.valueInt1 = direction;
+ audioConfChangedEvent.valueInt2 = groupId;
+ audioConfChangedEvent.valueInt3 = snkAudioLocation;
+ audioConfChangedEvent.valueInt4 = srcAudioLocation;
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ assertThat(mService.setActiveDevice(mLeftDevice)).isTrue();
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+
+ reset(mAudioManager);
+ reset(mNativeInterface);
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(-1);
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_INACTIVE);
+
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ eq(null),
+ any(BluetoothDevice.class),
+ any(BluetoothProfileConnectionInfo.class));
+
+ reset(mNativeInterface);
+ reset(mAudioManager);
+
+ // Send a message to trigger disconnection completed to the left device
+ injectAndVerifyDeviceDisconnected(mLeftDevice);
+
+ // Send a message to trigger disconnection completed to the right device
+ injectAndVerifyDeviceDisconnected(mRightDevice);
+
+ // Verify the list of connected devices
+ assertThat(mService.getConnectedDevices().contains(mLeftDevice)).isFalse();
+ assertThat(mService.getConnectedDevices().contains(mRightDevice)).isFalse();
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ generateConnectionMessageFromNative(
+ mLeftDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mService.getConnectionState(mLeftDevice))
+ .isEqualTo(BluetoothProfile.STATE_CONNECTED);
+ assertThat(mService.getConnectedDevices().contains(mLeftDevice)).isTrue();
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ generateConnectionMessageFromNative(
+ mRightDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mService.getConnectionState(mRightDevice))
+ .isEqualTo(BluetoothProfile.STATE_CONNECTED);
+ assertThat(mService.getConnectedDevices().contains(mRightDevice)).isTrue();
+
+ // Expect device to be active
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+ }
+
+ /**
+ * Test the group is activated once the available contexts are back.
+ *
+ * Scenario:
+ * 1. Have a group of 2 devices. The available contexts are non-zero.
+ * The group shall be active at this point.
+ * 2. All group devices are disconnected.
+ * 3. Group devices are reconnected. The available contexts are zero.
+ * 4. The available contexts are updated with non-zero value. Group becomes active.
+ */
+ @Test
+ @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
+ public void testActivateDeviceWhenAvailableContextAreBack_Scenario3() {
+ int groupId = 1;
+ /* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
+ int direction = 1;
+ int snkAudioLocation = 3;
+ int srcAudioLocation = 4;
+ int availableContexts = 5 + BluetoothLeAudio.CONTEXT_TYPE_RINGTONE;
+
+ doReturn(true).when(mNativeInterface).connectLeAudio(any(BluetoothDevice.class));
+ connectTestDevice(mLeftDevice, groupId);
+ connectTestDevice(mRightDevice, groupId);
+
+ // Checks group device lists for groupId 1
+ List<BluetoothDevice> groupDevicesById = mService.getGroupDevices(groupId);
+
+ assertThat(groupDevicesById.size()).isEqualTo(2);
+ assertThat(groupDevicesById.contains(mLeftDevice)).isTrue();
+ assertThat(groupDevicesById.contains(mRightDevice)).isTrue();
+
+ // Add location support
+ LeAudioStackEvent audioConfChangedEvent =
+ new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_AUDIO_CONF_CHANGED);
+ audioConfChangedEvent.valueInt1 = direction;
+ audioConfChangedEvent.valueInt2 = groupId;
+ audioConfChangedEvent.valueInt3 = snkAudioLocation;
+ audioConfChangedEvent.valueInt4 = srcAudioLocation;
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ assertThat(mService.setActiveDevice(mLeftDevice)).isTrue();
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+
+ reset(mNativeInterface);
+ reset(mAudioManager);
+
+ // Send a message to trigger disconnection completed to the right device
+ injectAndVerifyDeviceDisconnected(mRightDevice);
+
+ // Send a message to trigger disconnection completed to the left device
+ injectAndVerifyDeviceDisconnected(mLeftDevice);
+
+ reset(mNativeInterface);
+ reset(mAudioManager);
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ generateConnectionMessageFromNative(
+ mLeftDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mService.getConnectionState(mLeftDevice))
+ .isEqualTo(BluetoothProfile.STATE_CONNECTED);
+ assertThat(mService.getConnectedDevices().contains(mLeftDevice)).isTrue();
+
+ // Expect device to be inactive
+ audioConfChangedEvent.valueInt5 = 0;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ generateConnectionMessageFromNative(
+ mRightDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mService.getConnectionState(mRightDevice))
+ .isEqualTo(BluetoothProfile.STATE_CONNECTED);
+ assertThat(mService.getConnectedDevices().contains(mRightDevice)).isTrue();
+
+ // Expect device to be active
+ audioConfChangedEvent.valueInt5 = availableContexts;
+ mService.messageFromNative(audioConfChangedEvent);
+
+ verify(mNativeInterface, times(1)).groupSetActive(groupId);
+
+ // Set group and device as active.
+ injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
+ verify(mAudioManager, times(1))
+ .handleBluetoothActiveDeviceChanged(
+ any(BluetoothDevice.class),
+ eq(null),
+ any(BluetoothProfileConnectionInfo.class));
+ }
+
/** Test setting allowed contexts for active group */
@Test
public void testSetAllowedContextsForActiveGroup() {
diff --git a/android/pandora/mmi2grpc/pyrightconfig.json b/android/pandora/mmi2grpc/pyrightconfig.json
new file mode 100644
index 0000000000..fab9f6135d
--- /dev/null
+++ b/android/pandora/mmi2grpc/pyrightconfig.json
@@ -0,0 +1,14 @@
+{
+ "typeCheckingMode": "strict",
+ "useLibraryCodeForTypes": true,
+ "verboseOutput": false,
+ "reportMissingTypeStubs": false,
+ "reportUnknownLambdaType": false,
+ "reportImportCycles": false,
+ "reportPrivateUsage": false,
+ "extraPaths": [
+ "../../../pandora/server",
+ "../../../../../../out/soong/.intermediates/external/pandora/bt-test-interfaces/python/pandora-python-gen-src/gen/",
+ "../../../../../../out/soong/.intermediates/packages/modules/Bluetooth/pandora/interfaces/python/pandora_experimental-python-gen-src/gen/"
+ ]
+}
diff --git a/flags/bta_dm.aconfig b/flags/bta_dm.aconfig
index c882038d6f..e0ed3358b6 100644
--- a/flags/bta_dm.aconfig
+++ b/flags/bta_dm.aconfig
@@ -16,13 +16,6 @@ flag {
}
flag {
- name: "continue_service_discovery_when_cancel_device_discovery"
- namespace: "bluetooth"
- description: "Continue service discovery when API cancel device discovery called"
- bug: "329642681"
-}
-
-flag {
name: "bta_dm_discover_both"
namespace: "bluetooth"
description: "perform both LE and Classic service discovery simulteanously on capable devices"
diff --git a/flags/framework.aconfig b/flags/framework.aconfig
index 89b398a4fa..3a1ae1b26d 100644
--- a/flags/framework.aconfig
+++ b/flags/framework.aconfig
@@ -36,13 +36,6 @@ flag {
}
flag {
- name: "keep_stopped_media_browser_service"
- namespace: "bluetooth"
- description: "Do not start stopped media browser services"
- bug: "314855224"
-}
-
-flag {
name: "identity_address_null_if_not_known"
namespace: "bluetooth"
description: "Return null for identity address if identity address is not known"
diff --git a/flags/hfp.aconfig b/flags/hfp.aconfig
index b627a0e978..b5e1908e16 100644
--- a/flags/hfp.aconfig
+++ b/flags/hfp.aconfig
@@ -23,13 +23,6 @@ flag {
}
flag {
- name: "pretend_network_service"
- namespace: "bluetooth"
- description: "during ongoing call, pretend network service in +CIND when network is unavailable"
- bug: "317307596"
-}
-
-flag {
name: "hfp_software_datapath"
namespace: "bluetooth"
description: "enable HFP software decode/encode data path"
diff --git a/flags/leaudio.aconfig b/flags/leaudio.aconfig
index cb1107a2d5..5dbb86dc99 100644
--- a/flags/leaudio.aconfig
+++ b/flags/leaudio.aconfig
@@ -68,22 +68,6 @@ flag {
}
flag {
- name: "leaudio_add_sampling_frequencies"
- is_exported: true
- namespace: "bluetooth"
- description: "Adds missing frequencies defined by the Bluetooth SIG"
- bug: "323287937"
-}
-
-flag {
- name: "leaudio_callback_on_group_stream_status"
- is_exported: true
- namespace: "bluetooth"
- description: "Add group stream status callback to notify about playing state"
- bug: "323288608"
-}
-
-flag {
name: "leaudio_multiple_vocs_instances_api"
is_exported: true
namespace: "bluetooth"
diff --git a/flags/sdp.aconfig b/flags/sdp.aconfig
index 39fa537254..a20adb914a 100644
--- a/flags/sdp.aconfig
+++ b/flags/sdp.aconfig
@@ -7,10 +7,3 @@ flag {
description: "Check for NIL SDP property length"
bug: "329171845"
}
-
-flag {
- name: "stack_sdp_disconnect_when_cancel_in_pending_state"
- namespace: "bluetooth"
- description: "Send disconnect when cancel in pending state"
- bug: "329918955"
-}
diff --git a/flags/security.aconfig b/flags/security.aconfig
index 5dae24b17f..c014a2a16d 100644
--- a/flags/security.aconfig
+++ b/flags/security.aconfig
@@ -16,13 +16,6 @@ flag {
}
flag {
- name: "fix_le_pairing_passkey_entry_bypass"
- namespace: "bluetooth"
- description: "Fix the passkey entry bypassing bug in SMP"
- bug: "321300737"
-}
-
-flag {
name: "bta_av_setconfig_rej_type_confusion"
namespace: "bluetooth"
description: "Use stream control block for bta_av_setconfig_rej instead of a possibly incorrect union type"
diff --git a/framework/api/current.txt b/framework/api/current.txt
index d25d9c8b3d..29d8ef989d 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -977,19 +977,19 @@ package android.bluetooth {
field public static final int FRAME_DURATION_10000 = 2; // 0x2
field public static final int FRAME_DURATION_7500 = 1; // 0x1
field public static final int FRAME_DURATION_NONE = 0; // 0x0
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_11025 = 2; // 0x2
+ field public static final int SAMPLE_RATE_11025 = 2; // 0x2
field public static final int SAMPLE_RATE_16000 = 4; // 0x4
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_176400 = 1024; // 0x400
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_192000 = 2048; // 0x800
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_22050 = 8; // 0x8
+ field public static final int SAMPLE_RATE_176400 = 1024; // 0x400
+ field public static final int SAMPLE_RATE_192000 = 2048; // 0x800
+ field public static final int SAMPLE_RATE_22050 = 8; // 0x8
field public static final int SAMPLE_RATE_24000 = 16; // 0x10
field public static final int SAMPLE_RATE_32000 = 32; // 0x20
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_384000 = 4096; // 0x1000
+ field public static final int SAMPLE_RATE_384000 = 4096; // 0x1000
field public static final int SAMPLE_RATE_44100 = 64; // 0x40
field public static final int SAMPLE_RATE_48000 = 128; // 0x80
field public static final int SAMPLE_RATE_8000 = 1; // 0x1
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_88200 = 256; // 0x100
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_96000 = 512; // 0x200
+ field public static final int SAMPLE_RATE_88200 = 256; // 0x100
+ field public static final int SAMPLE_RATE_96000 = 512; // 0x200
field public static final int SAMPLE_RATE_NONE = 0; // 0x0
field public static final int SOURCE_CODEC_TYPE_INVALID = 1000000; // 0xf4240
field public static final int SOURCE_CODEC_TYPE_LC3 = 0; // 0x0
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 0afc7a7dde..783635e7d4 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -496,8 +496,8 @@ package android.bluetooth {
field public static final int AUDIO_LOCATION_TOP_SIDE_LEFT = 262144; // 0x40000
field public static final int AUDIO_LOCATION_TOP_SIDE_RIGHT = 524288; // 0x80000
field public static final String EXTRA_LE_AUDIO_GROUP_ID = "android.bluetooth.extra.LE_AUDIO_GROUP_ID";
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_callback_on_group_stream_status") public static final int GROUP_STREAM_STATUS_IDLE = 0; // 0x0
- field @FlaggedApi("com.android.bluetooth.flags.leaudio_callback_on_group_stream_status") public static final int GROUP_STREAM_STATUS_STREAMING = 1; // 0x1
+ field public static final int GROUP_STREAM_STATUS_IDLE = 0; // 0x0
+ field public static final int GROUP_STREAM_STATUS_STREAMING = 1; // 0x1
}
public static interface BluetoothLeAudio.Callback {
@@ -505,7 +505,7 @@ package android.bluetooth {
method public void onGroupNodeAdded(@NonNull android.bluetooth.BluetoothDevice, int);
method public void onGroupNodeRemoved(@NonNull android.bluetooth.BluetoothDevice, int);
method public void onGroupStatusChanged(int, int);
- method @FlaggedApi("com.android.bluetooth.flags.leaudio_callback_on_group_stream_status") public default void onGroupStreamStatusChanged(int, int);
+ method public default void onGroupStreamStatusChanged(int, int);
}
public final class BluetoothLeAudioCodecConfigMetadata implements android.os.Parcelable {
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index cf90b8e15a..252e25832b 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -4243,14 +4243,14 @@ public final class BluetoothAdapter {
IBluetooth.Stub.asInterface(
mManagerService.registerAdapter(sManagerCallback));
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ throw e.rethrowFromSystemServer();
}
} else {
try {
mManagerService.unregisterAdapter(sManagerCallback);
sService = null;
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ throw e.rethrowFromSystemServer();
}
}
sServiceRegistered = wantRegistered;
diff --git a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
index 09a188cb86..f973239302 100644
--- a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
+++ b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
@@ -294,7 +294,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
final ParcelUuid ret = service.lockGroup(groupId, delegate, mAttributionSource);
return ret == null ? null : ret.getUuid();
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return null;
@@ -323,7 +323,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
service.unlockGroup(new ParcelUuid(lockUuid), mAttributionSource);
return true;
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return false;
@@ -350,7 +350,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getGroupUuidMapByDevice(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return new HashMap<>();
@@ -375,7 +375,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getAllGroupIds(uuid, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -395,7 +395,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getConnectedDevices(mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -416,7 +416,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getDevicesMatchingConnectionStates(states, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -437,7 +437,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getConnectionState(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return BluetoothProfile.STATE_DISCONNECTED;
@@ -472,7 +472,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return false;
@@ -501,7 +501,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
try {
return service.getConnectionPolicy(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index c513c085b9..206056a92e 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -280,11 +280,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SuppressLint("ActionValue")
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
@SystemApi
public static final String ACTION_SWITCH_BUFFER_SIZE =
@@ -308,11 +304,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@FlaggedApi(Flags.FLAG_KEY_MISSING_BROADCAST)
@SuppressLint("ActionValue")
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
@SystemApi
@BroadcastBehavior(includeBackground = true, protectedBroadcast = true)
@@ -1590,11 +1582,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @Nullable String getIdentityAddress() {
if (DBG) log("getIdentityAddress()");
final IBluetooth service = getService();
@@ -1743,7 +1731,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return service.setRemoteAlias(this, alias, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
@@ -2062,11 +2049,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean canBondWithoutDialog() {
if (DBG) log("canBondWithoutDialog, device: " + this);
final IBluetooth service = getService();
@@ -2091,13 +2074,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @Nullable
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
- public String getPackageNameOfBondingApplication() {
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
+ public @Nullable String getPackageNameOfBondingApplication() {
if (DBG) log("getPackageNameOfBondingApplication()");
final IBluetooth service = getService();
if (service == null || !isBluetoothEnabled()) {
@@ -2140,12 +2118,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- MODIFY_PHONE_STATE,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED, MODIFY_PHONE_STATE})
public @ConnectionReturnValues int connect() {
if (DBG) log("connect()");
if (!BluetoothAdapter.checkBluetoothAddress(getAddress())) {
@@ -2160,7 +2133,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return service.connectAllEnabledProfiles(this, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
@@ -2183,11 +2155,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionReturnValues int disconnect() {
if (DBG) log("disconnect()");
if (!BluetoothAdapter.checkBluetoothAddress(getAddress())) {
@@ -2202,7 +2170,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return service.disconnectAllEnabledProfiles(this, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
@@ -2249,11 +2216,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getConnectionHandle(@Transport int transport) {
if (DBG) {
log("getConnectionHandle()");
@@ -2404,10 +2367,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- },
+ allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
conditional = true)
public boolean fetchUuidsWithSdp(@Transport int transport) {
if (DBG) log("fetchUuidsWithSdp()");
@@ -2508,11 +2468,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*
* @return true confirmation has been sent out false for error
*/
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setPairingConfirmation(boolean confirm) {
if (DBG) log("setPairingConfirmation()");
final IBluetooth service = getService();
@@ -2585,11 +2541,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setSilenceMode(boolean silence) {
if (DBG) log("setSilenceMode()");
final IBluetooth service = getService();
@@ -2613,11 +2565,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean isInSilenceMode() {
if (DBG) log("isInSilenceMode()");
final IBluetooth service = getService();
@@ -2642,11 +2590,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setPhonebookAccessPermission(@AccessPermission int value) {
if (DBG) log("setPhonebookAccessPermission()");
final IBluetooth service = getService();
@@ -2699,11 +2643,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setMessageAccessPermission(@AccessPermission int value) {
// Validates param value is one of the accepted constants
if (value != ACCESS_ALLOWED && value != ACCESS_REJECTED && value != ACCESS_UNKNOWN) {
@@ -2760,11 +2700,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setSimAccessPermission(int value) {
if (DBG) log("setSimAccessPermission()");
final IBluetooth service = getService();
@@ -3270,11 +3206,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setMetadata(@MetadataKey int key, @NonNull byte[] value) {
if (DBG) log("setMetadata()");
final IBluetooth service = getService();
@@ -3302,13 +3234,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @hide
*/
@SystemApi
- @Nullable
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
- public byte[] getMetadata(@MetadataKey int key) {
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
+ public @Nullable byte[] getMetadata(@MetadataKey int key) {
if (DBG) log("getMetadata()");
final IBluetooth service = getService();
if (service == null || !isBluetoothEnabled()) {
@@ -3378,11 +3305,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @AudioPolicyRemoteSupport int isRequestAudioPolicyAsSinkSupported() {
if (DBG) log("isRequestAudioPolicyAsSinkSupported()");
final IBluetooth service = getService();
@@ -3394,7 +3317,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return service.isRequestAudioPolicyAsSinkSupported(this, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothStatusCodes.FEATURE_NOT_CONFIGURED;
@@ -3417,11 +3339,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @AudioPolicyReturnValues int requestAudioPolicyAsSink(
@NonNull BluetoothSinkAudioPolicy policies) {
if (DBG) log("requestAudioPolicyAsSink");
@@ -3459,11 +3377,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @Nullable BluetoothSinkAudioPolicy getRequestedAudioPolicyAsSink() {
if (DBG) log("getRequestedAudioPolicyAsSink");
final IBluetooth service = getService();
@@ -3490,11 +3404,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setLowLatencyAudioAllowed(boolean allowed) {
if (DBG) log("setLowLatencyAudioAllowed(" + allowed + ")");
final IBluetooth service = getService();
@@ -3554,11 +3464,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
@FlaggedApi(Flags.FLAG_METADATA_API_INACTIVE_AUDIO_DEVICE_UPON_CONNECTION)
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @SetActiveAudioDevicePolicyReturnValues int setActiveAudioDevicePolicy(
@ActiveAudioDevicePolicy int activeAudioDevicePolicy) {
if (DBG) log("setActiveAudioDevicePolicy(" + activeAudioDevicePolicy + ")");
@@ -3576,7 +3482,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
this, activeAudioDevicePolicy, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
@@ -3591,11 +3496,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
@FlaggedApi(Flags.FLAG_METADATA_API_INACTIVE_AUDIO_DEVICE_UPON_CONNECTION)
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ActiveAudioDevicePolicy int getActiveAudioDevicePolicy() {
if (DBG) log("getActiveAudioDevicePolicy");
final IBluetooth service = getService();
@@ -3607,7 +3508,6 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return service.getActiveAudioDevicePolicy(this, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- throw e.rethrowAsRuntimeException();
}
}
return ACTIVE_AUDIO_DEVICE_POLICY_DEFAULT;
diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java
index 433d08c383..61584c4aea 100644
--- a/framework/java/android/bluetooth/BluetoothHapClient.java
+++ b/framework/java/android/bluetooth/BluetoothHapClient.java
@@ -589,7 +589,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return false;
@@ -617,7 +617,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getConnectionPolicy(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
@@ -641,7 +641,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
return Attributable.setAttributionSource(
service.getConnectedDevices(mAttributionSource), mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -667,7 +667,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
service.getDevicesMatchingConnectionStates(states, mAttributionSource),
mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -691,7 +691,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getConnectionState(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return BluetoothProfile.STATE_DISCONNECTED;
@@ -727,7 +727,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getHapGroup(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return BluetoothCsipSetCoordinator.GROUP_ID_INVALID;
@@ -752,7 +752,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getActivePresetIndex(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return PRESET_INDEX_UNAVAILABLE;
@@ -777,7 +777,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getActivePresetInfo(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
@@ -806,7 +806,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.selectPreset(device, presetIndex, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -837,7 +837,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.selectPresetForGroup(groupId, presetIndex, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -863,7 +863,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.switchToNextPreset(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -892,7 +892,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.switchToNextPresetForGroup(groupId, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -918,7 +918,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.switchToPreviousPreset(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -947,7 +947,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.switchToPreviousPresetForGroup(groupId, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -973,7 +973,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getPresetInfo(device, presetIndex, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return null;
@@ -997,7 +997,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getAllPresetInfo(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -1020,7 +1020,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
return service.getFeatures(device, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return 0x00;
@@ -1126,7 +1126,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.setPresetName(device, presetIndex, name, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -1157,7 +1157,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
try {
service.setPresetNameForGroup(groupId, presetIndex, name, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
diff --git a/framework/java/android/bluetooth/BluetoothHeadsetClient.java b/framework/java/android/bluetooth/BluetoothHeadsetClient.java
index e0ad1e5892..e991f4c764 100644
--- a/framework/java/android/bluetooth/BluetoothHeadsetClient.java
+++ b/framework/java/android/bluetooth/BluetoothHeadsetClient.java
@@ -83,11 +83,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SuppressLint("ActionValue")
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.headsetclient.profile.action.CONNECTION_STATE_CHANGED";
@@ -730,11 +726,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @NonNull List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
final IBluetoothHeadsetClient service = getService();
@@ -747,7 +739,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
service.getConnectedDevices(mAttributionSource), mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -761,11 +752,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@NonNull
public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
@@ -780,7 +767,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -794,11 +780,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @BtProfileState int getConnectionState(@NonNull BluetoothDevice device) {
if (VDBG) log("getConnectionState(" + device + ")");
final IBluetoothHeadsetClient service = getService();
@@ -810,7 +792,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
return service.getConnectionState(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.STATE_DISCONNECTED;
@@ -830,11 +811,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
@@ -850,7 +827,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return false;
@@ -869,11 +845,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SystemApi
@RequiresLegacyBluetoothPermission
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
if (VDBG) log("getConnectionPolicy(" + device + ")");
final IBluetoothHeadsetClient service = getService();
@@ -885,7 +857,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
return service.getConnectionPolicy(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
@@ -1619,11 +1590,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
@SuppressLint("ActionValue")
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_NETWORK_SERVICE_STATE_CHANGED =
"android.bluetooth.headsetclient.profile.action.NETWORK_SERVICE_STATE_CHANGED";
@@ -1650,11 +1617,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @Nullable NetworkServiceState getNetworkServiceState(@NonNull BluetoothDevice device) {
if (device == null) {
return null;
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index 8f7c0b6412..28a7964d07 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -23,7 +23,6 @@ import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static java.util.Objects.requireNonNull;
import android.annotation.CallbackExecutor;
-import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -44,8 +43,6 @@ import android.os.RemoteException;
import android.util.CloseGuard;
import android.util.Log;
-import com.android.bluetooth.flags.Flags;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
@@ -145,7 +142,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* @param groupStreamStatus streaming or idle state.
* @hide
*/
- @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
@SystemApi
default void onGroupStreamStatusChanged(
int groupId, @GroupStreamStatus int groupStreamStatus) {
@@ -184,10 +180,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
@Override
public void onGroupStreamStatusChanged(int groupId, int groupStreamStatus) {
- if (Flags.leaudioCallbackOnGroupStreamStatus()) {
- mCallbackWrapper.forEach(
- (cb) -> cb.onGroupStreamStatusChanged(groupId, groupStreamStatus));
- }
+ mCallbackWrapper.forEach(
+ (cb) -> cb.onGroupStreamStatusChanged(groupId, groupStreamStatus));
}
}
@@ -657,7 +651,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
*
* @hide
*/
- @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
@SystemApi
public static final int GROUP_STREAM_STATUS_IDLE = IBluetoothLeAudio.GROUP_STREAM_STATUS_IDLE;
@@ -666,7 +659,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
*
* @hide
*/
- @FlaggedApi(Flags.FLAG_LEAUDIO_CALLBACK_ON_GROUP_STREAM_STATUS)
@SystemApi
public static final int GROUP_STREAM_STATUS_STREAMING =
IBluetoothLeAudio.GROUP_STREAM_STATUS_STREAMING;
@@ -1197,7 +1189,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
return service.isInbandRingtoneEnabled(mAttributionSource, groupId);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return false;
@@ -1325,7 +1316,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
return service.getCodecStatus(groupId, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return null;
@@ -1365,7 +1355,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
groupId, inputCodecConfig, outputCodecConfig, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
}
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
index b0fa26c025..a897a7cef7 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
@@ -103,14 +103,12 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
public static final int SAMPLE_RATE_8000 = 0x01 << 0;
/** Codec sample rate 11025 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_11025 = 0x01 << 1;
/** Codec sample rate 16000 Hz. */
public static final int SAMPLE_RATE_16000 = 0x01 << 2;
/** Codec sample rate 22050 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_22050 = 0x01 << 3;
/** Codec sample rate 24000 Hz. */
@@ -126,23 +124,18 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
public static final int SAMPLE_RATE_48000 = 0x01 << 7;
/** Codec sample rate 88200 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_88200 = 0x01 << 8;
/** Codec sample rate 96000 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_96000 = 0x01 << 9;
/** Codec sample rate 176400 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_176400 = 0x01 << 10;
/** Codec sample rate 192000 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_192000 = 0x01 << 11;
/** Codec sample rate 384000 Hz. */
- @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
public static final int SAMPLE_RATE_384000 = 0x01 << 12;
/** @hide */
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
index 0a50828d15..c48ca4c842 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
@@ -20,12 +20,19 @@ import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_10000
import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_7500;
import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_NONE;
import static android.bluetooth.BluetoothLeAudioCodecConfig.FrameDuration;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_16000;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_24000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_32000;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_44100;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_48000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_8000;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200;
+import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_NONE;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SampleRate;
@@ -38,8 +45,6 @@ import android.bluetooth.BluetoothUtils.TypeValueEntry;
import android.os.Parcel;
import android.os.Parcelable;
-import com.android.bluetooth.flags.Flags;
-
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
@@ -392,25 +397,19 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
public Builder setSampleRate(@SampleRate int sampleRate) {
if (sampleRate != SAMPLE_RATE_NONE
&& sampleRate != SAMPLE_RATE_8000
+ && sampleRate != SAMPLE_RATE_11025
&& sampleRate != SAMPLE_RATE_16000
+ && sampleRate != SAMPLE_RATE_22050
&& sampleRate != SAMPLE_RATE_24000
&& sampleRate != SAMPLE_RATE_32000
&& sampleRate != SAMPLE_RATE_44100
- && sampleRate != SAMPLE_RATE_48000) {
-
- if (Flags.leaudioAddSamplingFrequencies()) {
- if (sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000
- && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000) {
+ && sampleRate != SAMPLE_RATE_48000
+ && sampleRate != SAMPLE_RATE_88200
+ && sampleRate != SAMPLE_RATE_96000
+ && sampleRate != SAMPLE_RATE_176400
+ && sampleRate != SAMPLE_RATE_192000
+ && sampleRate != SAMPLE_RATE_384000) {
throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
- }
- } else {
- throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
- }
}
mSampleRate = sampleRate;
return this;
@@ -528,8 +527,12 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
switch (samplingFrequencyValue) {
case CONFIG_SAMPLING_FREQUENCY_8000:
return SAMPLE_RATE_8000;
+ case CONFIG_SAMPLING_FREQUENCY_11025:
+ return SAMPLE_RATE_11025;
case CONFIG_SAMPLING_FREQUENCY_16000:
return SAMPLE_RATE_16000;
+ case CONFIG_SAMPLING_FREQUENCY_22050:
+ return SAMPLE_RATE_22050;
case CONFIG_SAMPLING_FREQUENCY_24000:
return SAMPLE_RATE_24000;
case CONFIG_SAMPLING_FREQUENCY_32000:
@@ -538,25 +541,17 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
return SAMPLE_RATE_44100;
case CONFIG_SAMPLING_FREQUENCY_48000:
return SAMPLE_RATE_48000;
+ case CONFIG_SAMPLING_FREQUENCY_88200:
+ return SAMPLE_RATE_88200;
+ case CONFIG_SAMPLING_FREQUENCY_96000:
+ return SAMPLE_RATE_96000;
+ case CONFIG_SAMPLING_FREQUENCY_176400:
+ return SAMPLE_RATE_176400;
+ case CONFIG_SAMPLING_FREQUENCY_192000:
+ return SAMPLE_RATE_192000;
+ case CONFIG_SAMPLING_FREQUENCY_384000:
+ return SAMPLE_RATE_384000;
default:
- if (Flags.leaudioAddSamplingFrequencies()) {
- switch (samplingFrequencyValue) {
- case CONFIG_SAMPLING_FREQUENCY_11025:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025;
- case CONFIG_SAMPLING_FREQUENCY_22050:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050;
- case CONFIG_SAMPLING_FREQUENCY_88200:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200;
- case CONFIG_SAMPLING_FREQUENCY_96000:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000;
- case CONFIG_SAMPLING_FREQUENCY_176400:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400;
- case CONFIG_SAMPLING_FREQUENCY_192000:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000;
- case CONFIG_SAMPLING_FREQUENCY_384000:
- return BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000;
- }
- }
return SAMPLE_RATE_NONE;
}
}
@@ -565,8 +560,12 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
switch (sampleRateBitSet) {
case SAMPLE_RATE_8000:
return CONFIG_SAMPLING_FREQUENCY_8000;
+ case SAMPLE_RATE_11025:
+ return CONFIG_SAMPLING_FREQUENCY_11025;
case SAMPLE_RATE_16000:
return CONFIG_SAMPLING_FREQUENCY_16000;
+ case SAMPLE_RATE_22050:
+ return CONFIG_SAMPLING_FREQUENCY_22050;
case SAMPLE_RATE_24000:
return CONFIG_SAMPLING_FREQUENCY_24000;
case SAMPLE_RATE_32000:
@@ -575,25 +574,17 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
return CONFIG_SAMPLING_FREQUENCY_44100;
case SAMPLE_RATE_48000:
return CONFIG_SAMPLING_FREQUENCY_48000;
+ case SAMPLE_RATE_88200:
+ return CONFIG_SAMPLING_FREQUENCY_88200;
+ case SAMPLE_RATE_96000:
+ return CONFIG_SAMPLING_FREQUENCY_96000;
+ case SAMPLE_RATE_176400:
+ return CONFIG_SAMPLING_FREQUENCY_176400;
+ case SAMPLE_RATE_192000:
+ return CONFIG_SAMPLING_FREQUENCY_192000;
+ case SAMPLE_RATE_384000:
+ return CONFIG_SAMPLING_FREQUENCY_384000;
default:
- if (Flags.leaudioAddSamplingFrequencies()) {
- switch (sampleRateBitSet) {
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025:
- return CONFIG_SAMPLING_FREQUENCY_11025;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050:
- return CONFIG_SAMPLING_FREQUENCY_22050;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200:
- return CONFIG_SAMPLING_FREQUENCY_88200;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000:
- return CONFIG_SAMPLING_FREQUENCY_96000;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400:
- return CONFIG_SAMPLING_FREQUENCY_176400;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000:
- return CONFIG_SAMPLING_FREQUENCY_192000;
- case BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000:
- return CONFIG_SAMPLING_FREQUENCY_384000;
- }
- }
return CONFIG_SAMPLING_FREQUENCY_UNKNOWN;
}
}
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcast.java b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
index 91bd81d339..4c036f9541 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcast.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
@@ -382,7 +382,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
service.registerLeBroadcastCallback(mCallback, mAttributionSource);
}
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
@@ -428,10 +428,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
if (service != null) {
service.unregisterLeBroadcastCallback(mCallback, mAttributionSource);
}
- } catch (IllegalStateException e) {
+ } catch (RemoteException | IllegalStateException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- } catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
}
}
}
@@ -497,7 +495,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
buildBroadcastSettingsFromMetadata(contentMetadata, broadcastCode),
mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -528,7 +526,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
service.startBroadcast(broadcastSettings, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -568,7 +566,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
buildBroadcastSettingsFromMetadata(contentMetadata, null),
mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -605,7 +603,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
service.updateBroadcast(broadcastId, broadcastSettings, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -638,7 +636,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
service.stopBroadcast(broadcastId, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -663,7 +661,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
return service.isPlaying(broadcastId, mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return false;
@@ -688,7 +686,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
return service.getAllBroadcastMetadata(mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return Collections.emptyList();
@@ -711,7 +709,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
return service.getMaximumNumberOfBroadcasts();
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return 1;
@@ -734,7 +732,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
return service.getMaximumStreamsPerBroadcast();
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return 1;
@@ -760,7 +758,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
try {
return service.getMaximumSubgroupsPerBroadcast();
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
return 1;
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
index 718dd3a716..ecebdf85a1 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
@@ -484,11 +484,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.action.CONNECTION_STATE_CHANGED";
@@ -577,14 +573,9 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@Override
- @BluetoothProfile.BtProfileState
- public int getConnectionState(@NonNull BluetoothDevice sink) {
+ public @BluetoothProfile.BtProfileState int getConnectionState(@NonNull BluetoothDevice sink) {
log("getConnectionState(" + sink + ")");
Objects.requireNonNull(sink, "sink cannot be null");
final IBluetoothLeBroadcastAssistant service = getService();
@@ -609,11 +600,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@Override
@NonNull
public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
@@ -641,11 +628,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@Override
public @NonNull List<BluetoothDevice> getConnectedDevices() {
log("getConnectedDevices()");
@@ -679,11 +662,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
log("setConnectionPolicy()");
@@ -719,11 +698,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
log("getConnectionPolicy()");
Objects.requireNonNull(device, "device cannot be null");
@@ -758,11 +733,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void registerCallback(
@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) {
Objects.requireNonNull(executor, "executor cannot be null");
@@ -785,7 +756,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
service.registerCallback(mCallback, mAttributionSource);
}
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
@@ -812,11 +783,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void unregisterCallback(@NonNull Callback callback) {
Objects.requireNonNull(callback, "callback cannot be null");
log("unregisterCallback");
@@ -834,7 +801,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
service.unregisterCallback(mCallback, mAttributionSource);
}
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
}
@@ -873,11 +840,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@SystemApi
@RequiresBluetoothScanPermission
@RequiresBluetoothLocationPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_SCAN,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_SCAN, BLUETOOTH_PRIVILEGED})
public void startSearchingForSources(@NonNull List<ScanFilter> filters) {
log("searchForBroadcastSources");
Objects.requireNonNull(filters, "filters can be empty, but not null");
@@ -916,11 +879,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothScanPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_SCAN,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_SCAN, BLUETOOTH_PRIVILEGED})
public void stopSearchingForSources() {
log("stopSearchingForSources:");
if (mCallback == null) {
@@ -954,11 +913,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothScanPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_SCAN,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_SCAN, BLUETOOTH_PRIVILEGED})
public boolean isSearchInProgress() {
log("stopSearchingForSources:");
final IBluetoothLeBroadcastAssistant service = getService();
@@ -1035,11 +990,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void addSource(
@NonNull BluetoothDevice sink,
@NonNull BluetoothLeBroadcastMetadata sourceMetadata,
@@ -1115,11 +1066,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void modifySource(
@NonNull BluetoothDevice sink,
int sourceId,
@@ -1174,11 +1121,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void removeSource(@NonNull BluetoothDevice sink, int sourceId) {
log("removeBroadcastSource: " + sourceId + " from " + sink);
Objects.requireNonNull(sink, "sink cannot be null");
@@ -1216,11 +1159,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@NonNull
public List<BluetoothLeBroadcastReceiveState> getAllSources(@NonNull BluetoothDevice sink) {
log("getAllSources()");
@@ -1251,11 +1190,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getMaximumSourceCapacity(@NonNull BluetoothDevice sink) {
Objects.requireNonNull(sink, "sink cannot be null");
final IBluetoothLeBroadcastAssistant service = getService();
diff --git a/framework/java/android/bluetooth/BluetoothMapClient.java b/framework/java/android/bluetooth/BluetoothMapClient.java
index ab7fca2aba..7b4feeaf6f 100644
--- a/framework/java/android/bluetooth/BluetoothMapClient.java
+++ b/framework/java/android/bluetooth/BluetoothMapClient.java
@@ -80,11 +80,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
@SystemApi
@SuppressLint("ActionValue")
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.mapmce.profile.action.CONNECTION_STATE_CHANGED";
@@ -281,11 +277,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean connect(BluetoothDevice device) {
if (DBG) Log.d(TAG, "connect(" + device + ")" + "for MAPS MCE");
final IBluetoothMapClient service = getService();
@@ -310,11 +302,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean disconnect(BluetoothDevice device) {
if (DBG) Log.d(TAG, "disconnect(" + device + ")");
final IBluetoothMapClient service = getService();
@@ -339,11 +327,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @NonNull List<BluetoothDevice> getConnectedDevices() {
if (DBG) Log.d(TAG, "getConnectedDevices()");
final IBluetoothMapClient service = getService();
@@ -356,7 +340,6 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
service.getConnectedDevices(mAttributionSource), mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -370,11 +353,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@NonNull
public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
if (DBG) Log.d(TAG, "getDevicesMatchingStates()");
@@ -389,7 +368,6 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -403,11 +381,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @BtProfileState int getConnectionState(@NonNull BluetoothDevice device) {
if (DBG) Log.d(TAG, "getConnectionState(" + device + ")");
final IBluetoothMapClient service = getService();
@@ -419,7 +393,6 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
return service.getConnectionState(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.STATE_DISCONNECTED;
@@ -436,11 +409,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) Log.d(TAG, "setPriority(" + device + ", " + priority + ")");
return setConnectionPolicy(device, BluetoothAdapter.priorityToConnectionPolicy(priority));
@@ -460,11 +429,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
if (DBG) Log.d(TAG, "setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
@@ -480,7 +445,6 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return false;
@@ -497,11 +461,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getPriority(BluetoothDevice device) {
if (VDBG) Log.d(TAG, "getPriority(" + device + ")");
return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
@@ -519,11 +479,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
if (VDBG) Log.d(TAG, "getConnectionPolicy(" + device + ")");
final IBluetoothMapClient service = getService();
@@ -535,7 +491,6 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
return service.getConnectionPolicy(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
@@ -557,11 +512,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- SEND_SMS,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, SEND_SMS})
public boolean sendMessage(
@NonNull BluetoothDevice device,
@NonNull Collection<Uri> contacts,
@@ -592,11 +543,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- SEND_SMS,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, SEND_SMS})
public boolean sendMessage(
BluetoothDevice device,
Uri[] contacts,
diff --git a/framework/java/android/bluetooth/BluetoothPbapClient.java b/framework/java/android/bluetooth/BluetoothPbapClient.java
index 400547dc70..38d984aa75 100644
--- a/framework/java/android/bluetooth/BluetoothPbapClient.java
+++ b/framework/java/android/bluetooth/BluetoothPbapClient.java
@@ -71,11 +71,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
@SystemApi
@SuppressLint("ActionValue")
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.pbapclient.profile.action.CONNECTION_STATE_CHANGED";
@@ -174,11 +170,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean connect(BluetoothDevice device) {
if (DBG) {
log("connect(" + device + ") for PBAP Client.");
@@ -205,11 +197,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean disconnect(BluetoothDevice device) {
if (DBG) {
log("disconnect(" + device + ")" + new Exception());
@@ -236,11 +224,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @NonNull List<BluetoothDevice> getConnectedDevices() {
if (DBG) {
log("getConnectedDevices()");
@@ -255,7 +239,6 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
service.getConnectedDevices(mAttributionSource), mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -269,11 +252,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@NonNull
public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
if (DBG) {
@@ -290,7 +269,6 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return Collections.emptyList();
@@ -304,11 +282,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
@SystemApi
@Override
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @BtProfileState int getConnectionState(@NonNull BluetoothDevice device) {
if (DBG) {
log("getConnectionState(" + device + ")");
@@ -322,7 +296,6 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
return service.getConnectionState(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.STATE_DISCONNECTED;
@@ -351,11 +324,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
return setConnectionPolicy(device, BluetoothAdapter.priorityToConnectionPolicy(priority));
@@ -375,11 +344,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
if (DBG) {
@@ -397,7 +362,6 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return false;
@@ -414,11 +378,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
@@ -436,11 +396,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
if (VDBG) {
log("getConnectionPolicy(" + device + ")");
@@ -454,7 +410,6 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl
return service.getConnectionPolicy(device, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
diff --git a/framework/java/android/bluetooth/BluetoothSap.java b/framework/java/android/bluetooth/BluetoothSap.java
index 7e938ffa93..4d3e2f2416 100644
--- a/framework/java/android/bluetooth/BluetoothSap.java
+++ b/framework/java/android/bluetooth/BluetoothSap.java
@@ -437,11 +437,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
return setConnectionPolicy(device, BluetoothAdapter.priorityToConnectionPolicy(priority));
@@ -462,11 +458,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
@@ -499,11 +491,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
* @hide
*/
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
@@ -522,11 +510,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
*/
@SystemApi
@RequiresBluetoothConnectPermission
- @RequiresPermission(
- allOf = {
- BLUETOOTH_CONNECT,
- BLUETOOTH_PRIVILEGED,
- })
+ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
if (VDBG) log("getConnectionPolicy(" + device + ")");
Objects.requireNonNull(device, "BluetoothDevice cannot be null");
diff --git a/framework/java/android/bluetooth/BluetoothVolumeControl.java b/framework/java/android/bluetooth/BluetoothVolumeControl.java
index 6fe23e3917..a27992a3ca 100644
--- a/framework/java/android/bluetooth/BluetoothVolumeControl.java
+++ b/framework/java/android/bluetooth/BluetoothVolumeControl.java
@@ -464,7 +464,6 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
} catch (RemoteException e) {
mCallbackExecutorMap.remove(callback);
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
}
}
}
@@ -507,10 +506,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
if (service != null) {
service.unregisterCallback(mCallback, mAttributionSource);
}
- } catch (RemoteException e) {
- Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- throw e.rethrowAsRuntimeException();
- } catch (IllegalStateException e) {
+ } catch (IllegalStateException | RemoteException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
}
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementManager.java b/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
index 53dbfd93db..75ef152ef6 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
@@ -153,8 +153,9 @@ public final class DistanceMeasurementManager {
gatt.startDistanceMeasurement(mUuid, params, mCallbackWrapper, mAttributionSource);
return cancellationSignal;
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
+ return null;
}
/**
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementSession.java b/framework/java/android/bluetooth/le/DistanceMeasurementSession.java
index 927a1487ea..ee433a8e37 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementSession.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementSession.java
@@ -19,6 +19,8 @@ package android.bluetooth.le;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
@@ -31,10 +33,10 @@ import android.content.AttributionSource;
import android.os.Binder;
import android.os.ParcelUuid;
import android.os.RemoteException;
+import android.util.Log;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Objects;
import java.util.concurrent.Executor;
/**
@@ -83,16 +85,12 @@ public final class DistanceMeasurementSession {
Executor executor,
AttributionSource attributionSource,
Callback callback) {
- Objects.requireNonNull(gatt, "gatt is null");
- Objects.requireNonNull(params, "params is null");
- Objects.requireNonNull(executor, "executor is null");
- Objects.requireNonNull(callback, "callback is null");
- mGatt = gatt;
+ mGatt = requireNonNull(gatt);
+ mDistanceMeasurementParams = requireNonNull(params);
+ mExecutor = requireNonNull(executor);
+ mCallback = requireNonNull(callback);
mUuid = uuid;
- mDistanceMeasurementParams = params;
- mExecutor = executor;
mAttributionSource = attributionSource;
- mCallback = callback;
}
/**
@@ -112,7 +110,8 @@ public final class DistanceMeasurementSession {
mDistanceMeasurementParams.getMethodId(),
mAttributionSource);
} catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+ return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
}
}
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 4dd5a8657a..638879e1e4 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -5297,10 +5297,6 @@ public:
}
void notifyGroupStreamStatus(int group_id, GroupStreamStatus groupStreamStatus) {
- if (!com::android::bluetooth::flags::leaudio_callback_on_group_stream_status()) {
- return;
- }
-
GroupStreamStatus newGroupStreamStatus = GroupStreamStatus::IDLE;
if (groupStreamStatus == GroupStreamStatus::STREAMING) {
newGroupStreamStatus = GroupStreamStatus::STREAMING;
diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc
index ab6b9bbfdb..3feb4738b2 100644
--- a/system/bta/le_audio/le_audio_client_test.cc
+++ b/system/bta/le_audio/le_audio_client_test.cc
@@ -883,6 +883,14 @@ protected:
for (LeAudioDevice* device = group->GetFirstDevice(); device != nullptr;
device = group->GetNextDevice(device)) {
+ if (!group->cig.AssignCisIds(device)) {
+ continue;
+ }
+
+ if (group->cig.GetState() == types::CigState::CREATED) {
+ group->AssignCisConnHandlesToAses(device);
+ }
+
for (auto& ase : device->ases_) {
ase.cis_state = types::CisState::IDLE;
ase.data_path_state = types::DataPathState::IDLE;
@@ -11085,7 +11093,6 @@ TEST_F(UnicastTest, DisconnectAclBeforeGettingReadResponses) {
}
TEST_F(UnicastTest, GroupStreamStatus) {
- com::android::bluetooth::flags::provider_->leaudio_callback_on_group_stream_status(true);
int group_id = bluetooth::groups::kGroupUnknown;
InSequence s;
@@ -11172,8 +11179,6 @@ TEST_F(UnicastTest, GroupStreamStatus) {
}
TEST_F(UnicastTest, GroupStreamStatusManyGroups) {
- com::android::bluetooth::flags::provider_->leaudio_callback_on_group_stream_status(true);
-
uint8_t group_size = 2;
int group_id_1 = 1;
int group_id_2 = 2;
@@ -11253,8 +11258,6 @@ TEST_F(UnicastTest, GroupStreamStatusManyGroups) {
}
TEST_F(UnicastTest, GroupStreamStatusResendAfterRemove) {
- com::android::bluetooth::flags::provider_->leaudio_callback_on_group_stream_status(true);
-
uint8_t group_size = 2;
int group_id = 1;
diff --git a/system/gd/hci/distance_measurement_manager.cc b/system/gd/hci/distance_measurement_manager.cc
index c48ba7db10..cba5ad780e 100644
--- a/system/gd/hci/distance_measurement_manager.cc
+++ b/system/gd/hci/distance_measurement_manager.cc
@@ -139,8 +139,6 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback {
vendor_specific_reply.size());
if (cs_trackers_.find(connection_handle) == cs_trackers_.end()) {
log::error("Can't find CS tracker for connection_handle {}", connection_handle);
- distance_measurement_callbacks_->OnDistanceMeasurementStartFail(
- cs_trackers_[connection_handle].address, REASON_INTERNAL_ERROR, METHOD_CS);
return;
}
@@ -157,6 +155,10 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback {
void OnOpenFailed(uint16_t connection_handle) {
log::info("connection_handle:0x{:04x}", connection_handle);
+ if (cs_trackers_.find(connection_handle) == cs_trackers_.end()) {
+ log::error("Can't find CS tracker for connection_handle {}", connection_handle);
+ return;
+ }
distance_measurement_callbacks_->OnDistanceMeasurementStartFail(
cs_trackers_[connection_handle].address, REASON_INTERNAL_ERROR, METHOD_CS);
}
@@ -165,8 +167,6 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback {
log::info("connection_handle:0x{:04x}, success:{}", connection_handle, success);
if (cs_trackers_.find(connection_handle) == cs_trackers_.end()) {
log::error("Can't find CS tracker for connection_handle {}", connection_handle);
- distance_measurement_callbacks_->OnDistanceMeasurementStartFail(
- cs_trackers_[connection_handle].address, REASON_INTERNAL_ERROR, METHOD_CS);
return;
}
distance_measurement_callbacks_->OnHandleVendorSpecificReplyComplete(
diff --git a/system/stack/smp/smp_act.cc b/system/stack/smp/smp_act.cc
index e297afa5e4..655a2061e5 100644
--- a/system/stack/smp/smp_act.cc
+++ b/system/stack/smp/smp_act.cc
@@ -681,17 +681,14 @@ void smp_proc_rand(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
return;
}
- if (com::android::bluetooth::flags::fix_le_pairing_passkey_entry_bypass()) {
- if (!((p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) &&
- (p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT)) &&
- !(p_cb->flags & SMP_PAIR_FLAGS_CMD_CONFIRM_SENT)) {
- // in legacy pairing, the peer should send its rand after
- // we send our confirm
- tSMP_INT_DATA smp_int_data{};
- smp_int_data.status = SMP_INVALID_PARAMETERS;
- smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data);
- return;
- }
+ if (!((p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) && (p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT)) &&
+ !(p_cb->flags & SMP_PAIR_FLAGS_CMD_CONFIRM_SENT)) {
+ // in legacy pairing, the peer should send its rand after
+ // we send our confirm
+ tSMP_INT_DATA smp_int_data{};
+ smp_int_data.status = SMP_INVALID_PARAMETERS;
+ smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data);
+ return;
}
/* save the SRand for comparison */