Loading PREUPLOAD.cfg +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ ignore_merged_commits = true [Builtin Hooks] aidl_format = true commit_msg_bug_field = true google_java_format = true clang_format = true rustfmt = true bpfmt = true Loading TEST_MAPPING +12 −6 Original line number Diff line number Diff line Loading @@ -13,9 +13,9 @@ //{ // "name": "FrameworkBluetoothTests" //}, { "name": "ServiceBluetoothTests" }, //{ // "name": "ServiceBluetoothTests" //}, // device only tests // Broken //{ Loading Loading @@ -45,6 +45,9 @@ { "name": "net_test_btif_profile_queue" }, { "name": "net_test_btif_avrcp_audio_track" }, { "name": "net_test_device" }, Loading Loading @@ -223,9 +226,9 @@ //{ // "name": "FrameworkBluetoothTests" //}, { "name": "ServiceBluetoothTests" }, //{ // "name": "ServiceBluetoothTests" //}, // device only tests // Broken //{ Loading Loading @@ -255,6 +258,9 @@ { "name": "net_test_btif_profile_queue" }, { "name": "net_test_btif_avrcp_audio_track" }, { "name": "net_test_device" }, Loading android/app/Android.bp +19 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ java_library { cc_library_shared { name: "libbluetooth_jni", defaults: ["fluoride_full_defaults"], defaults: ["fluoride_basic_defaults"], srcs: ["jni/**/*.cpp"], header_libs: [ "jni_headers", Loading @@ -67,16 +67,34 @@ cc_library_shared { "packages/modules/Bluetooth/system/types", ], static_libs: [ "avrcp-target-service", "lib-bt-packets-avrcp", "lib-bt-packets-base", "libaudio-a2dp-hw-utils", "libbluetooth", "libbluetooth-types", "libbluetooth_core_rs", "libbluetooth_core_rs_bridge", "libbt-audio-hal-interface", "libbt-bta", "libbt-bta-core", "libbt-common", "libbt-hci", "libbt-stack", "libbt-stack-core", "libbtcore", "libbtdevice", "libbte", "libbtif", "libbtif-core", "libc++fs", "libchrome", "libevent", "libmodpb64", "libosi", ], shared_libs: [ "android.hardware.bluetooth.audio-V3-ndk", "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", ], Loading android/app/AndroidManifest.xml +0 −8 Original line number Diff line number Diff line Loading @@ -362,14 +362,6 @@ <path-permission android:pathPrefix="/btopp" android:permission="android.permission.ACCESS_BLUETOOTH_SHARE"/> </provider> <provider android:name="com.android.bluetooth.opp.BluetoothOppFileProvider" android:authorities="com.android.bluetooth.opp.fileprovider" android:grantUriPermissions="true" android:enabled="false" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/> </provider> <receiver android:process="@string/process" android:name="com.android.bluetooth.opp.BluetoothOppReceiver" android:exported="true" Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +122 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <mutex> #include <shared_mutex> #include "com_android_bluetooth.h" #include "hardware/bt_sock.h" Loading Loading @@ -85,6 +85,7 @@ static bool sHaveCallbackThread; static jobject sJniAdapterServiceObj; static jobject sJniCallbacksObj; static std::shared_timed_mutex jniObjMutex; static jfieldID sJniCallbacksField; const bt_interface_t* getBluetoothInterface() { return sBluetoothInterface; } Loading @@ -96,6 +97,12 @@ bool isCallbackThread() { } static void adapter_state_change_callback(bt_state_t status) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; ALOGV("%s: Status is: %d", __func__, status); Loading Loading @@ -124,6 +131,12 @@ static int get_properties(int num_properties, bt_property_t* properties, static void adapter_properties_callback(bt_status_t status, int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -178,6 +191,12 @@ static void remote_device_properties_callback(bt_status_t status, RawAddress* bd_addr, int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -240,6 +259,12 @@ static void remote_device_properties_callback(bt_status_t status, static void device_found_callback(int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -276,6 +301,12 @@ static void device_found_callback(int num_properties, static void bond_state_changed_callback(bt_status_t status, RawAddress* bd_addr, bt_bond_state_t state, int fail_reason) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -300,6 +331,12 @@ static void bond_state_changed_callback(bt_status_t status, RawAddress* bd_addr, static void address_consolidate_callback(RawAddress* main_bd_addr, RawAddress* secondary_bd_addr) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); ScopedLocalRef<jbyteArray> main_addr( Loading Loading @@ -328,6 +365,12 @@ static void address_consolidate_callback(RawAddress* main_bd_addr, static void le_address_associate_callback(RawAddress* main_bd_addr, RawAddress* secondary_bd_addr) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); ScopedLocalRef<jbyteArray> main_addr( Loading Loading @@ -365,6 +408,12 @@ static void acl_state_changed_callback(bt_status_t status, RawAddress* bd_addr, return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -384,6 +433,12 @@ static void acl_state_changed_callback(bt_status_t status, RawAddress* bd_addr, } static void discovery_state_changed_callback(bt_discovery_state_t state) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -400,6 +455,12 @@ static void pin_request_callback(RawAddress* bd_addr, bt_bdname_t* bdname, return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -434,6 +495,13 @@ static void ssp_request_callback(RawAddress* bd_addr, bt_bdname_t* bdname, ALOGE("Address is null in %s", __func__); return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -580,6 +648,13 @@ static jobject createLeOobDataObject(JNIEnv* env, bt_oob_data_t oob_data) { static void generate_local_oob_data_callback(tBT_TRANSPORT transport, bt_oob_data_t oob_data) { ALOGV("%s", __func__); std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -610,6 +685,12 @@ static void link_quality_report_callback( uint64_t timestamp, int report_id, int rssi, int snr, int retransmission_count, int packets_not_receive_count, int negative_acknowledgement_count) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -625,6 +706,12 @@ static void link_quality_report_callback( } static void switch_buffer_size_callback(bool is_low_latency_buffer_size) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -637,6 +724,12 @@ static void switch_buffer_size_callback(bool is_low_latency_buffer_size) { } static void switch_codec_callback(bool is_low_latency_buffer_size) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -674,6 +767,12 @@ static void callback_thread_event(bt_cb_thread_evt event) { static void energy_info_recv_callback(bt_activity_energy_info* p_energy_info, bt_uid_traffic_t* uid_data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -776,6 +875,12 @@ class JNIThreadAttacher { static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return false; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading @@ -800,6 +905,12 @@ static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, } static int acquire_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return BT_STATUS_NOT_READY; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading @@ -825,6 +936,12 @@ static int acquire_wake_lock_callout(const char* lock_name) { } static int release_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return BT_STATUS_NOT_READY; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading Loading @@ -974,6 +1091,8 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, jboolean isCommonCriteriaMode, int configCompareResult, jobjectArray initFlags, jboolean isAtvDevice, jstring userDataDirectory) { std::unique_lock<std::shared_timed_mutex> lock(jniObjMutex); ALOGV("%s", __func__); android_bluetooth_UidTraffic.clazz = Loading Loading @@ -1041,6 +1160,8 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, } static bool cleanupNative(JNIEnv* env, jobject obj) { std::unique_lock<std::shared_timed_mutex> lock(jniObjMutex); ALOGV("%s", __func__); if (!sBluetoothInterface) return JNI_FALSE; Loading Loading
PREUPLOAD.cfg +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ ignore_merged_commits = true [Builtin Hooks] aidl_format = true commit_msg_bug_field = true google_java_format = true clang_format = true rustfmt = true bpfmt = true Loading
TEST_MAPPING +12 −6 Original line number Diff line number Diff line Loading @@ -13,9 +13,9 @@ //{ // "name": "FrameworkBluetoothTests" //}, { "name": "ServiceBluetoothTests" }, //{ // "name": "ServiceBluetoothTests" //}, // device only tests // Broken //{ Loading Loading @@ -45,6 +45,9 @@ { "name": "net_test_btif_profile_queue" }, { "name": "net_test_btif_avrcp_audio_track" }, { "name": "net_test_device" }, Loading Loading @@ -223,9 +226,9 @@ //{ // "name": "FrameworkBluetoothTests" //}, { "name": "ServiceBluetoothTests" }, //{ // "name": "ServiceBluetoothTests" //}, // device only tests // Broken //{ Loading Loading @@ -255,6 +258,9 @@ { "name": "net_test_btif_profile_queue" }, { "name": "net_test_btif_avrcp_audio_track" }, { "name": "net_test_device" }, Loading
android/app/Android.bp +19 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ java_library { cc_library_shared { name: "libbluetooth_jni", defaults: ["fluoride_full_defaults"], defaults: ["fluoride_basic_defaults"], srcs: ["jni/**/*.cpp"], header_libs: [ "jni_headers", Loading @@ -67,16 +67,34 @@ cc_library_shared { "packages/modules/Bluetooth/system/types", ], static_libs: [ "avrcp-target-service", "lib-bt-packets-avrcp", "lib-bt-packets-base", "libaudio-a2dp-hw-utils", "libbluetooth", "libbluetooth-types", "libbluetooth_core_rs", "libbluetooth_core_rs_bridge", "libbt-audio-hal-interface", "libbt-bta", "libbt-bta-core", "libbt-common", "libbt-hci", "libbt-stack", "libbt-stack-core", "libbtcore", "libbtdevice", "libbte", "libbtif", "libbtif-core", "libc++fs", "libchrome", "libevent", "libmodpb64", "libosi", ], shared_libs: [ "android.hardware.bluetooth.audio-V3-ndk", "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", ], Loading
android/app/AndroidManifest.xml +0 −8 Original line number Diff line number Diff line Loading @@ -362,14 +362,6 @@ <path-permission android:pathPrefix="/btopp" android:permission="android.permission.ACCESS_BLUETOOTH_SHARE"/> </provider> <provider android:name="com.android.bluetooth.opp.BluetoothOppFileProvider" android:authorities="com.android.bluetooth.opp.fileprovider" android:grantUriPermissions="true" android:enabled="false" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/> </provider> <receiver android:process="@string/process" android:name="com.android.bluetooth.opp.BluetoothOppReceiver" android:exported="true" Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +122 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <mutex> #include <shared_mutex> #include "com_android_bluetooth.h" #include "hardware/bt_sock.h" Loading Loading @@ -85,6 +85,7 @@ static bool sHaveCallbackThread; static jobject sJniAdapterServiceObj; static jobject sJniCallbacksObj; static std::shared_timed_mutex jniObjMutex; static jfieldID sJniCallbacksField; const bt_interface_t* getBluetoothInterface() { return sBluetoothInterface; } Loading @@ -96,6 +97,12 @@ bool isCallbackThread() { } static void adapter_state_change_callback(bt_state_t status) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; ALOGV("%s: Status is: %d", __func__, status); Loading Loading @@ -124,6 +131,12 @@ static int get_properties(int num_properties, bt_property_t* properties, static void adapter_properties_callback(bt_status_t status, int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -178,6 +191,12 @@ static void remote_device_properties_callback(bt_status_t status, RawAddress* bd_addr, int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -240,6 +259,12 @@ static void remote_device_properties_callback(bt_status_t status, static void device_found_callback(int num_properties, bt_property_t* properties) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -276,6 +301,12 @@ static void device_found_callback(int num_properties, static void bond_state_changed_callback(bt_status_t status, RawAddress* bd_addr, bt_bond_state_t state, int fail_reason) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -300,6 +331,12 @@ static void bond_state_changed_callback(bt_status_t status, RawAddress* bd_addr, static void address_consolidate_callback(RawAddress* main_bd_addr, RawAddress* secondary_bd_addr) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); ScopedLocalRef<jbyteArray> main_addr( Loading Loading @@ -328,6 +365,12 @@ static void address_consolidate_callback(RawAddress* main_bd_addr, static void le_address_associate_callback(RawAddress* main_bd_addr, RawAddress* secondary_bd_addr) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); ScopedLocalRef<jbyteArray> main_addr( Loading Loading @@ -365,6 +408,12 @@ static void acl_state_changed_callback(bt_status_t status, RawAddress* bd_addr, return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -384,6 +433,12 @@ static void acl_state_changed_callback(bt_status_t status, RawAddress* bd_addr, } static void discovery_state_changed_callback(bt_discovery_state_t state) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -400,6 +455,12 @@ static void pin_request_callback(RawAddress* bd_addr, bt_bdname_t* bdname, return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -434,6 +495,13 @@ static void ssp_request_callback(RawAddress* bd_addr, bt_bdname_t* bdname, ALOGE("Address is null in %s", __func__); return; } std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -580,6 +648,13 @@ static jobject createLeOobDataObject(JNIEnv* env, bt_oob_data_t oob_data) { static void generate_local_oob_data_callback(tBT_TRANSPORT transport, bt_oob_data_t oob_data) { ALOGV("%s", __func__); std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -610,6 +685,12 @@ static void link_quality_report_callback( uint64_t timestamp, int report_id, int rssi, int snr, int retransmission_count, int packets_not_receive_count, int negative_acknowledgement_count) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -625,6 +706,12 @@ static void link_quality_report_callback( } static void switch_buffer_size_callback(bool is_low_latency_buffer_size) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading @@ -637,6 +724,12 @@ static void switch_buffer_size_callback(bool is_low_latency_buffer_size) { } static void switch_codec_callback(bool is_low_latency_buffer_size) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniCallbacksObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -674,6 +767,12 @@ static void callback_thread_event(bt_cb_thread_evt event) { static void energy_info_recv_callback(bt_activity_energy_info* p_energy_info, bt_uid_traffic_t* uid_data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return; } CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; Loading Loading @@ -776,6 +875,12 @@ class JNIThreadAttacher { static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return false; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading @@ -800,6 +905,12 @@ static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, } static int acquire_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return BT_STATUS_NOT_READY; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading @@ -825,6 +936,12 @@ static int acquire_wake_lock_callout(const char* lock_name) { } static int release_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return BT_STATUS_NOT_READY; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); Loading Loading @@ -974,6 +1091,8 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, jboolean isCommonCriteriaMode, int configCompareResult, jobjectArray initFlags, jboolean isAtvDevice, jstring userDataDirectory) { std::unique_lock<std::shared_timed_mutex> lock(jniObjMutex); ALOGV("%s", __func__); android_bluetooth_UidTraffic.clazz = Loading Loading @@ -1041,6 +1160,8 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, } static bool cleanupNative(JNIEnv* env, jobject obj) { std::unique_lock<std::shared_timed_mutex> lock(jniObjMutex); ALOGV("%s", __func__); if (!sBluetoothInterface) return JNI_FALSE; Loading