diff options
113 files changed, 449 insertions, 262 deletions
@@ -1,6 +1,19 @@ -set noparent +# Bug component: 27441 -girardier@google.com -muhammadfalam@google.com -siyuanh@google.com -okamil@google.com +# Project owners +girardier@google.com #{LAST_RESORT_SUGGESTION} +muhammadfalam@google.com #{LAST_RESORT_SUGGESTION} +siyuanh@google.com #{LAST_RESORT_SUGGESTION} +okamil@google.com #{LAST_RESORT_SUGGESTION} +wescande@google.com #{LAST_RESORT_SUGGESTION} + +# Per-file ownership + +# Build files / test_config / presubmit / preupload / linter file +per-file *.cfg,.cfg,TEST_MAPPING,*.bp,*.xml,.clang-tidy,pyrightconfig.json=file:/OWNERS_build + +# ChromeOS team owns Linux build files +# - build.py is used for Linux build +# - *.gn is for GN build rules +# - Cargo.toml is for Rust build rules +per-file build.py,*.gn,Cargo.toml=file:/OWNERS_chromeos diff --git a/OWNERS_automotive b/OWNERS_automotive new file mode 100644 index 0000000000..20c7ac685b --- /dev/null +++ b/OWNERS_automotive @@ -0,0 +1,3 @@ +# Project owners +cmanton@google.com +salsavage@google.com diff --git a/OWNERS_build b/OWNERS_build new file mode 100644 index 0000000000..5b3f4bad26 --- /dev/null +++ b/OWNERS_build @@ -0,0 +1 @@ +wescande@google.com diff --git a/OWNERS_chromeos b/OWNERS_chromeos new file mode 100644 index 0000000000..075a04e5e3 --- /dev/null +++ b/OWNERS_chromeos @@ -0,0 +1,22 @@ +# Project owners +abhishekpandit@google.com + +# Audio +enshuo@google.com +hychao@google.com +jrwu@google.com +whalechang@google.com + +# General review +michaelfsun@google.com +laikatherine@google.com +yinghsu@google.com +apusaka@google.com +deanliao@google.com +chharry@google.com +melhuishj@google.com +johnlai@google.com +mmandlik@google.com +sarveshkalwit@google.com +howardchung@google.com +jiangzp@google.com diff --git a/OWNERS_content b/OWNERS_content new file mode 100644 index 0000000000..883d5dc782 --- /dev/null +++ b/OWNERS_content @@ -0,0 +1,2 @@ +klhyun@google.com +hdmoon@google.com diff --git a/OWNERS_cs b/OWNERS_cs new file mode 100644 index 0000000000..1cebb11002 --- /dev/null +++ b/OWNERS_cs @@ -0,0 +1,2 @@ +steveliu@google.com +zning@google.com diff --git a/OWNERS_hearingaid b/OWNERS_hearingaid new file mode 100644 index 0000000000..d1c75de900 --- /dev/null +++ b/OWNERS_hearingaid @@ -0,0 +1 @@ +henrichataing@google.com diff --git a/OWNERS_leaudio b/OWNERS_leaudio new file mode 100644 index 0000000000..30db38d799 --- /dev/null +++ b/OWNERS_leaudio @@ -0,0 +1,3 @@ +siyuanh@google.com +jpawlowski@google.com +rongxuan@google.com diff --git a/android/BluetoothLegacyMigration/OWNERS b/android/BluetoothLegacyMigration/OWNERS new file mode 100644 index 0000000000..66467c7b3e --- /dev/null +++ b/android/BluetoothLegacyMigration/OWNERS @@ -0,0 +1,5 @@ +# Reviewers for /android/BluetoothLegacyMigration + +eruffieux@google.com +siyuanh@google.com +wescande@google.com diff --git a/android/ChannelSoundingTestApp/OWNERS b/android/ChannelSoundingTestApp/OWNERS new file mode 100644 index 0000000000..29d6f601cc --- /dev/null +++ b/android/ChannelSoundingTestApp/OWNERS @@ -0,0 +1 @@ +include /OWNERS_cs diff --git a/android/apishim/OWNERS b/android/apishim/OWNERS new file mode 100644 index 0000000000..586d2866f1 --- /dev/null +++ b/android/apishim/OWNERS @@ -0,0 +1,6 @@ +# Reviewers for /android/apishim + +eruffieux@google.com +jpawlowski@google.com +siyuanh@google.com +wescande@google.com diff --git a/android/app/OWNERS b/android/app/OWNERS new file mode 100644 index 0000000000..9edeffc18e --- /dev/null +++ b/android/app/OWNERS @@ -0,0 +1,11 @@ +# Reviewers for /android/app + +bhaktha@google.com +eruffieux@google.com +hallstrom@google.com +henrichataing@google.com +jpawlowski@google.com +okamil@google.com +poahlo@google.com +siyuanh@google.com +wescande@google.com diff --git a/android/app/aidl/android/bluetooth/IBluetoothGatt.aidl b/android/app/aidl/android/bluetooth/IBluetoothGatt.aidl index ed9e6221d3..9b2de3e169 100644 --- a/android/app/aidl/android/bluetooth/IBluetoothGatt.aidl +++ b/android/app/aidl/android/bluetooth/IBluetoothGatt.aidl @@ -81,7 +81,7 @@ interface IBluetoothGatt { void setAdvertisingData(in int advertiserId, in AdvertiseData data, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)") void setScanResponseData(in int advertiserId, in AdvertiseData data, in AttributionSource attributionSource); - @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)") + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADVERTISE,android.Manifest.permission.BLUETOOTH_PRIVILEGED}, conditional=true)") void setAdvertisingParameters(in int advertiserId, in AdvertisingSetParameters parameters, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)") void setPeriodicAdvertisingParameters(in int advertiserId, in PeriodicAdvertisingParameters parameters, in AttributionSource attributionSource); diff --git a/android/app/jni/OWNERS b/android/app/jni/OWNERS new file mode 100644 index 0000000000..826f56b4e0 --- /dev/null +++ b/android/app/jni/OWNERS @@ -0,0 +1,4 @@ +per-file com_android_bluetooth_hearing_aid.cpp=file:/OWNERS_hearingaid +per-file com_android_bluetooth_csip_set_coordinator.cpp=file:/OWNERS_leaudio +per-file com_android_bluetooth_le_audio.cpp=file:/OWNERS_leaudio +per-file com_android_bluetooth_vc.cpp=file:/OWNERS_leaudio diff --git a/android/app/jni/com_android_bluetooth_gatt.cpp b/android/app/jni/com_android_bluetooth_gatt.cpp index fb14f39b96..80e334e844 100644 --- a/android/app/jni/com_android_bluetooth_gatt.cpp +++ b/android/app/jni/com_android_bluetooth_gatt.cpp @@ -247,28 +247,6 @@ void btgattc_register_app_cb(int status, int clientIf, const Uuid& app_uuid) { UUID_PARAMS(app_uuid)); } -void btgattc_scan_result_cb(uint16_t event_type, uint8_t addr_type, RawAddress* bda, - uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid, - int8_t tx_power, int8_t rssi, uint16_t periodic_adv_int, - std::vector<uint8_t> adv_data, RawAddress* original_bda) { - std::shared_lock<std::shared_mutex> lock(callbacks_mutex); - CallbackEnv sCallbackEnv(__func__); - if (!sCallbackEnv.valid() || !mScanCallbacksObj) { - return; - } - - ScopedLocalRef<jstring> address(sCallbackEnv.get(), bdaddr2newjstr(sCallbackEnv.get(), bda)); - ScopedLocalRef<jbyteArray> jb(sCallbackEnv.get(), sCallbackEnv->NewByteArray(adv_data.size())); - sCallbackEnv->SetByteArrayRegion(jb.get(), 0, adv_data.size(), (jbyte*)adv_data.data()); - - ScopedLocalRef<jstring> original_address(sCallbackEnv.get(), - bdaddr2newjstr(sCallbackEnv.get(), original_bda)); - - sCallbackEnv->CallVoidMethod(mScanCallbacksObj, method_onScanResult, event_type, addr_type, - address.get(), primary_phy, secondary_phy, advertising_sid, tx_power, - rssi, periodic_adv_int, jb.get(), original_address.get()); -} - void btgattc_open_cb(int conn_id, int status, int clientIf, const RawAddress& bda) { std::shared_lock<std::shared_mutex> lock(callbacks_mutex); CallbackEnv sCallbackEnv(__func__); @@ -442,65 +420,6 @@ void btgattc_congestion_cb(int conn_id, bool congested) { sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onClientCongestion, conn_id, congested); } -void btgattc_batchscan_reports_cb(int client_if, int status, int report_format, int num_records, - std::vector<uint8_t> data) { - std::shared_lock<std::shared_mutex> lock(callbacks_mutex); - CallbackEnv sCallbackEnv(__func__); - if (!sCallbackEnv.valid() || !mScanCallbacksObj) { - return; - } - ScopedLocalRef<jbyteArray> jb(sCallbackEnv.get(), sCallbackEnv->NewByteArray(data.size())); - sCallbackEnv->SetByteArrayRegion(jb.get(), 0, data.size(), (jbyte*)data.data()); - - sCallbackEnv->CallVoidMethod(mScanCallbacksObj, method_onBatchScanReports, status, client_if, - report_format, num_records, jb.get()); -} - -void btgattc_batchscan_threshold_cb(int client_if) { - std::shared_lock<std::shared_mutex> lock(callbacks_mutex); - CallbackEnv sCallbackEnv(__func__); - if (!sCallbackEnv.valid() || !mScanCallbacksObj) { - return; - } - sCallbackEnv->CallVoidMethod(mScanCallbacksObj, method_onBatchScanThresholdCrossed, client_if); -} - -void btgattc_track_adv_event_cb(btgatt_track_adv_info_t* p_adv_track_info) { - std::shared_lock<std::shared_mutex> lock(callbacks_mutex); - CallbackEnv sCallbackEnv(__func__); - if (!sCallbackEnv.valid() || !mScanCallbacksObj) { - return; - } - - ScopedLocalRef<jstring> address(sCallbackEnv.get(), - bdaddr2newjstr(sCallbackEnv.get(), &p_adv_track_info->bd_addr)); - - ScopedLocalRef<jbyteArray> jb_adv_pkt(sCallbackEnv.get(), - sCallbackEnv->NewByteArray(p_adv_track_info->adv_pkt_len)); - ScopedLocalRef<jbyteArray> jb_scan_rsp( - sCallbackEnv.get(), sCallbackEnv->NewByteArray(p_adv_track_info->scan_rsp_len)); - - sCallbackEnv->SetByteArrayRegion(jb_adv_pkt.get(), 0, p_adv_track_info->adv_pkt_len, - (jbyte*)p_adv_track_info->p_adv_pkt_data); - - sCallbackEnv->SetByteArrayRegion(jb_scan_rsp.get(), 0, p_adv_track_info->scan_rsp_len, - (jbyte*)p_adv_track_info->p_scan_rsp_data); - - ScopedLocalRef<jobject> trackadv_obj( - sCallbackEnv.get(), - sCallbackEnv->CallObjectMethod( - mScanCallbacksObj, method_createOnTrackAdvFoundLostObject, - p_adv_track_info->client_if, p_adv_track_info->adv_pkt_len, jb_adv_pkt.get(), - p_adv_track_info->scan_rsp_len, jb_scan_rsp.get(), p_adv_track_info->filt_index, - p_adv_track_info->advertiser_state, p_adv_track_info->advertiser_info_present, - address.get(), p_adv_track_info->addr_type, p_adv_track_info->tx_power, - p_adv_track_info->rssi_value, p_adv_track_info->time_stamp)); - - if (NULL != trackadv_obj.get()) { - sCallbackEnv->CallVoidMethod(mScanCallbacksObj, method_onTrackAdvFoundLost, trackadv_obj.get()); - } -} - void fillGattDbElementArray(JNIEnv* env, jobject* array, const btgatt_db_element_t* db, int count) { // Because JNI uses a different class loader in the callback context, we // cannot simply get the class. @@ -628,13 +547,6 @@ void btgattc_subrate_change_cb(int conn_id, uint16_t subrate_factor, uint16_t la latency, cont_num, timeout, status); } -static const btgatt_scanner_callbacks_t sGattScannerCallbacks = { - btgattc_scan_result_cb, - btgattc_batchscan_reports_cb, - btgattc_batchscan_threshold_cb, - btgattc_track_adv_event_cb, -}; - static const btgatt_client_callbacks_t sGattClientCallbacks = { btgattc_register_app_cb, btgattc_open_cb, @@ -919,7 +831,6 @@ static const btgatt_callbacks_t sGattCallbacks = { sizeof(btgatt_callbacks_t), &sGattClientCallbacks, &sGattServerCallbacks, - &sGattScannerCallbacks, }; class JniAdvertisingCallbacks : AdvertisingCallbacks { diff --git a/android/app/src/com/android/bluetooth/a2dpsink/OWNERS b/android/app/src/com/android/bluetooth/a2dpsink/OWNERS new file mode 100644 index 0000000000..ecd59038a1 --- /dev/null +++ b/android/app/src/com/android/bluetooth/a2dpsink/OWNERS @@ -0,0 +1 @@ +include /OWNERS_automotive diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS b/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS new file mode 100644 index 0000000000..ecd59038a1 --- /dev/null +++ b/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS @@ -0,0 +1 @@ +include /OWNERS_automotive diff --git a/android/app/src/com/android/bluetooth/bass_client/OWNERS b/android/app/src/com/android/bluetooth/bass_client/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/src/com/android/bluetooth/bass_client/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java index 10f42ddf09..798f9e3a9d 100644 --- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java +++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java @@ -6429,14 +6429,7 @@ public class AdapterService extends Service { long idleTime, long energyUsed, UidTraffic[] data) { - if (Flags.btSystemContextReport()) { - energyInfoCallbackInternal( - status, ctrlState, txTime, rxTime, idleTime, energyUsed, data); - } else if (ctrlState >= BluetoothActivityEnergyInfo.BT_STACK_STATE_INVALID - && ctrlState <= BluetoothActivityEnergyInfo.BT_STACK_STATE_STATE_IDLE) { - energyInfoCallbackInternal( - status, ctrlState, txTime, rxTime, idleTime, energyUsed, data); - } + energyInfoCallbackInternal(status, ctrlState, txTime, rxTime, idleTime, energyUsed, data); Log.v( TAG, "energyInfoCallback()" diff --git a/android/app/src/com/android/bluetooth/content_profiles/OWNERS b/android/app/src/com/android/bluetooth/content_profiles/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/content_profiles/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/csip/OWNERS b/android/app/src/com/android/bluetooth/csip/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/src/com/android/bluetooth/csip/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java index 2a4d513203..ef12680b72 100644 --- a/android/app/src/com/android/bluetooth/gatt/GattService.java +++ b/android/app/src/com/android/bluetooth/gatt/GattService.java @@ -1987,7 +1987,8 @@ public class GattService extends ProfileService { return; } if (parameters.getOwnAddressType() != AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT - || serverIf != 0) { + || serverIf != 0 + || parameters.isDirected()) { this.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null); } mAdvertiseManager.startAdvertisingSet( @@ -2060,7 +2061,12 @@ public class GattService extends ProfileService { mAdvertiseManager.setScanResponseData(advertiserId, data); } - @RequiresPermission(BLUETOOTH_ADVERTISE) + @RequiresPermission( + allOf = { + BLUETOOTH_ADVERTISE, + BLUETOOTH_PRIVILEGED, + }, + conditional = true) void setAdvertisingParameters( int advertiserId, AdvertisingSetParameters parameters, @@ -2069,6 +2075,10 @@ public class GattService extends ProfileService { this, attributionSource, "GattService setAdvertisingParameters")) { return; } + if (parameters.getOwnAddressType() != AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT + || parameters.isDirected()) { + this.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null); + } mAdvertiseManager.setAdvertisingParameters(advertiserId, parameters); } diff --git a/android/app/src/com/android/bluetooth/hearingaid/OWNERS b/android/app/src/com/android/bluetooth/hearingaid/OWNERS new file mode 100644 index 0000000000..bbaa85ddbb --- /dev/null +++ b/android/app/src/com/android/bluetooth/hearingaid/OWNERS @@ -0,0 +1 @@ +include /OWNERS_hearingaid diff --git a/android/app/src/com/android/bluetooth/hfpclient/OWNERS b/android/app/src/com/android/bluetooth/hfpclient/OWNERS new file mode 100644 index 0000000000..ecd59038a1 --- /dev/null +++ b/android/app/src/com/android/bluetooth/hfpclient/OWNERS @@ -0,0 +1 @@ +include /OWNERS_automotive diff --git a/android/app/src/com/android/bluetooth/le_audio/OWNERS b/android/app/src/com/android/bluetooth/le_audio/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/src/com/android/bluetooth/le_audio/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/src/com/android/bluetooth/map/OWNERS b/android/app/src/com/android/bluetooth/map/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/map/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/mapclient/OWNERS b/android/app/src/com/android/bluetooth/mapclient/OWNERS new file mode 100644 index 0000000000..b0b54fc3d2 --- /dev/null +++ b/android/app/src/com/android/bluetooth/mapclient/OWNERS @@ -0,0 +1,2 @@ +include /OWNERS_automotive +include /OWNERS_content diff --git a/android/app/src/com/android/bluetooth/mcp/OWNERS b/android/app/src/com/android/bluetooth/mcp/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/src/com/android/bluetooth/mcp/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/src/com/android/bluetooth/opp/OWNERS b/android/app/src/com/android/bluetooth/opp/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/opp/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/pan/OWNERS b/android/app/src/com/android/bluetooth/pan/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/pan/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/pbap/OWNERS b/android/app/src/com/android/bluetooth/pbap/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/pbap/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/pbapclient/OWNERS b/android/app/src/com/android/bluetooth/pbapclient/OWNERS new file mode 100644 index 0000000000..b0b54fc3d2 --- /dev/null +++ b/android/app/src/com/android/bluetooth/pbapclient/OWNERS @@ -0,0 +1,2 @@ +include /OWNERS_automotive +include /OWNERS_content diff --git a/android/app/src/com/android/bluetooth/sap/OWNERS b/android/app/src/com/android/bluetooth/sap/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/src/com/android/bluetooth/sap/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/src/com/android/bluetooth/vc/OWNERS b/android/app/src/com/android/bluetooth/vc/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/src/com/android/bluetooth/vc/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/tests/OWNERS b/android/app/tests/OWNERS new file mode 100644 index 0000000000..ecd59038a1 --- /dev/null +++ b/android/app/tests/OWNERS @@ -0,0 +1 @@ +include /OWNERS_automotive diff --git a/android/app/tests/unit/Android.bp b/android/app/tests/unit/Android.bp index d1a24d6798..346c57fffa 100644 --- a/android/app/tests/unit/Android.bp +++ b/android/app/tests/unit/Android.bp @@ -58,6 +58,7 @@ java_defaults { "automotive-general-tests", "general-tests", "mts-bluetooth", + "mts-bt", ], instrumentation_for: "Bluetooth", diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS new file mode 100644 index 0000000000..bbaa85ddbb --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS @@ -0,0 +1 @@ +include /OWNERS_hearingaid diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS new file mode 100644 index 0000000000..8f87191393 --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS @@ -0,0 +1 @@ +include /OWNERS_content
\ No newline at end of file diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/leaudio/OWNERS b/android/leaudio/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/android/leaudio/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/android/pandora/OWNERS b/android/pandora/OWNERS new file mode 100644 index 0000000000..c199a82a60 --- /dev/null +++ b/android/pandora/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 1099313 +girardier@google.com diff --git a/android/pandora/gen_cov.py b/android/pandora/gen_cov.py index 85ed6c6a6d..b3d85b32d6 100755 --- a/android/pandora/gen_cov.py +++ b/android/pandora/gen_cov.py @@ -9,8 +9,8 @@ import subprocess import sys import xml.etree.ElementTree as ET -JAVA_UNIT_TESTS = 'test/mts/tools/mts-tradefed/res/config/mts-bluetooth-tests-list-shard-01.xml' -NATIVE_UNIT_TESTS = 'test/mts/tools/mts-tradefed/res/config/mts-bluetooth-tests-list-shard-02.xml' +JAVA_UNIT_TESTS = 'test/mts/tools/mts-tradefed/res/config/mts-bt-tests-list-shard-01.xml' +NATIVE_UNIT_TESTS = 'test/mts/tools/mts-tradefed/res/config/mts-bt-tests-list-shard-02.xml' DO_NOT_RETRY_TESTS = { 'CtsBluetoothTestCases', 'GoogleBluetoothInstrumentationTests', diff --git a/android/pandora/server/Android.bp b/android/pandora/server/Android.bp index 52e9e405a9..83cb971cd3 100644 --- a/android/pandora/server/Android.bp +++ b/android/pandora/server/Android.bp @@ -77,6 +77,9 @@ android_test { "configs/pts_bot_tests_config.json", "configs/pts_bot_tests_config_auto.json", ], - test_suites: ["mts-bluetooth"], + test_suites: [ + "mts-bluetooth", + "mts-bt", + ], min_sdk_version: "Tiramisu", } diff --git a/android/pandora/test/pairing/OWNERS b/android/pandora/test/pairing/OWNERS new file mode 100644 index 0000000000..b430ae987d --- /dev/null +++ b/android/pandora/test/pairing/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 27441 +rwt@google.com diff --git a/apex/OWNERS b/apex/OWNERS new file mode 100644 index 0000000000..f05027c972 --- /dev/null +++ b/apex/OWNERS @@ -0,0 +1,5 @@ +# Reviewers for /apex + +eruffieux@google.com +wescande@google.com + diff --git a/apex/hiddenapi/OWNERS b/apex/hiddenapi/OWNERS new file mode 100644 index 0000000000..ac8a2b627c --- /dev/null +++ b/apex/hiddenapi/OWNERS @@ -0,0 +1,5 @@ +# soong-team@ as the hiddenapi files are tightly coupled with Soong +file:platform/build/soong:/OWNERS + +# compat-team@ for changes to hiddenapi files +file:tools/platform-compat:/OWNERS diff --git a/apex/permissions/OWNERS b/apex/permissions/OWNERS new file mode 100644 index 0000000000..8b8ec67028 --- /dev/null +++ b/apex/permissions/OWNERS @@ -0,0 +1 @@ +per-file *.xml,OWNERS = file:platform/frameworks/base:/data/etc/OWNERS diff --git a/common/OWNERS b/common/OWNERS new file mode 100644 index 0000000000..5b3f4bad26 --- /dev/null +++ b/common/OWNERS @@ -0,0 +1 @@ +wescande@google.com diff --git a/flags/OWNERS b/flags/OWNERS new file mode 100644 index 0000000000..b4f2f7376b --- /dev/null +++ b/flags/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 1387432 +girardier@google.com +wescande@google.com diff --git a/flags/bta_dm.aconfig b/flags/bta_dm.aconfig index e0ed3358b6..f35d562ebf 100644 --- a/flags/bta_dm.aconfig +++ b/flags/bta_dm.aconfig @@ -9,13 +9,6 @@ flag { } flag { - name: "bt_system_context_report" - namespace: "bluetooth" - description: "Report Bluetooth system context through bta_ble_energy_info_cmpl" - bug: "323083457" -} - -flag { name: "bta_dm_discover_both" namespace: "bluetooth" description: "perform both LE and Classic service discovery simulteanously on capable devices" diff --git a/flags/gap.aconfig b/flags/gap.aconfig index 6cf207dc13..0ef4a7aa20 100644 --- a/flags/gap.aconfig +++ b/flags/gap.aconfig @@ -54,16 +54,6 @@ flag { } flag { - name: "ble_check_data_length_on_legacy_advertising" - namespace: "bluetooth" - description: "Add data length checks for legacy advertising" - bug: "329011868" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { name: "scan_record_manufacturer_data_merge" namespace: "bluetooth" description: "If a scan record has multiple datas under same manufacturer id, merge the values" diff --git a/flags/sockets.aconfig b/flags/sockets.aconfig index 5f00813a8b..688d27323c 100644 --- a/flags/sockets.aconfig +++ b/flags/sockets.aconfig @@ -62,3 +62,13 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "fix_buf_len_check_for_first_k_frame" + namespace: "bluetooth" + description: "Fix L2cap buffer length check against MPS for the first k-frame" + bug: "386382446" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/floss/OWNERS b/floss/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/floss/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/floss/pandora/OWNERS b/floss/pandora/OWNERS new file mode 100644 index 0000000000..ca4001b6d4 --- /dev/null +++ b/floss/pandora/OWNERS @@ -0,0 +1,4 @@ +# Reviewers for /floss/pandora + +johnlai@google.com +chharry@google.com diff --git a/framework/OWNERS b/framework/OWNERS new file mode 100644 index 0000000000..40a43c47cb --- /dev/null +++ b/framework/OWNERS @@ -0,0 +1,4 @@ +hallstrom@google.com +okamil@google.com +siyuanh@google.com +wescande@google.com diff --git a/framework/api/current.txt b/framework/api/current.txt index 2a9c053b50..a9bc28a28a 100644 --- a/framework/api/current.txt +++ b/framework/api/current.txt @@ -1242,7 +1242,7 @@ package android.bluetooth.le { public final class AdvertisingSet { method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void enableAdvertising(boolean, int, int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setAdvertisingData(android.bluetooth.le.AdvertiseData); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); + method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADVERTISE, android.Manifest.permission.BLUETOOTH_PRIVILEGED}, conditional=true) public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingEnabled(boolean); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java index 02e5d15a48..e67d823c7e 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -370,7 +370,8 @@ public final class BluetoothGatt implements BluetoothProfile { + (" status=" + status) + (" clientIf=" + clientIf) + (" connected=" + connected) - + (" device=" + address)); + + (" device=" + + BluetoothUtils.toAnonymizedAddress(address))); } if (!address.equals(mDevice.getAddress())) { return; @@ -479,7 +480,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onCharacteristicRead() -" - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" handle=" + handle) + (" Status=" + status)); } @@ -546,7 +547,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onCharacteristicWrite() -" - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" handle=" + handle) + (" Status=" + status)); } @@ -819,7 +820,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onReadRemoteRssi() -" - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" rssi=" + rssi) + (" status=" + status)); } @@ -849,7 +850,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onConfigureMTU() -" - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" mtu=" + mtu) + (" status=" + status)); } @@ -881,7 +882,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onConnectionUpdated() -" - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" interval=" + interval) + (" latency=" + latency) + (" timeout=" + timeout) @@ -916,7 +917,10 @@ public final class BluetoothGatt implements BluetoothProfile { @Override public void onServiceChanged(String address) { if (DBG) { - Log.d(TAG, "onServiceChanged() - Device=" + address); + Log.d( + TAG, + "onServiceChanged() - Device=" + + BluetoothUtils.toAnonymizedAddress(address)); } if (!address.equals(mDevice.getAddress())) { @@ -951,7 +955,7 @@ public final class BluetoothGatt implements BluetoothProfile { Log.d( TAG, "onSubrateChange() - " - + (" Device=" + address) + + (" Device=" + BluetoothUtils.toAnonymizedAddress(address)) + (" subrateFactor=" + subrateFactor) + (" latency=" + latency) + (" contNum=" + contNum) diff --git a/framework/java/android/bluetooth/BluetoothGattServer.java b/framework/java/android/bluetooth/BluetoothGattServer.java index 53b491e1b3..94bf7ae4c4 100644 --- a/framework/java/android/bluetooth/BluetoothGattServer.java +++ b/framework/java/android/bluetooth/BluetoothGattServer.java @@ -115,7 +115,7 @@ public final class BluetoothGattServer implements BluetoothProfile { + " connected=" + connected + " device=" - + address); + + BluetoothUtils.toAnonymizedAddress(address)); } try { mCallback.onConnectionStateChange( @@ -305,7 +305,7 @@ public final class BluetoothGattServer implements BluetoothProfile { TAG, "onExecuteWrite() - " + "device=" - + address + + BluetoothUtils.toAnonymizedAddress(address) + ", transId=" + transId + "execWrite=" @@ -334,7 +334,7 @@ public final class BluetoothGattServer implements BluetoothProfile { TAG, "onNotificationSent() - " + "device=" - + address + + BluetoothUtils.toAnonymizedAddress(address) + ", status=" + status); } @@ -388,7 +388,7 @@ public final class BluetoothGattServer implements BluetoothProfile { TAG, "onPhyUpdate() - " + "device=" - + address + + BluetoothUtils.toAnonymizedAddress(address) + ", txPHy=" + txPhy + ", rxPHy=" @@ -417,7 +417,7 @@ public final class BluetoothGattServer implements BluetoothProfile { TAG, "onPhyUpdate() - " + "device=" - + address + + BluetoothUtils.toAnonymizedAddress(address) + ", txPHy=" + txPhy + ", rxPHy=" @@ -446,7 +446,7 @@ public final class BluetoothGattServer implements BluetoothProfile { Log.d( TAG, "onConnectionUpdated() - Device=" - + address + + BluetoothUtils.toAnonymizedAddress(address) + " interval=" + interval + " latency=" diff --git a/framework/java/android/bluetooth/OWNERS b/framework/java/android/bluetooth/OWNERS new file mode 100644 index 0000000000..757ed73819 --- /dev/null +++ b/framework/java/android/bluetooth/OWNERS @@ -0,0 +1,5 @@ +per-file BluetoothHearingAid.java=file:/OWNERS_hearingaid +per-file BluetoothCsipSetCoordinator.java=file:/OWNERS_leaudio +per-file BluetoothLeAudio*.java=file:/OWNERS_leaudio +per-file BluetoothLeBroadcast*.java=file:/OWNERS_leaudio +per-file BluetoothVolumeControl.java=file:/OWNERS_leaudio diff --git a/framework/java/android/bluetooth/le/AdvertisingSet.java b/framework/java/android/bluetooth/le/AdvertisingSet.java index 2a5b2dc323..8632fcf671 100644 --- a/framework/java/android/bluetooth/le/AdvertisingSet.java +++ b/framework/java/android/bluetooth/le/AdvertisingSet.java @@ -136,11 +136,17 @@ public final class AdvertisingSet { * advertising is not active. This method returns immediately, the operation status is delivered * through {@code callback.onAdvertisingParametersUpdated}. * + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when + * {@code parameters.getOwnAddressType()} is different from {@code + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true. + * * @param parameters advertising set parameters. */ @RequiresLegacyBluetoothAdminPermission @RequiresBluetoothAdvertisePermission - @RequiresPermission(BLUETOOTH_ADVERTISE) + @RequiresPermission( + allOf = {BLUETOOTH_ADVERTISE, BLUETOOTH_PRIVILEGED}, + conditional = true) public void setAdvertisingParameters(AdvertisingSetParameters parameters) { try { mGatt.setAdvertisingParameters(mAdvertiserId, parameters, mAttributionSource); diff --git a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java index 7b29261fe0..057053e817 100644 --- a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java +++ b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java @@ -269,9 +269,9 @@ public final class BluetoothLeAdvertiser { * method returns immediately, the operation status is delivered through {@code * callback.onAdvertisingSetStarted()}. * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when * {@code parameters.getOwnAddressType()} is different from {@code - * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}. + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true. * * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced. * @@ -319,9 +319,9 @@ public final class BluetoothLeAdvertiser { * method returns immediately, the operation status is delivered through {@code * callback.onAdvertisingSetStarted()}. * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when * {@code parameters.getOwnAddressType()} is different from {@code - * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}. + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true. * * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced. * @@ -371,9 +371,9 @@ public final class BluetoothLeAdvertiser { * method returns immediately, the operation status is delivered through {@code * callback.onAdvertisingSetStarted()}. * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when * {@code parameters.getOwnAddressType()} is different from {@code - * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}. + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true. * * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced. * @@ -428,9 +428,9 @@ public final class BluetoothLeAdvertiser { * method returns immediately, the operation status is delivered through {@code * callback.onAdvertisingSetStarted()}. * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when * {@code parameters.getOwnAddressType()} is different from {@code - * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}. + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true. * * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced. * @@ -494,10 +494,10 @@ public final class BluetoothLeAdvertiser { * services/characteristics in this server, rather than the union of all GATT services (across * all opened servers). * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when + * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when * {@code parameters.getOwnAddressType()} is different from {@code - * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or when the {@code gattServer} is already - * registered + * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true or + * when the {@code gattServer} is already registered * * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced. * diff --git a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java index b4b2762ed7..c9fa50bbd9 100644 --- a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java +++ b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java @@ -21,6 +21,8 @@ import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; import static com.google.common.truth.Truth.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assume.assumeThat; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.eq; @@ -181,6 +183,11 @@ public class GattClientTest { @RequiresFlagsEnabled(Flags.FLAG_INITIAL_CONN_PARAMS_P1) @Test public void onConnectionUpdatedIsCalledOnlyOnceForRelaxingConnectionParameters_noGattCache() { + int aggressiveConnectionThreshold = + SystemProperties.getInt("bluetooth.core.le.aggressive_connection_threshold", 2); + // This test is for the case where aggressive initial parameters are used. + assumeThat(aggressiveConnectionThreshold, greaterThan(0)); + BluetoothGattCallback gattCallback = mock(BluetoothGattCallback.class); ArgumentCaptor<Integer> connectionIntervalCaptor = ArgumentCaptor.forClass(Integer.class); diff --git a/framework/tests/bumble/src/android/bluetooth/LeLegacyAdvertisingTest.java b/framework/tests/bumble/src/android/bluetooth/LeLegacyAdvertisingTest.java index 4927871280..39abb62c9c 100644 --- a/framework/tests/bumble/src/android/bluetooth/LeLegacyAdvertisingTest.java +++ b/framework/tests/bumble/src/android/bluetooth/LeLegacyAdvertisingTest.java @@ -24,13 +24,9 @@ import android.bluetooth.le.AdvertisingSetCallback; import android.bluetooth.le.AdvertisingSetParameters; import android.bluetooth.le.BluetoothLeAdvertiser; import android.os.ParcelUuid; -import android.platform.test.annotations.RequiresFlagsEnabled; -import android.platform.test.flag.junit.CheckFlagsRule; -import android.platform.test.flag.junit.DeviceFlagsValueProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.junit.Rule; @@ -48,10 +44,6 @@ public class LeLegacyAdvertisingTest { @Rule(order = 1) public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); - @Rule(order = 0) - public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); - - @RequiresFlagsEnabled(Flags.FLAG_BLE_CHECK_DATA_LENGTH_ON_LEGACY_ADVERTISING) @Test public void setAdvertisingDataOver31Bytes() throws Exception { final BluetoothLeAdvertiser advertiser = @@ -103,7 +95,6 @@ public class LeLegacyAdvertisingTest { } } - @RequiresFlagsEnabled(Flags.FLAG_BLE_CHECK_DATA_LENGTH_ON_LEGACY_ADVERTISING) @Test public void setScanResponseDataOver31Bytes() throws Exception { final BluetoothLeAdvertiser advertiser = diff --git a/framework/tests/bumble/src/android/bluetooth/hid/OWNERS b/framework/tests/bumble/src/android/bluetooth/hid/OWNERS new file mode 100644 index 0000000000..75539edb09 --- /dev/null +++ b/framework/tests/bumble/src/android/bluetooth/hid/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 27441 +# Project owners +rwt@google.com diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS b/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS new file mode 100644 index 0000000000..75539edb09 --- /dev/null +++ b/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 27441 +# Project owners +rwt@google.com diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java index c833acf944..44c6564803 100644 --- a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java +++ b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java @@ -174,12 +174,9 @@ public class PairingTest { mRemoteLeDevice = sAdapter.getRemoteLeDevice( Utils.BUMBLE_RANDOM_ADDRESS, BluetoothDevice.ADDRESS_TYPE_RANDOM); - Set<BluetoothDevice> bondedDevices = sAdapter.getBondedDevices(); - if (bondedDevices.contains(mBumbleDevice)) { - removeBond(mBumbleDevice); - } - if (bondedDevices.contains(mRemoteLeDevice)) { - removeBond(mRemoteLeDevice); + + for (BluetoothDevice device : sAdapter.getBondedDevices()) { + removeBond(device); } } diff --git a/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS b/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS new file mode 100644 index 0000000000..353b5d03a5 --- /dev/null +++ b/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 27441 +# Project owners +jpawlowski@google.com diff --git a/framework/tests/metrics/OWNERS b/framework/tests/metrics/OWNERS new file mode 100644 index 0000000000..01d41baf7e --- /dev/null +++ b/framework/tests/metrics/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 1099313 +# Project owners +ahujapalash@google.com diff --git a/framework/tests/unit/Android.bp b/framework/tests/unit/Android.bp index 39b3c29861..df2dc8b9dc 100644 --- a/framework/tests/unit/Android.bp +++ b/framework/tests/unit/Android.bp @@ -34,5 +34,6 @@ android_test { test_suites: [ "general-tests", "mts-bluetooth", + "mts-bt", ], } diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothDeviceTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothDeviceTest.java new file mode 100644 index 0000000000..55263c4400 --- /dev/null +++ b/framework/tests/unit/src/android/bluetooth/BluetoothDeviceTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +import static com.google.common.truth.Truth.assertThat; + +import android.bluetooth.BluetoothDevice.AddressType; +import android.bluetooth.BluetoothDevice.BluetoothAddress; +import android.os.Parcel; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Test cases for {@link BluetoothDevice}. */ +@RunWith(JUnit4.class) +public class BluetoothDeviceTest { + + @Test + public void testBluetoothAddress_empty() { + BluetoothAddress bluetoothAddress = + new BluetoothAddress(null, BluetoothDevice.ADDRESS_TYPE_UNKNOWN); + + assertThat(bluetoothAddress.getAddress()).isNull(); + assertThat(bluetoothAddress.getAddressType()) + .isEqualTo(BluetoothDevice.ADDRESS_TYPE_UNKNOWN); + } + + @Test + public void testBluetoothAddress_addressWithTypePublic() { + doTestAddressWithType("00:11:22:AA:BB:CC", BluetoothDevice.ADDRESS_TYPE_PUBLIC); + } + + @Test + public void testBluetoothAddress_addressWithTypeRandom() { + doTestAddressWithType("51:F7:A8:75:AC:5E", BluetoothDevice.ADDRESS_TYPE_RANDOM); + } + + @Test + public void testBluetoothAddress_Parcelable() { + String address = "00:11:22:AA:BB:CC"; + int addressType = BluetoothDevice.ADDRESS_TYPE_PUBLIC; + + BluetoothAddress bluetoothAddress = new BluetoothAddress(address, addressType); + + doAssertBluetoothAddress(bluetoothAddress, address, addressType); + + Parcel parcel = Parcel.obtain(); + bluetoothAddress.writeToParcel(parcel, 0 /* flags */); + parcel.setDataPosition(0); + BluetoothAddress bluetoothAddressOut = BluetoothAddress.CREATOR.createFromParcel(parcel); + parcel.recycle(); + + doAssertBluetoothAddress(bluetoothAddressOut, address, addressType); + } + + private void doTestAddressWithType(String address, @AddressType int addressType) { + BluetoothAddress bluetoothAddress = new BluetoothAddress(address, addressType); + + doAssertBluetoothAddress(bluetoothAddress, address, addressType); + } + + private void doAssertBluetoothAddress( + BluetoothAddress bluetoothAddress, String address, @AddressType int addressType) { + assertThat(bluetoothAddress.getAddress()).isEqualTo(address); + assertThat(bluetoothAddress.getAddressType()) + .isEqualTo( + addressType == BluetoothDevice.ADDRESS_TYPE_RANDOM + ? BluetoothDevice.ADDRESS_TYPE_RANDOM + : BluetoothDevice.ADDRESS_TYPE_PUBLIC); + } +} diff --git a/pandora/OWNERS b/pandora/OWNERS new file mode 100644 index 0000000000..14634f3b78 --- /dev/null +++ b/pandora/OWNERS @@ -0,0 +1,2 @@ +# Project owners +girardier@google.com diff --git a/service/OWNERS b/service/OWNERS new file mode 100644 index 0000000000..5b3f4bad26 --- /dev/null +++ b/service/OWNERS @@ -0,0 +1 @@ +wescande@google.com diff --git a/service/tests/Android.bp b/service/tests/Android.bp index e3b70c81d0..217bd36f70 100644 --- a/service/tests/Android.bp +++ b/service/tests/Android.bp @@ -58,6 +58,7 @@ android_test { test_suites: [ "general-tests", "mts-bluetooth", + "mts-bt", ], min_sdk_version: "Tiramisu", diff --git a/sysprop/OWNERS b/sysprop/OWNERS new file mode 100644 index 0000000000..5b3f4bad26 --- /dev/null +++ b/sysprop/OWNERS @@ -0,0 +1 @@ +wescande@google.com diff --git a/system/OWNERS b/system/OWNERS new file mode 100644 index 0000000000..d60842e9c9 --- /dev/null +++ b/system/OWNERS @@ -0,0 +1,12 @@ +# Reviewers for /system + +bhaktha@google.com +eruffieux@google.com +hallstrom@google.com +henrichataing@google.com +jpawlowski@google.com +okamil@google.com +poahlo@google.com +rongxuan@google.com +rwt@google.com +wescande@google.com diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc index 6b65525050..7a931a6248 100644 --- a/system/bta/dm/bta_dm_act.cc +++ b/system/bta/dm/bta_dm_act.cc @@ -1671,9 +1671,7 @@ static void bta_ble_energy_info_cmpl(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TI tBTM_CONTRL_STATE ctrl_state = BTM_CONTRL_UNKNOWN; if (BTA_SUCCESS == st) { - ctrl_state = com::android::bluetooth::flags::bt_system_context_report() - ? bta_dm_obtain_system_context() - : bta_dm_pm_obtain_controller_state(); + ctrl_state = bta_dm_obtain_system_context(); } if (bta_dm_cb.p_energy_info_cback) { diff --git a/system/bta/hearing_aid/OWNERS b/system/bta/hearing_aid/OWNERS new file mode 100644 index 0000000000..bbaa85ddbb --- /dev/null +++ b/system/bta/hearing_aid/OWNERS @@ -0,0 +1 @@ +include /OWNERS_hearingaid diff --git a/system/bta/include/OWNERS b/system/bta/include/OWNERS new file mode 100644 index 0000000000..9dfb8422a1 --- /dev/null +++ b/system/bta/include/OWNERS @@ -0,0 +1 @@ +per-file bta_hearing_aid_api.h=file:/OWNERS_hearingaid diff --git a/system/bta/le_audio/OWNERS b/system/bta/le_audio/OWNERS new file mode 100644 index 0000000000..a7d77894ba --- /dev/null +++ b/system/bta/le_audio/OWNERS @@ -0,0 +1 @@ +include /OWNERS_leaudio diff --git a/system/btif/src/OWNERS b/system/btif/src/OWNERS new file mode 100644 index 0000000000..e495e167d4 --- /dev/null +++ b/system/btif/src/OWNERS @@ -0,0 +1 @@ +per-file btif_hearing_aid.cc=file:/OWNERS_hearingaid diff --git a/system/gd/hal/ranging_hal.h b/system/gd/hal/ranging_hal.h index 1d034ef69f..5a37900bc5 100644 --- a/system/gd/hal/ranging_hal.h +++ b/system/gd/hal/ranging_hal.h @@ -323,6 +323,7 @@ public: virtual void WriteProcedureData(uint16_t connection_handle, hci::CsRole local_cs_role, const ProcedureDataV2& procedure_data, uint16_t procedure_counter) = 0; + virtual bool IsAbortedProcedureRequired(uint16_t connection_handle) = 0; }; } // namespace hal diff --git a/system/gd/hal/ranging_hal_android.cc b/system/gd/hal/ranging_hal_android.cc index f73a9998df..d093685863 100644 --- a/system/gd/hal/ranging_hal_android.cc +++ b/system/gd/hal/ranging_hal_android.cc @@ -521,6 +521,25 @@ public: } } + bool IsAbortedProcedureRequired(uint16_t connection_handle) override { + auto it = session_trackers_.find(connection_handle); + if (it == session_trackers_.end()) { + log::error("Can't find session for connection_handle:0x{:04x}", connection_handle); + return false; + } + if (it->second->GetSession() == nullptr) { + log::error("Session not opened"); + return false; + } + bool isRequired = false; + auto aidl_ret = it->second->GetSession()->isAbortedProcedureRequired(&isRequired); + if (aidl_ret.isOk()) { + return isRequired; + } + log::error("can not get result for isAbortedProcedureRequired."); + return false; + } + protected: void ListDependencies(ModuleList* /*list*/) const {} diff --git a/system/gd/hal/ranging_hal_host.cc b/system/gd/hal/ranging_hal_host.cc index 0d8385f564..59282dc422 100644 --- a/system/gd/hal/ranging_hal_host.cc +++ b/system/gd/hal/ranging_hal_host.cc @@ -63,6 +63,8 @@ public: void UpdateConnInterval(uint16_t /* connection_handle */, uint16_t /* conn_interval */) override { } + bool IsAbortedProcedureRequired(uint16_t /*connection_handle*/) { return false; } + protected: void ListDependencies(ModuleList* /*list*/) const {} diff --git a/system/gd/hci/distance_measurement_manager.cc b/system/gd/hci/distance_measurement_manager.cc index 38707b9762..04c3955204 100644 --- a/system/gd/hci/distance_measurement_manager.cc +++ b/system/gd/hci/distance_measurement_manager.cc @@ -208,6 +208,7 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback { RangingHeader ranging_header_; PacketViewForRecombination segment_data_; uint16_t conn_interval_ = kInvalidConnInterval; + uint8_t procedure_sequence_after_enable = -1; }; bool get_free_config_id(uint16_t connection_handle, uint8_t& config_id) { @@ -1193,6 +1194,8 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback { METHOD_CS); } if (live_tracker->local_start && is_hal_v2()) { + // reset the procedure sequence + live_tracker->procedure_sequence_after_enable = -1; ranging_hal_->UpdateProcedureEnableConfig(connection_handle, event_view); } } else if (event_view.GetState() == Enable::DISABLED) { @@ -1357,9 +1360,9 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback { static_cast<bluetooth::ras::SubeventAbortReason>(subevent_abort_reason); } parse_cs_result_data(result_data_structures, *procedure_data, live_tracker->role); - check_cs_procedure_complete(live_tracker, procedure_data, connection_handle); if (live_tracker->local_start) { + check_cs_procedure_complete(live_tracker, procedure_data, connection_handle); // Skip to send remote return; } @@ -1963,40 +1966,59 @@ struct DistanceMeasurementManager::impl : bluetooth::hal::RangingHalCallback { return procedure_data; } + void try_send_data_to_hal(uint16_t connection_handle, const CsTracker* live_tracker, + const CsProcedureData* procedure_data) const { + if (!ranging_hal_->IsBound()) { + return; + } + bool should_send_to_hal = false; + if (ranging_hal_->IsAbortedProcedureRequired(connection_handle)) { + should_send_to_hal = procedure_data->local_status != CsProcedureDoneStatus::PARTIAL_RESULTS && + procedure_data->remote_status != CsProcedureDoneStatus::PARTIAL_RESULTS; + } else { + should_send_to_hal = + procedure_data->local_status == CsProcedureDoneStatus::ALL_RESULTS_COMPLETE && + procedure_data->remote_status == CsProcedureDoneStatus::ALL_RESULTS_COMPLETE && + procedure_data->contains_complete_subevent_; + } + if (should_send_to_hal) { + log::debug("Procedure complete counter:{} data size:{}", (uint16_t)procedure_data->counter, + procedure_data->step_channel.size()); + if (is_hal_v2()) { + ranging_hal_->WriteProcedureData(connection_handle, live_tracker->role, + procedure_data->procedure_data_v2_, + procedure_data->counter); + } else { + // Use algorithm in the HAL + bluetooth::hal::ChannelSoundingRawData raw_data; + raw_data.num_antenna_paths_ = procedure_data->num_antenna_paths; + raw_data.step_channel_ = procedure_data->step_channel; + raw_data.tone_pct_initiator_ = procedure_data->tone_pct_initiator; + raw_data.tone_quality_indicator_initiator_ = + procedure_data->tone_quality_indicator_initiator; + raw_data.tone_pct_reflector_ = procedure_data->tone_pct_reflector; + raw_data.tone_quality_indicator_reflector_ = + procedure_data->tone_quality_indicator_reflector; + raw_data.toa_tod_initiators_ = procedure_data->toa_tod_initiators; + raw_data.tod_toa_reflectors_ = procedure_data->tod_toa_reflectors; + raw_data.packet_quality_initiator = procedure_data->packet_quality_initiator; + raw_data.packet_quality_reflector = procedure_data->packet_quality_reflector; + ranging_hal_->WriteRawData(connection_handle, raw_data); + } + } + } + void check_cs_procedure_complete(CsTracker* live_tracker, CsProcedureData* procedure_data, uint16_t connection_handle) const { - if (live_tracker->local_start && - procedure_data->local_status == CsProcedureDoneStatus::ALL_RESULTS_COMPLETE && - procedure_data->remote_status == CsProcedureDoneStatus::ALL_RESULTS_COMPLETE && - procedure_data->contains_complete_subevent_) { - log::debug("Procedure complete counter:{} data size:{}, main_mode_type:{}, sub_mode_type:{}", - (uint16_t)procedure_data->counter, (uint16_t)procedure_data->step_channel.size(), - (uint16_t)live_tracker->main_mode_type, (uint16_t)live_tracker->sub_mode_type); - - if (ranging_hal_->IsBound()) { - if (is_hal_v2()) { - ranging_hal_->WriteProcedureData(connection_handle, live_tracker->role, - procedure_data->procedure_data_v2_, - procedure_data->counter); - } else { - // Use algorithm in the HAL - bluetooth::hal::ChannelSoundingRawData raw_data; - raw_data.num_antenna_paths_ = procedure_data->num_antenna_paths; - raw_data.step_channel_ = procedure_data->step_channel; - raw_data.tone_pct_initiator_ = procedure_data->tone_pct_initiator; - raw_data.tone_quality_indicator_initiator_ = - procedure_data->tone_quality_indicator_initiator; - raw_data.tone_pct_reflector_ = procedure_data->tone_pct_reflector; - raw_data.tone_quality_indicator_reflector_ = - procedure_data->tone_quality_indicator_reflector; - raw_data.toa_tod_initiators_ = procedure_data->toa_tod_initiators; - raw_data.tod_toa_reflectors_ = procedure_data->tod_toa_reflectors; - raw_data.packet_quality_initiator = procedure_data->packet_quality_initiator; - raw_data.packet_quality_reflector = procedure_data->packet_quality_reflector; - ranging_hal_->WriteRawData(connection_handle, raw_data); - } - } + if (is_hal_v2() && procedure_data->local_status != CsProcedureDoneStatus::PARTIAL_RESULTS && + procedure_data->remote_status != CsProcedureDoneStatus::PARTIAL_RESULTS) { + live_tracker->procedure_sequence_after_enable++; + log::debug("procedure sequence after enabled is {}", + live_tracker->procedure_sequence_after_enable); + procedure_data->procedure_data_v2_.procedure_sequence_ = + live_tracker->procedure_sequence_after_enable; } + try_send_data_to_hal(connection_handle, live_tracker, procedure_data); // If the procedure is completed or aborted, delete all previous data if (procedure_data->local_status != CsProcedureDoneStatus::PARTIAL_RESULTS && diff --git a/system/gd/hci/le_advertising_manager.cc b/system/gd/hci/le_advertising_manager.cc index 240f8f54d4..5213569243 100644 --- a/system/gd/hci/le_advertising_manager.cc +++ b/system/gd/hci/le_advertising_manager.cc @@ -1139,11 +1139,9 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb data_len += data[i].size(); } - int maxDataLength = - (com::android::bluetooth::flags::ble_check_data_length_on_legacy_advertising() && - advertising_sets_[advertiser_id].is_legacy) - ? kLeMaximumLegacyAdvertisingDataLength - : le_maximum_advertising_data_length_; + int maxDataLength = advertising_sets_[advertiser_id].is_legacy + ? kLeMaximumLegacyAdvertisingDataLength + : le_maximum_advertising_data_length_; if (data_len > maxDataLength) { log::warn("advertising data len {} exceeds maxDataLength {}", data_len, maxDataLength); diff --git a/system/gd/metrics/chromeos/OWNERS b/system/gd/metrics/chromeos/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/system/gd/metrics/chromeos/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/system/gd/metrics/linux/OWNERS b/system/gd/metrics/linux/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/system/gd/metrics/linux/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/system/gd/rust/linux/OWNERS b/system/gd/rust/linux/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/system/gd/rust/linux/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/system/gd/rust/topshim/OWNERS b/system/gd/rust/topshim/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/system/gd/rust/topshim/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/system/gd/rust/topshim/src/profiles/gatt.rs b/system/gd/rust/topshim/src/profiles/gatt.rs index a6884310b6..7bed7bdf78 100644 --- a/system/gd/rust/topshim/src/profiles/gatt.rs +++ b/system/gd/rust/topshim/src/profiles/gatt.rs @@ -2,8 +2,8 @@ use crate::bindings::root as bindings; use crate::btif::{ptr_to_vec, BluetoothInterface, BtStatus, RawAddress, SupportedProfiles, Uuid}; use crate::profiles::gatt::bindings::{ btgatt_callbacks_t, btgatt_client_callbacks_t, btgatt_client_interface_t, btgatt_interface_t, - btgatt_scanner_callbacks_t, btgatt_server_callbacks_t, btgatt_server_interface_t, - BleAdvertiserInterface, BleScannerInterface, + btgatt_server_callbacks_t, btgatt_server_interface_t, BleAdvertiserInterface, + BleScannerInterface, }; use crate::topstack::get_dispatchers; use crate::utils::LTCheckedPtr; @@ -1723,7 +1723,6 @@ pub struct Gatt { callbacks: Option<Box<bindings::btgatt_callbacks_t>>, gatt_client_callbacks: Option<Box<bindings::btgatt_client_callbacks_t>>, gatt_server_callbacks: Option<Box<bindings::btgatt_server_callbacks_t>>, - gatt_scanner_callbacks: Option<Box<bindings::btgatt_scanner_callbacks_t>>, } impl Gatt { @@ -1759,7 +1758,6 @@ impl Gatt { callbacks: None, gatt_client_callbacks: None, gatt_server_callbacks: None, - gatt_scanner_callbacks: None, } } @@ -1869,18 +1867,10 @@ impl Gatt { subrate_chg_cb: Some(gs_subrate_chg_cb), }); - let gatt_scanner_callbacks = Box::new(btgatt_scanner_callbacks_t { - scan_result_cb: None, - batchscan_reports_cb: None, - batchscan_threshold_cb: None, - track_adv_event_cb: None, - }); - let callbacks = Box::new(btgatt_callbacks_t { size: std::mem::size_of::<btgatt_callbacks_t>(), client: &*gatt_client_callbacks, server: &*gatt_server_callbacks, - scanner: &*gatt_scanner_callbacks, }); let cb_ptr = LTCheckedPtr::from(&callbacks); @@ -1890,7 +1880,6 @@ impl Gatt { self.callbacks = Some(callbacks); self.gatt_client_callbacks = Some(gatt_client_callbacks); self.gatt_server_callbacks = Some(gatt_server_callbacks); - self.gatt_scanner_callbacks = Some(gatt_scanner_callbacks); // Register callbacks for gatt scanner and advertiser mutcxxcall!(self.scanner, RegisterCallbacks); diff --git a/system/include/hardware/ble_scanner.h b/system/include/hardware/ble_scanner.h index 67e0011987..6adb09d26c 100644 --- a/system/include/hardware/ble_scanner.h +++ b/system/include/hardware/ble_scanner.h @@ -28,30 +28,6 @@ #include "types/bluetooth/uuid.h" #include "types/raw_address.h" -/** Callback invoked when batchscan reports are obtained */ -typedef void (*batchscan_reports_callback)(int client_if, int status, int report_format, - int num_records, std::vector<uint8_t> data); - -/** Callback invoked when batchscan storage threshold limit is crossed */ -typedef void (*batchscan_threshold_callback)(int client_if); - -/** Track ADV VSE callback invoked when tracked device is found or lost */ -typedef void (*track_adv_event_callback)(btgatt_track_adv_info_t* p_track_adv_info); - -/** Callback for scan results */ -typedef void (*scan_result_callback)(uint16_t event_type, uint8_t addr_type, RawAddress* bda, - uint8_t primary_phy, uint8_t secondary_phy, - uint8_t advertising_sid, int8_t tx_power, int8_t rssi, - uint16_t periodic_adv_int, std::vector<uint8_t> adv_data, - RawAddress* original_bda); - -typedef struct { - scan_result_callback scan_result_cb; - batchscan_reports_callback batchscan_reports_cb; - batchscan_threshold_callback batchscan_threshold_cb; - track_adv_event_callback track_adv_event_cb; -} btgatt_scanner_callbacks_t; - class AdvertisingTrackInfo { public: // For MSFT-based advertisement monitor. diff --git a/system/include/hardware/bt_gatt.h b/system/include/hardware/bt_gatt.h index 50096274e3..aa55e03701 100644 --- a/system/include/hardware/bt_gatt.h +++ b/system/include/hardware/bt_gatt.h @@ -37,9 +37,6 @@ typedef struct { /** GATT Server callbacks */ const btgatt_server_callbacks_t* server; - - /** LE scanner callbacks */ - const btgatt_scanner_callbacks_t* scanner; } btgatt_callbacks_t; /** Represents the standard Bluetooth GATT interface. */ diff --git a/system/log/OWNERS b/system/log/OWNERS new file mode 100644 index 0000000000..d1c75de900 --- /dev/null +++ b/system/log/OWNERS @@ -0,0 +1 @@ +henrichataing@google.com diff --git a/system/stack/mmc/OWNERS b/system/stack/mmc/OWNERS new file mode 100644 index 0000000000..a823e6e1dd --- /dev/null +++ b/system/stack/mmc/OWNERS @@ -0,0 +1 @@ +include /OWNERS_chromeos diff --git a/system/test/Android.bp b/system/test/Android.bp index d4a1a767eb..c5a3b0c2d6 100644 --- a/system/test/Android.bp +++ b/system/test/Android.bp @@ -628,7 +628,10 @@ cc_defaults { target: { android: { test_config_template: ":BluetoothTestConfigTemplate", - test_suites: ["mts-bluetooth"], + test_suites: [ + "mts-bluetooth", + "mts-bt", + ], }, }, compile_multilib: "both", diff --git a/system/test/suite/gatt/gatt_test.cc b/system/test/suite/gatt/gatt_test.cc index b99dbf77f8..b992d2eab8 100644 --- a/system/test/suite/gatt/gatt_test.cc +++ b/system/test/suite/gatt/gatt_test.cc @@ -32,14 +32,6 @@ void RegisterClientCallback(int status, int clientIf, const bluetooth::Uuid& /*a semaphore_post(instance->register_client_callback_sem_); } -void ScanResultCallback(uint16_t /*ble_evt_type*/, uint8_t /*addr_type*/, RawAddress* /*bda*/, - uint8_t /*ble_primary_phy*/, uint8_t /*ble_secondary_phy*/, - uint8_t /*ble_advertising_sid*/, int8_t /*ble_tx_power*/, int8_t /*rssi*/, - uint16_t /*ble_periodic_adv_int*/, std::vector<uint8_t> /*adv_data*/, - RawAddress* /*original_bda*/) { - semaphore_post(instance->scan_result_callback_sem_); -} - // GATT server callbacks void RegisterServerCallback(int status, int server_if, const bluetooth::Uuid& /*uuid*/) { instance->status_ = status; @@ -69,10 +61,6 @@ void ServiceDeletedCallback(int status, int server_if, int srvc_handle) { semaphore_post(instance->service_deleted_callback_sem_); } -static const btgatt_scanner_callbacks_t scanner_callbacks = { - .scan_result_cb = ScanResultCallback, -}; - static const btgatt_client_callbacks_t client_callbacks = { .register_client_cb = RegisterClientCallback, }; @@ -88,7 +76,6 @@ static const btgatt_callbacks_t callbacks = { sizeof(btgatt_callbacks_t), &client_callbacks, &server_callbacks, - &scanner_callbacks, }; void GattTest::SetUp() { diff --git a/system/test/suite/gatt/gatt_test.h b/system/test/suite/gatt/gatt_test.h index 6385e6637d..85c2d34ee3 100644 --- a/system/test/suite/gatt/gatt_test.h +++ b/system/test/suite/gatt/gatt_test.h @@ -73,7 +73,6 @@ protected: // Semaphores used to wait for specific callback execution. Each callback // has its own semaphore associated with it btsemaphore register_client_callback_sem_; - btsemaphore scan_result_callback_sem_; btsemaphore listen_callback_sem_; btsemaphore register_server_callback_sem_; diff --git a/tools/OWNERS b/tools/OWNERS new file mode 100644 index 0000000000..b2869ce1bc --- /dev/null +++ b/tools/OWNERS @@ -0,0 +1,5 @@ +# Reviewers for /tools + +jpawlowski@google.com +siyuanh@google.com +wescande@google.com diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS new file mode 100644 index 0000000000..9dd2d58fe3 --- /dev/null +++ b/tools/lint/OWNERS @@ -0,0 +1,2 @@ +# Additional OWNERS for Bluetooth AndroidLint +salsavage@google.com diff --git a/tools/rootcanal/OWNERS b/tools/rootcanal/OWNERS new file mode 100644 index 0000000000..22b124fd96 --- /dev/null +++ b/tools/rootcanal/OWNERS @@ -0,0 +1,3 @@ +# Reviewers for /tools/rootcanal + +henrichataing@google.com |