diff options
-rw-r--r-- | OWNERS | 1 | ||||
-rw-r--r-- | android/BluetoothLegacyMigration/OWNERS | 1 | ||||
-rw-r--r-- | android/apishim/OWNERS | 1 | ||||
-rw-r--r-- | android/app/OWNERS | 1 | ||||
-rw-r--r-- | android/pandora/OWNERS | 1 | ||||
-rw-r--r-- | android/pandora/test/OWNERS | 1 | ||||
-rw-r--r-- | flags/hid.aconfig | 10 | ||||
-rw-r--r-- | framework/OWNERS | 1 | ||||
-rw-r--r-- | framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java | 54 | ||||
-rw-r--r-- | pandora/OWNERS | 1 | ||||
-rw-r--r-- | service/OWNERS | 1 | ||||
-rw-r--r-- | system/bta/dm/bta_dm_disc.cc | 31 | ||||
-rw-r--r-- | system/bta/le_audio/le_audio_client_test.cc | 4 | ||||
-rw-r--r-- | system/bta/le_audio/le_audio_utils.cc | 12 | ||||
-rw-r--r-- | system/gd/rust/linux/client/src/command_handler.rs | 8 | ||||
-rw-r--r-- | system/gd/rust/linux/client/src/dbus_iface.rs | 4 | ||||
-rw-r--r-- | system/gd/rust/linux/mgmt/Cargo.toml | 2 | ||||
-rw-r--r-- | system/gd/rust/linux/service/src/iface_bluetooth.rs | 4 | ||||
-rw-r--r-- | system/gd/rust/linux/stack/src/bluetooth.rs | 24 | ||||
-rw-r--r-- | tools/OWNERS | 1 |
20 files changed, 102 insertions, 61 deletions
@@ -3,7 +3,6 @@ # Project owners girardier@google.com #{LAST_RESORT_SUGGESTION} muhammadfalam@google.com #{LAST_RESORT_SUGGESTION} -sattiraju@google.com #{LAST_RESORT_SUGGESTION} siyuanh@google.com #{LAST_RESORT_SUGGESTION} sungsoo@google.com #{LAST_RESORT_SUGGESTION} diff --git a/android/BluetoothLegacyMigration/OWNERS b/android/BluetoothLegacyMigration/OWNERS index fad553d703..66467c7b3e 100644 --- a/android/BluetoothLegacyMigration/OWNERS +++ b/android/BluetoothLegacyMigration/OWNERS @@ -1,6 +1,5 @@ # Reviewers for /android/BluetoothLegacyMigration eruffieux@google.com -sattiraju@google.com siyuanh@google.com wescande@google.com diff --git a/android/apishim/OWNERS b/android/apishim/OWNERS index 231e3b66ef..a70b577d30 100644 --- a/android/apishim/OWNERS +++ b/android/apishim/OWNERS @@ -4,6 +4,5 @@ cmanton@google.com eruffieux@google.com jpawlowski@google.com mylesgw@google.com -sattiraju@google.com siyuanh@google.com wescande@google.com
\ No newline at end of file diff --git a/android/app/OWNERS b/android/app/OWNERS index 6fbdf291a3..ee993c40ff 100644 --- a/android/app/OWNERS +++ b/android/app/OWNERS @@ -5,7 +5,6 @@ eruffieux@google.com hallstrom@google.com jpawlowski@google.com mylesgw@google.com -sattiraju@google.com siyuanh@google.com wescande@google.com yuyangh@google.com diff --git a/android/pandora/OWNERS b/android/pandora/OWNERS index a188b6cbc3..792fa63ca0 100644 --- a/android/pandora/OWNERS +++ b/android/pandora/OWNERS @@ -1,5 +1,4 @@ # Bug component: 1099313 girardier@google.com licorne@google.com -uael@google.com charliebout@google.com diff --git a/android/pandora/test/OWNERS b/android/pandora/test/OWNERS index 9b396a0698..792fa63ca0 100644 --- a/android/pandora/test/OWNERS +++ b/android/pandora/test/OWNERS @@ -2,4 +2,3 @@ girardier@google.com licorne@google.com charliebout@google.com -uael@google.com diff --git a/flags/hid.aconfig b/flags/hid.aconfig index 5869ff51c7..6f8f8be4c6 100644 --- a/flags/hid.aconfig +++ b/flags/hid.aconfig @@ -25,3 +25,13 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "save_initial_hid_connection_policy" + namespace: "bluetooth" + description: "Save HID connection policy on initial successful connection" + bug: "335904609" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/framework/OWNERS b/framework/OWNERS index fdf7a66c29..de66227202 100644 --- a/framework/OWNERS +++ b/framework/OWNERS @@ -1,4 +1,3 @@ hallstrom@google.com -sattiraju@google.com siyuanh@google.com wescande@google.com diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java index 4c820b68d3..b0fa26c025 100644 --- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java +++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java @@ -307,6 +307,54 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable { out.writeInt(mMaxOctetsPerFrame); } + private String sampleRateToString(@SampleRate int sampleRateBit) { + switch (sampleRateBit) { + case SAMPLE_RATE_NONE: + return "None"; + case SAMPLE_RATE_8000: + return "8 kHz"; + case SAMPLE_RATE_11025: + return "11.025 kHz"; + case SAMPLE_RATE_16000: + return "16 kHz"; + case SAMPLE_RATE_22050: + return "22.05 kHz"; + case SAMPLE_RATE_24000: + return "24 kHz"; + case SAMPLE_RATE_32000: + return "32 kHz"; + case SAMPLE_RATE_44100: + return "44.1 kHz"; + case SAMPLE_RATE_48000: + return "48 kHz"; + case SAMPLE_RATE_88200: + return "88.2 kHz"; + case SAMPLE_RATE_96000: + return "96 kHz"; + case SAMPLE_RATE_176400: + return "176.4 kHz"; + case SAMPLE_RATE_192000: + return "192 kHz"; + case SAMPLE_RATE_384000: + return "384 kHz"; + default: + return "Unknown bit " + sampleRateBit; + } + } + + private String frameDurationToString(@FrameDuration int frameDurationBit) { + switch (frameDurationBit) { + case FRAME_DURATION_NONE: + return "None"; + case FRAME_DURATION_7500: + return "7.5 ms"; + case FRAME_DURATION_10000: + return "10 ms"; + default: + return "Unknown bit " + frameDurationBit; + } + } + @Override public String toString() { return "{codecName:" @@ -316,13 +364,13 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable { + ",mCodecPriority:" + mCodecPriority + ",mSampleRate:" - + mSampleRate + + sampleRateToString(mSampleRate) + ",mBitsPerSample:" + mBitsPerSample - + ",mChannelCount:" + + ",mChannelCountBitMask:" + mChannelCount + ",mFrameDuration:" - + mFrameDuration + + frameDurationToString(mFrameDuration) + ",mOctetsPerFrame:" + mOctetsPerFrame + ",mMinOctetsPerFrame:" diff --git a/pandora/OWNERS b/pandora/OWNERS index 610b34604a..0a149b65a0 100644 --- a/pandora/OWNERS +++ b/pandora/OWNERS @@ -1,5 +1,4 @@ # Project owners girardier@google.com licorne@google.com -uael@google.com charliebout@google.com diff --git a/service/OWNERS b/service/OWNERS index e6ac9a0c3f..5b3f4bad26 100644 --- a/service/OWNERS +++ b/service/OWNERS @@ -1,2 +1 @@ -mylesgw@google.com wescande@google.com diff --git a/system/bta/dm/bta_dm_disc.cc b/system/bta/dm/bta_dm_disc.cc index a86b3d5e04..7fc5e02abe 100644 --- a/system/bta/dm/bta_dm_disc.cc +++ b/system/bta/dm/bta_dm_disc.cc @@ -796,12 +796,11 @@ static void bta_dm_find_services(const RawAddress& bd_addr) { /* no more services to be discovered */ if (bta_dm_discovery_cb.service_index >= BTA_MAX_SERVICE_ID) { - auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); - auto& disc_result = std::get<tBTA_DM_SVC_RES>(*msg); - disc_result.services = bta_dm_discovery_cb.services_found; - disc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; - - post_disc_evt(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); + bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, + std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ + .bd_addr = bta_dm_discovery_cb.peer_bdaddr, + .services = bta_dm_discovery_cb.services_found, + .result = BTA_SUCCESS})); } } @@ -967,19 +966,17 @@ static void gatt_close_timer_cb(void*) { * ******************************************************************************/ static void bta_dm_gatt_disc_complete(uint16_t conn_id, tGATT_STATUS status) { - log::verbose("conn_id = {}", conn_id); - - auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); - auto& svc_result = std::get<tBTA_DM_SVC_RES>(*msg); + log::verbose("conn_id = {}, service found: 0x{:08x}", conn_id, + bta_dm_discovery_cb.services_found); /* no more services to be discovered */ - svc_result.result = (status == GATT_SUCCESS) ? BTA_SUCCESS : BTA_FAILURE; - log::verbose("service found: 0x{:08x}", bta_dm_discovery_cb.services_found); - svc_result.services = bta_dm_discovery_cb.services_found; - svc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; - svc_result.device_type |= BT_DEVICE_TYPE_BLE; - - bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); + bta_dm_disc_sm_execute( + BTA_DM_DISCOVERY_RESULT_EVT, + std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ + .bd_addr = bta_dm_discovery_cb.peer_bdaddr, + .services = bta_dm_discovery_cb.services_found, + .device_type = BT_DEVICE_TYPE_BLE, + .result = (status == GATT_SUCCESS) ? BTA_SUCCESS : BTA_FAILURE})); if (conn_id != GATT_INVALID_CONN_ID) { bta_dm_discovery_cb.pending_close_bda = bta_dm_discovery_cb.peer_bdaddr; diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc index 95d0dba6b9..e1e08894a0 100644 --- a/system/bta/le_audio/le_audio_client_test.cc +++ b/system/bta/le_audio/le_audio_client_test.cc @@ -4775,7 +4775,7 @@ TEST_F_WITH_FLAGS(UnicastTest, GroupSetActive_CurrentCodecSentOfActive, .codec_type = LE_AUDIO_CODEC_INDEX_SOURCE_LC3, .sample_rate = LE_AUDIO_SAMPLE_RATE_INDEX_48000HZ, .bits_per_sample = LE_AUDIO_BITS_PER_SAMPLE_INDEX_16, - .channel_count = LE_AUDIO_CHANNEL_COUNT_INDEX_2, + .channel_count = LE_AUDIO_CHANNEL_COUNT_INDEX_1, .frame_duration = LE_AUDIO_FRAME_DURATION_INDEX_10000US, .octets_per_frame = 120}; @@ -6288,7 +6288,7 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { .codec_type = LE_AUDIO_CODEC_INDEX_SOURCE_LC3, .sample_rate = LE_AUDIO_SAMPLE_RATE_INDEX_16000HZ, .bits_per_sample = LE_AUDIO_BITS_PER_SAMPLE_INDEX_16, - .channel_count = LE_AUDIO_CHANNEL_COUNT_INDEX_2, + .channel_count = LE_AUDIO_CHANNEL_COUNT_INDEX_1, .frame_duration = LE_AUDIO_FRAME_DURATION_INDEX_10000US, .octets_per_frame = 40}; diff --git a/system/bta/le_audio/le_audio_utils.cc b/system/bta/le_audio/le_audio_utils.cc index 007287efa5..5428354a70 100644 --- a/system/bta/le_audio/le_audio_utils.cc +++ b/system/bta/le_audio/le_audio_utils.cc @@ -342,14 +342,8 @@ void fillStreamParamsToBtLeAudioCodecConfig( out_config.frame_duration = translateToBtLeAudioCodecConfigFrameDuration(config.GetDataIntervalUs()); out_config.octets_per_frame = config.GetOctectsPerFrame(); - - int num_of_channels = 0; - for (auto const& c : confs) { - num_of_channels += c.codec.GetChannelCountPerIsoStream(); - } - - out_config.channel_count = - translateToBtLeAudioCodecConfigChannelCount(num_of_channels); + out_config.channel_count = translateToBtLeAudioCodecConfigChannelCount( + config.GetChannelCountPerIsoStream()); } static bool is_known_codec(const types::LeAudioCodecId& codec_id) { @@ -401,6 +395,8 @@ static void fillRemotePacsCapabitiliesToBtLeAudioCodecConfig( if (!capa.IsAudioChannelCountsSupported(chan_bit)) continue; bluetooth::le_audio::btle_audio_codec_config_t config = { + .codec_type = utils::translateBluetoothCodecFormatToCodecType( + record.codec_id.coding_format), .sample_rate = utils::translateToBtLeAudioCodecConfigSampleRate( types::LeAudioCoreCodecConfig::GetSamplingFrequencyHz( freq_bit)), diff --git a/system/gd/rust/linux/client/src/command_handler.rs b/system/gd/rust/linux/client/src/command_handler.rs index cad6c1073f..d200555a39 100644 --- a/system/gd/rust/linux/client/src/command_handler.rs +++ b/system/gd/rust/linux/client/src/command_handler.rs @@ -783,14 +783,14 @@ impl CommandHandler { .into()); } - let success = self + let status = self .lock_context() .adapter_dbus .as_mut() .unwrap() .create_bond(device.clone(), BtTransport::Auto); - if success { + if status == BtStatus::Success { self.lock_context().bonding_attempt = Some(device); } } @@ -832,14 +832,14 @@ impl CommandHandler { name: String::from("Classic Device"), }; - let success = self + let status = self .lock_context() .adapter_dbus .as_mut() .unwrap() .connect_all_enabled_profiles(device.clone()); - if success { + if status == BtStatus::Success { println!("Connecting to {}", &device.address); } else { println!("Can't connect to {}", &device.address); diff --git a/system/gd/rust/linux/client/src/dbus_iface.rs b/system/gd/rust/linux/client/src/dbus_iface.rs index fb392a3795..2283fabae1 100644 --- a/system/gd/rust/linux/client/src/dbus_iface.rs +++ b/system/gd/rust/linux/client/src/dbus_iface.rs @@ -846,7 +846,7 @@ impl IBluetooth for BluetoothDBus { } #[dbus_method("CreateBond")] - fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> bool { + fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus { dbus_generated!() } @@ -981,7 +981,7 @@ impl IBluetooth for BluetoothDBus { } #[dbus_method("ConnectAllEnabledProfiles")] - fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool { + fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus { dbus_generated!() } diff --git a/system/gd/rust/linux/mgmt/Cargo.toml b/system/gd/rust/linux/mgmt/Cargo.toml index 092235c2e0..7306393ae2 100644 --- a/system/gd/rust/linux/mgmt/Cargo.toml +++ b/system/gd/rust/linux/mgmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "manager_service" -version = "0.3.0" +version = "0.4.0" edition = "2018" build = "build.rs" diff --git a/system/gd/rust/linux/service/src/iface_bluetooth.rs b/system/gd/rust/linux/service/src/iface_bluetooth.rs index d1783e38cd..d84f5e20a0 100644 --- a/system/gd/rust/linux/service/src/iface_bluetooth.rs +++ b/system/gd/rust/linux/service/src/iface_bluetooth.rs @@ -557,7 +557,7 @@ impl IBluetooth for IBluetoothDBus { } #[dbus_method("CreateBond")] - fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> bool { + fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus { dbus_generated!() } @@ -692,7 +692,7 @@ impl IBluetooth for IBluetoothDBus { } #[dbus_method("ConnectAllEnabledProfiles")] - fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool { + fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus { dbus_generated!() } diff --git a/system/gd/rust/linux/stack/src/bluetooth.rs b/system/gd/rust/linux/stack/src/bluetooth.rs index 5d34bba8b7..e219cc66da 100644 --- a/system/gd/rust/linux/stack/src/bluetooth.rs +++ b/system/gd/rust/linux/stack/src/bluetooth.rs @@ -156,7 +156,7 @@ pub trait IBluetooth { fn get_discovery_end_millis(&self) -> u64; /// Initiates pairing to a remote device. Triggers connection if not already started. - fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> bool; + fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus; /// Cancels any pending bond attempt on given device. fn cancel_bond_process(&mut self, device: BluetoothDevice) -> bool; @@ -237,7 +237,7 @@ pub trait IBluetooth { fn remove_sdp_record(&self, handle: i32) -> bool; /// Connect all profiles supported by device and enabled on adapter. - fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool; + fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus; /// Disconnect all profiles supported by device and enabled on adapter. /// Note that it includes all custom profiles enabled by the users e.g. through SocketManager or @@ -2279,7 +2279,7 @@ impl IBluetooth for Bluetooth { } } - fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> bool { + fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus { let addr = RawAddress::from_string(device.address.clone()); if addr.is_none() { @@ -2292,7 +2292,7 @@ impl IBluetooth for Bluetooth { 0, ); warn!("Can't create bond. Address {} is not valid", device.address); - return false; + return BtStatus::InvalidParam; } let address = addr.unwrap(); @@ -2308,7 +2308,7 @@ impl IBluetooth for Bluetooth { DisplayAddress(&address), DisplayAddress(&active_address) ); - return false; + return BtStatus::Busy; } // There could be a race between bond complete and bond cancel, which makes @@ -2335,7 +2335,7 @@ impl IBluetooth for Bluetooth { BtBondState::NotBonded, 0, ); - return false; + return BtStatus::from(status as u32); } // Creating bond automatically create ACL connection as well, therefore also log metrics @@ -2347,7 +2347,7 @@ impl IBluetooth for Bluetooth { metrics::acl_connect_attempt(address, BtAclState::Connected); } - return true; + return BtStatus::Success; } fn cancel_bond_process(&mut self, device: BluetoothDevice) -> bool { @@ -2691,17 +2691,17 @@ impl IBluetooth for Bluetooth { self.sdp.as_ref().unwrap().remove_sdp_record(handle) == BtStatus::Success } - fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool { + fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus { // Profile init must be complete before this api is callable if !self.profiles_ready { - return false; + return BtStatus::NotReady; } let mut addr = match RawAddress::from_string(device.address.clone()) { Some(v) => v, None => { warn!("Can't connect profiles on invalid address [{}]", &device.address); - return false; + return BtStatus::InvalidParam; } }; @@ -2773,7 +2773,7 @@ impl IBluetooth for Bluetooth { let transport = match self.get_remote_device_if_found(&device.address) { Some(context) => context.acl_reported_transport, - None => return false, + None => return BtStatus::RemoteDeviceDown, }; let device_to_send = device.clone(); let transport = match self.get_remote_type(device.clone()) { @@ -2821,7 +2821,7 @@ impl IBluetooth for Bluetooth { self.resume_discovery(); } - return true; + return BtStatus::Success; } fn disconnect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool { diff --git a/tools/OWNERS b/tools/OWNERS index 1979131142..ee61736b29 100644 --- a/tools/OWNERS +++ b/tools/OWNERS @@ -4,5 +4,4 @@ cmanton@google.com jpawlowski@google.com licorne@google.com mylesgw@google.com -sattiraju@google.com siyuanh@google.com |