Loading flags/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ java_aconfig_library { cc_aconfig_library { name: "bluetooth_flags_c_lib", aconfig_declarations: "bluetooth_aconfig_flags", export_include_dirs: ["exported_include"], host_supported: true, visibility: [ "//packages/modules/Bluetooth/system:__subpackages__", Loading flags/exported_include/android_bluetooth_flags.h 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright 2023 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. */ #pragma once #ifndef TARGET_FLOSS #include <com_android_bluetooth_flags.h> #define IS_FLAG_ENABLED(flag_name) com::android::bluetooth::flags::flag_name() #define IS_FLAG_ENABLED_P(provider, flag_name) provider.flag_name() #else // FLOSS does not yet support android aconfig flags #define IS_FLAG_ENABLED(flag_name) false #define IS_FLAG_ENABLED_P(provider, flag_name) false namespace com::android::bluetooth::flags { struct flag_provider_interface {}; } // namespace com::android::bluetooth::flags #endif system/BUILD.gn +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ if (defined(use.android) && use.android) { config("target_defaults") { include_dirs = [ "//bt/system", "//bt/flags/exported_include", "//bt/system/linux_include", "//bt/system/types", "//bt/system/include", Loading system/bta/le_audio/client.cc +5 −12 Original line number Diff line number Diff line Loading @@ -15,11 +15,9 @@ * limitations under the License. */ #include <android_bluetooth_flags.h> #include <base/functional/bind.h> #include <base/strings/string_number_conversions.h> #ifdef __ANDROID__ #include <com_android_bluetooth_flags.h> #endif #include <lc3.h> #include <deque> Loading Loading @@ -166,11 +164,9 @@ std::ostream& operator<<(std::ostream& os, const AudioState& audio_state) { namespace { void le_audio_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data); #ifdef __ANDROID__ static void le_audio_health_status_callback(const RawAddress& addr, int group_id, LeAudioHealthBasedAction action); #endif class LeAudioClientImpl; LeAudioClientImpl* instance; Loading Loading @@ -254,14 +250,12 @@ class LeAudioClientImpl : public LeAudioClient { reconnection_mode_ = BTM_BLE_BKG_CONNECT_ALLOW_LIST; } #ifdef __ANDROID__ if (com::android::bluetooth::flags::leaudio_enable_health_based_actions()) { if (IS_FLAG_ENABLED(leaudio_enable_health_based_actions)) { LOG_INFO("Loading health status module"); leAudioHealthStatus_ = LeAudioHealthStatus::Get(); leAudioHealthStatus_->RegisterCallback( base::BindRepeating(le_audio_health_status_callback)); } #endif BTA_GATTC_AppRegister( le_audio_gattc_callback, Loading Loading @@ -5481,14 +5475,13 @@ class LeAudioClientImpl : public LeAudioClient { } }; #ifdef __ANDROID__ void le_audio_health_status_callback(const RawAddress& addr, int group_id, static void le_audio_health_status_callback(const RawAddress& addr, int group_id, LeAudioHealthBasedAction action) { if (instance) { instance->LeAudioHealthSendRecommendation(addr, group_id, action); } } #endif /* This is a generic callback method for gatt client which handles every client * application events. Loading system/bta/le_audio/state_machine.cc +2 −7 Original line number Diff line number Diff line Loading @@ -17,12 +17,10 @@ #include "state_machine.h" #include <android_bluetooth_flags.h> #include <base/functional/bind.h> #include <base/functional/callback.h> #include <base/strings/string_number_conversions.h> #ifdef __ANDROID__ #include <com_android_bluetooth_flags.h> #endif #include "bta_gatt_queue.h" #include "btm_iso_api.h" Loading Loading @@ -307,9 +305,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine { void notifyLeAudioHealth(LeAudioDeviceGroup* group, le_audio::LeAudioHealthGroupStatType stat) { #ifdef __ANDROID__ if (!com::android::bluetooth::flags:: leaudio_enable_health_based_actions()) { if (!IS_FLAG_ENABLED(leaudio_enable_health_based_actions)) { return; } Loading @@ -317,7 +313,6 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine { if (leAudioHealthStatus) { leAudioHealthStatus->AddStatisticForGroup(group, stat); } #endif } void ProcessGattCtpNotification(LeAudioDeviceGroup* group, uint8_t* value, Loading Loading
flags/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ java_aconfig_library { cc_aconfig_library { name: "bluetooth_flags_c_lib", aconfig_declarations: "bluetooth_aconfig_flags", export_include_dirs: ["exported_include"], host_supported: true, visibility: [ "//packages/modules/Bluetooth/system:__subpackages__", Loading
flags/exported_include/android_bluetooth_flags.h 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright 2023 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. */ #pragma once #ifndef TARGET_FLOSS #include <com_android_bluetooth_flags.h> #define IS_FLAG_ENABLED(flag_name) com::android::bluetooth::flags::flag_name() #define IS_FLAG_ENABLED_P(provider, flag_name) provider.flag_name() #else // FLOSS does not yet support android aconfig flags #define IS_FLAG_ENABLED(flag_name) false #define IS_FLAG_ENABLED_P(provider, flag_name) false namespace com::android::bluetooth::flags { struct flag_provider_interface {}; } // namespace com::android::bluetooth::flags #endif
system/BUILD.gn +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ if (defined(use.android) && use.android) { config("target_defaults") { include_dirs = [ "//bt/system", "//bt/flags/exported_include", "//bt/system/linux_include", "//bt/system/types", "//bt/system/include", Loading
system/bta/le_audio/client.cc +5 −12 Original line number Diff line number Diff line Loading @@ -15,11 +15,9 @@ * limitations under the License. */ #include <android_bluetooth_flags.h> #include <base/functional/bind.h> #include <base/strings/string_number_conversions.h> #ifdef __ANDROID__ #include <com_android_bluetooth_flags.h> #endif #include <lc3.h> #include <deque> Loading Loading @@ -166,11 +164,9 @@ std::ostream& operator<<(std::ostream& os, const AudioState& audio_state) { namespace { void le_audio_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data); #ifdef __ANDROID__ static void le_audio_health_status_callback(const RawAddress& addr, int group_id, LeAudioHealthBasedAction action); #endif class LeAudioClientImpl; LeAudioClientImpl* instance; Loading Loading @@ -254,14 +250,12 @@ class LeAudioClientImpl : public LeAudioClient { reconnection_mode_ = BTM_BLE_BKG_CONNECT_ALLOW_LIST; } #ifdef __ANDROID__ if (com::android::bluetooth::flags::leaudio_enable_health_based_actions()) { if (IS_FLAG_ENABLED(leaudio_enable_health_based_actions)) { LOG_INFO("Loading health status module"); leAudioHealthStatus_ = LeAudioHealthStatus::Get(); leAudioHealthStatus_->RegisterCallback( base::BindRepeating(le_audio_health_status_callback)); } #endif BTA_GATTC_AppRegister( le_audio_gattc_callback, Loading Loading @@ -5481,14 +5475,13 @@ class LeAudioClientImpl : public LeAudioClient { } }; #ifdef __ANDROID__ void le_audio_health_status_callback(const RawAddress& addr, int group_id, static void le_audio_health_status_callback(const RawAddress& addr, int group_id, LeAudioHealthBasedAction action) { if (instance) { instance->LeAudioHealthSendRecommendation(addr, group_id, action); } } #endif /* This is a generic callback method for gatt client which handles every client * application events. Loading
system/bta/le_audio/state_machine.cc +2 −7 Original line number Diff line number Diff line Loading @@ -17,12 +17,10 @@ #include "state_machine.h" #include <android_bluetooth_flags.h> #include <base/functional/bind.h> #include <base/functional/callback.h> #include <base/strings/string_number_conversions.h> #ifdef __ANDROID__ #include <com_android_bluetooth_flags.h> #endif #include "bta_gatt_queue.h" #include "btm_iso_api.h" Loading Loading @@ -307,9 +305,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine { void notifyLeAudioHealth(LeAudioDeviceGroup* group, le_audio::LeAudioHealthGroupStatType stat) { #ifdef __ANDROID__ if (!com::android::bluetooth::flags:: leaudio_enable_health_based_actions()) { if (!IS_FLAG_ENABLED(leaudio_enable_health_based_actions)) { return; } Loading @@ -317,7 +313,6 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine { if (leAudioHealthStatus) { leAudioHealthStatus->AddStatisticForGroup(group, stat); } #endif } void ProcessGattCtpNotification(LeAudioDeviceGroup* group, uint8_t* value, Loading