From: Jakub Pawlowski Date: Mon, 23 Jul 2018 17:00:25 +0000 (-0700) Subject: Uprev libchrome to r576279 (1/multiple) X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f945ce82374cc885b6811bf3c6177520bacc9385;p=android-x86%2Fsystem-bt.git Uprev libchrome to r576279 (1/multiple) This patch brings the latest and greatest features of libchrome to android. It contains ~2600 patches. Reason for uprev: libbluetooth want to use some of the most recent features avaliable. Test: libchrome_test Change-Id: I5f8d5931b404767d3b86cb3bd8df2a05dd67a768 Merged-In: I5f8d5931b404767d3b86cb3bd8df2a05dd67a768 (cherry picked from commit 6563f68968249876cd96b805d37c33d75836e8d8) --- diff --git a/btif/include/btif_common.h b/btif/include/btif_common.h index 9ceaac688..39034c35e 100644 --- a/btif/include/btif_common.h +++ b/btif/include/btif_common.h @@ -23,8 +23,8 @@ #include #include +#include #include -#include #include #include "bt_types.h" @@ -175,7 +175,7 @@ typedef struct { ******************************************************************************/ extern bt_status_t do_in_jni_thread(base::OnceClosure task); -extern bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, +extern bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task); extern bool is_on_jni_thread(); extern base::MessageLoop* get_jni_message_loop(); @@ -184,11 +184,11 @@ extern base::MessageLoop* get_jni_message_loop(); * thread */ template -base::Callback jni_thread_wrapper( - const tracked_objects::Location& from_here, base::Callback cb) { +base::Callback jni_thread_wrapper(const base::Location& from_here, + base::Callback cb) { return base::Bind( - [](const tracked_objects::Location& from_here, - base::Callback cb, Args... args) { + [](const base::Location& from_here, base::Callback cb, + Args... args) { do_in_jni_thread(from_here, base::Bind(cb, std::forward(args)...)); }, diff --git a/btif/src/btif_core.cc b/btif/src/btif_core.cc index 1072b5273..aa77979ac 100644 --- a/btif/src/btif_core.cc +++ b/btif/src/btif_core.cc @@ -220,7 +220,7 @@ bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, * This function posts a task into the btif message loop, that executes it in * the JNI message loop. **/ -bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, +bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { if (!jni_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": Post task to task runner failed!"; diff --git a/btif/src/btif_hearing_aid.cc b/btif/src/btif_hearing_aid.cc index ec742fb0a..4f6641759 100644 --- a/btif/src/btif_hearing_aid.cc +++ b/btif/src/btif_hearing_aid.cc @@ -37,11 +37,12 @@ using bluetooth::hearing_aid::HearingAidInterface; // template specialization template <> -base::Callback jni_thread_wrapper( - const tracked_objects::Location& from_here, base::Callback cb) { +base::Callback jni_thread_wrapper(const base::Location& from_here, + base::Callback cb) { return base::Bind( - [](const tracked_objects::Location& from_here, - base::Callback cb) { do_in_jni_thread(from_here, cb); }, + [](const base::Location& from_here, base::Callback cb) { + do_in_jni_thread(from_here, cb); + }, from_here, std::move(cb)); } diff --git a/btif/src/btif_profile_queue.cc b/btif/src/btif_profile_queue.cc index 02d6ddf0c..41275f127 100644 --- a/btif/src/btif_profile_queue.cc +++ b/btif/src/btif_profile_queue.cc @@ -29,6 +29,7 @@ #include "btif_profile_queue.h" #include +#include #include #include #include diff --git a/btif/test/btif_profile_queue_test.cc b/btif/test/btif_profile_queue_test.cc index efa9461d0..486959b56 100644 --- a/btif/test/btif_profile_queue_test.cc +++ b/btif/test/btif_profile_queue_test.cc @@ -15,12 +15,14 @@ * limitations under the License. * ******************************************************************************/ +#include "btif/include/btif_profile_queue.h" + #include #include +#include +#include -#include "base/location.h" -#include "btif/include/btif_profile_queue.h" #include "stack_manager.h" #include "types/raw_address.h" @@ -33,7 +35,7 @@ bool get_stack_is_running(void) { return sStackRunning; } static stack_manager_t sStackManager = {nullptr, nullptr, nullptr, nullptr, get_stack_is_running}; const stack_manager_t* stack_manager_get_interface() { return &sStackManager; } -bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, +bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { std::move(task).Run(); return BT_STATUS_SUCCESS; diff --git a/build/secondary/third_party/libchrome/BUILD.gn b/build/secondary/third_party/libchrome/BUILD.gn index df6a886e6..2c561e6e9 100644 --- a/build/secondary/third_party/libchrome/BUILD.gn +++ b/build/secondary/third_party/libchrome/BUILD.gn @@ -208,7 +208,7 @@ source_set("base_sources") { "base/trace_event/trace_event_synthetic_delay.cc", "base/trace_event/trace_log.cc", "base/trace_event/trace_log_constants.cc", - "base/tracked_objects.cc", + "base/base.cc", "base/tracking_info.cc", "base/values.cc", "base/vlog.cc", diff --git a/common/message_loop_thread.cc b/common/message_loop_thread.cc index 837bd5921..e2c2e2d92 100644 --- a/common/message_loop_thread.cc +++ b/common/message_loop_thread.cc @@ -14,14 +14,14 @@ * limitations under the License. */ +#include "message_loop_thread.h" + #include #include #include #include -#include "message_loop_thread.h" - namespace bluetooth { namespace common { @@ -56,14 +56,14 @@ void MessageLoopThread::StartUp() { start_up_future.wait(); } -bool MessageLoopThread::DoInThread(const tracked_objects::Location& from_here, +bool MessageLoopThread::DoInThread(const base::Location& from_here, base::OnceClosure task) { return DoInThreadDelayed(from_here, std::move(task), base::TimeDelta()); } -bool MessageLoopThread::DoInThreadDelayed( - const tracked_objects::Location& from_here, base::OnceClosure task, - const base::TimeDelta& delay) { +bool MessageLoopThread::DoInThreadDelayed(const base::Location& from_here, + base::OnceClosure task, + const base::TimeDelta& delay) { std::lock_guard api_lock(api_mutex_); if (message_loop_ == nullptr) { LOG(ERROR) << __func__ << ": message loop is null for thread " << *this diff --git a/common/message_loop_thread.h b/common/message_loop_thread.h index c0b0b2892..b25f43862 100644 --- a/common/message_loop_thread.h +++ b/common/message_loop_thread.h @@ -23,10 +23,10 @@ #include #include +#include #include #include #include -#include namespace bluetooth { @@ -67,8 +67,7 @@ class MessageLoopThread final { * @return true if task is successfully scheduled, false if task cannot be * scheduled */ - bool DoInThread(const tracked_objects::Location& from_here, - base::OnceClosure task); + bool DoInThread(const base::Location& from_here, base::OnceClosure task); /** * Shutdown the current thread as if it is never started. IsRunning() and @@ -174,7 +173,7 @@ class MessageLoopThread final { * @return true if task is successfully scheduled, false if task cannot be * scheduled */ - bool DoInThreadDelayed(const tracked_objects::Location& from_here, + bool DoInThreadDelayed(const base::Location& from_here, base::OnceClosure task, const base::TimeDelta& delay); friend class Timer; // allow Timer to use DoInThreadDelayed() diff --git a/common/message_loop_thread_unittest.cc b/common/message_loop_thread_unittest.cc index e77a44ce1..0e8f0a462 100644 --- a/common/message_loop_thread_unittest.cc +++ b/common/message_loop_thread_unittest.cc @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "message_loop_thread.h" #include #include @@ -22,12 +23,9 @@ #include #include -#include #include #include -#include "message_loop_thread.h" - using bluetooth::common::MessageLoopThread; /** diff --git a/common/timer.cc b/common/timer.cc index f02a67dad..f0037d128 100644 --- a/common/timer.cc +++ b/common/timer.cc @@ -34,14 +34,14 @@ Timer::~Timer() { // This runs on user thread bool Timer::Schedule(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, - base::Closure task, base::TimeDelta delay) { + const base::Location& from_here, base::Closure task, + base::TimeDelta delay) { return ScheduleTaskHelper(thread, from_here, std::move(task), delay, false); } // This runs on user thread bool Timer::SchedulePeriodic(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, + const base::Location& from_here, base::Closure task, base::TimeDelta period) { if (period < kMinimumPeriod) { LOG(ERROR) << __func__ << ": period must be at least " << kMinimumPeriod; @@ -52,7 +52,7 @@ bool Timer::SchedulePeriodic(const base::WeakPtr& thread, // This runs on user thread bool Timer::ScheduleTaskHelper(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, + const base::Location& from_here, base::Closure task, base::TimeDelta delay, bool is_periodic) { uint64_t time_now_us = time_get_os_boottime_us(); diff --git a/common/timer.h b/common/timer.h index 3221fb8ab..5a02dd664 100644 --- a/common/timer.h +++ b/common/timer.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include namespace bluetooth { @@ -54,7 +54,7 @@ class Timer final { * @return true iff task is scheduled successfully */ bool Schedule(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, base::Closure task, + const base::Location& from_here, base::Closure task, base::TimeDelta delay); /** @@ -70,8 +70,8 @@ class Timer final { * @return true iff task is scheduled successfully */ bool SchedulePeriodic(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, - base::Closure task, base::TimeDelta period); + const base::Location& from_here, base::Closure task, + base::TimeDelta period); /** * Post an event which cancels the current task asynchronously @@ -99,9 +99,8 @@ class Timer final { uint64_t expected_time_next_task_us_; // Using clock boot time in time_util.h mutable std::recursive_mutex api_mutex_; bool ScheduleTaskHelper(const base::WeakPtr& thread, - const tracked_objects::Location& from_here, - base::Closure task, base::TimeDelta delay, - bool is_periodic); + const base::Location& from_here, base::Closure task, + base::TimeDelta delay, bool is_periodic); void CancelHelper(std::promise promise); void CancelClosure(std::promise promise); diff --git a/hci/include/hci_layer.h b/hci/include/hci_layer.h index c732e0c2e..5eb2bd5cc 100644 --- a/hci/include/hci_layer.h +++ b/hci/include/hci_layer.h @@ -18,8 +18,8 @@ #pragma once -#include -#include +#include +#include #include #include "bt_types.h" @@ -70,8 +70,7 @@ typedef void (*command_status_cb)(uint8_t status, BT_HDR* command, typedef struct hci_t { // Set the callback that the HCI layer uses to send data upwards void (*set_data_cb)( - base::Callback - send_data_cb); + base::Callback send_data_cb); // Send a command through the HCI layer void (*transmit_command)(BT_HDR* command, @@ -91,7 +90,6 @@ const hci_t* hci_layer_get_test_interface( const btsnoop_t* btsnoop_interface, const packet_fragmenter_t* packet_fragmenter_interface); -void post_to_main_message_loop(const tracked_objects::Location& from_here, - BT_HDR* p_msg); +void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg); void hci_layer_cleanup_interface(); diff --git a/hci/src/hci_layer.cc b/hci/src/hci_layer.cc index a2b27976d..feb5445e7 100644 --- a/hci/src/hci_layer.cc +++ b/hci/src/hci_layer.cc @@ -108,8 +108,7 @@ static std::recursive_timed_mutex commands_pending_response_mutex; static alarm_t* hci_timeout_abort_timer; // The hand-off point for data going to a higher layer, set by the higher layer -static base::Callback - send_data_upwards; +static base::Callback send_data_upwards; static bool filter_incoming_event(BT_HDR* packet); static waiting_command_t* get_waiting_command(command_opcode_t opcode); @@ -138,8 +137,7 @@ void initialization_complete() { hci_thread.DoInThread(FROM_HERE, base::Bind(&event_finish_startup, nullptr)); } -void hci_event_received(const tracked_objects::Location& from_here, - BT_HDR* packet) { +void hci_event_received(const base::Location& from_here, BT_HDR* packet) { btsnoop->capture(packet, true); if (!filter_incoming_event(packet)) { @@ -280,8 +278,7 @@ EXPORT_SYMBOL extern const module_t hci_module = { // Interface functions static void set_data_cb( - base::Callback - send_data_cb) { + base::Callback send_data_cb) { send_data_upwards = std::move(send_data_cb); } diff --git a/hci/src/hci_layer_android.cc b/hci/src/hci_layer_android.cc index 183b74e7c..be0a7ebf9 100644 --- a/hci/src/hci_layer_android.cc +++ b/hci/src/hci_layer_android.cc @@ -47,8 +47,7 @@ using ::android::hardware::Void; using ::android::hardware::hidl_vec; extern void initialization_complete(); -extern void hci_event_received(const tracked_objects::Location& from_here, - BT_HDR* packet); +extern void hci_event_received(const base::Location& from_here, BT_HDR* packet); extern void acl_event_received(BT_HDR* packet); extern void sco_data_received(BT_HDR* packet); diff --git a/hci/src/hci_layer_linux.cc b/hci/src/hci_layer_linux.cc index e32b5ef90..5a3dacce0 100644 --- a/hci/src/hci_layer_linux.cc +++ b/hci/src/hci_layer_linux.cc @@ -93,8 +93,7 @@ enum HciPacketType { }; extern void initialization_complete(); -extern void hci_event_received(const tracked_objects::Location& from_here, - BT_HDR* packet); +extern void hci_event_received(const base::Location& from_here, BT_HDR* packet); extern void acl_event_received(BT_HDR* packet); extern void sco_data_received(BT_HDR* packet); diff --git a/main/bte_main.cc b/main/bte_main.cc index 04e564f55..049843933 100644 --- a/main/bte_main.cc +++ b/main/bte_main.cc @@ -96,8 +96,7 @@ extern void btu_hci_msg_process(BT_HDR* p_msg); * Returns None * *****************************************************************************/ -void post_to_main_message_loop(const tracked_objects::Location& from_here, - BT_HDR* p_msg) { +void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg) { if (do_in_main_thread(from_here, base::Bind(&btu_hci_msg_process, p_msg)) != BT_STATUS_SUCCESS) { LOG(ERROR) << __func__ << ": do_in_main_thread failed from " diff --git a/profile/avrcp/Android.bp b/profile/avrcp/Android.bp index 607ddd647..ba0610dcd 100644 --- a/profile/avrcp/Android.bp +++ b/profile/avrcp/Android.bp @@ -18,6 +18,9 @@ cc_library_static { "libbluetooth-types", "libosi", ], + shared_libs: [ + "libchrome", + ], } cc_test { @@ -44,6 +47,9 @@ cc_test { "libbtdevice", "avrcp-target-service", ], + shared_libs: [ + "libchrome", + ], sanitize: { cfi: false, }, diff --git a/profile/avrcp/device.cc b/profile/avrcp/device.cc index 67186cf63..1d311ee44 100644 --- a/profile/avrcp/device.cc +++ b/profile/avrcp/device.cc @@ -13,19 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "device.h" #include #include "connection_handler.h" -#include "device.h" -#include "stack_config.h" - #include "packet/avrcp/avrcp_reject_packet.h" #include "packet/avrcp/general_reject_packet.h" #include "packet/avrcp/get_play_status_packet.h" #include "packet/avrcp/pass_through_packet.h" #include "packet/avrcp/set_absolute_volume.h" #include "packet/avrcp/set_addressed_player.h" +#include "stack_config.h" namespace bluetooth { namespace avrcp { diff --git a/service/Android.bp b/service/Android.bp index 6d136aa15..d57119adc 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -91,6 +91,7 @@ cc_binary { ], shared_libs: [ + "libchrome", "libbinder", "libcutils", "liblog", @@ -123,6 +124,10 @@ cc_test { "libbluetooth-types", "libutils", ], + shared_libs: [ + "libchrome", + ], + host_supported: true, target: { // This includes Binder related tests that can only be run diff --git a/service/example/heart_rate/server_main.cc b/service/example/heart_rate/server_main.cc index 8ffded6fb..7423462f0 100644 --- a/service/example/heart_rate/server_main.cc +++ b/service/example/heart_rate/server_main.cc @@ -41,10 +41,7 @@ namespace { std::string kServiceName = "bluetooth-service"; void QuitMessageLoop() { - // I don't know why both of these calls are necessary but the message loop - // doesn't stop unless I call both. Bug in base::MessageLoop? base::RunLoop().Quit(); - base::MessageLoop::current()->QuitNow(); } // Handles the case where the Bluetooth process dies. @@ -134,7 +131,7 @@ int main(int argc, char* argv[]) { } LOG(ERROR) << "Starting Heart Rate server failed asynchronously"; - main_loop.QuitWhenIdle(); + base::RunLoop().QuitWhenIdle(); }; bool advertise = diff --git a/service/gatt_server_old.cc b/service/gatt_server_old.cc index e97a6c5ad..b583d9343 100644 --- a/service/gatt_server_old.cc +++ b/service/gatt_server_old.cc @@ -23,6 +23,8 @@ #include #include +#include +#include #include #include #include @@ -77,8 +79,6 @@ enum { kPipeReadEnd = 0, kPipeWriteEnd = 1, kPipeNumEnds = 2 }; } // namespace -void DoNothing(uint8_t p) {} - namespace bluetooth { namespace gatt { @@ -354,11 +354,11 @@ void RegisterClientCallback(int status, int client_if, // Setup our advertisement. This has no callback. g_internal->gatt->advertiser->SetData(0 /* std_inst */, false, {/*TODO: put inverval 2,2 here*/}, - base::Bind(&DoNothing)); + base::DoNothing()); g_internal->gatt->advertiser->Enable( 0 /* std_inst */, true, base::Bind(&EnableAdvertisingCallback), - 0 /* no duration */, 0 /* no maxExtAdvEvent*/, base::Bind(&DoNothing)); + 0 /* no duration */, 0 /* no maxExtAdvEvent*/, base::DoNothing()); } void ServiceStoppedCallback(int status, int server_if, int srvc_handle) { @@ -579,7 +579,7 @@ bool Server::SetAdvertisement(const std::vector& ids, // Setup our advertisement. This has no callback. internal_->gatt->advertiser->SetData(0, false, /* beacon, not scan response */ - {}, base::Bind(&DoNothing)); + {}, base::DoNothing()); // transmit_name, /* name */ // 2, 2, interval // mutable_manufacturer_data, @@ -605,7 +605,7 @@ bool Server::SetScanResponse(const std::vector& ids, // Setup our advertisement. This has no callback. internal_->gatt->advertiser->SetData(0, true, /* scan response */ - {}, base::Bind(&DoNothing)); + {}, base::DoNothing()); // transmit_name, /* name */ // false, /* no txpower */ // 2, 2, interval diff --git a/service/hal/bluetooth_av_interface.cc b/service/hal/bluetooth_av_interface.cc index 8901e73f9..68f5bd053 100644 --- a/service/hal/bluetooth_av_interface.cc +++ b/service/hal/bluetooth_av_interface.cc @@ -318,7 +318,7 @@ bool BluetoothAvInterface::Initialize() { std::unique_lock lock(g_instance_lock); CHECK(!g_interface); - auto impl = base::MakeUnique(); + auto impl = std::make_unique(); if (!impl->Initialize()) { LOG(ERROR) << "Failed to initialize BluetoothAvInterface"; return false; diff --git a/service/ipc/ipc_handler_linux.h b/service/ipc/ipc_handler_linux.h index 21c71d2e2..7cd6efabe 100644 --- a/service/ipc/ipc_handler_linux.h +++ b/service/ipc/ipc_handler_linux.h @@ -17,7 +17,6 @@ #pragma once #include - #include #include #include diff --git a/service/low_energy_advertiser.cc b/service/low_energy_advertiser.cc index 5f606f93b..7bc5f259c 100644 --- a/service/low_energy_advertiser.cc +++ b/service/low_energy_advertiser.cc @@ -16,14 +16,16 @@ #include "service/low_energy_advertiser.h" -#include -#include - #include "service/adapter.h" #include "service/logging_helpers.h" #include "stack/include/bt_types.h" #include "stack/include/hcidefs.h" +#include +#include +#include +#include + using std::lock_guard; using std::mutex; @@ -113,8 +115,6 @@ void GetAdvertiseParams(const AdvertiseSettings& settings, bool has_scan_rsp, out_params->scan_request_notification_enable = 0; } -void DoNothing(uint8_t status) {} - } // namespace // LowEnergyAdvertiser implementation @@ -133,8 +133,7 @@ LowEnergyAdvertiser::~LowEnergyAdvertiser() { // Stop advertising and ignore the result. hal::BluetoothGattInterface::Get()->GetAdvertiserHALInterface()->Enable( - advertiser_id_, false, base::Bind(&DoNothing), 0, 0, - base::Bind(&DoNothing)); + advertiser_id_, false, base::DoNothing(), 0, 0, base::DoNothing()); hal::BluetoothGattInterface::Get()->GetAdvertiserHALInterface()->Unregister( advertiser_id_); } diff --git a/service/low_energy_scanner.cc b/service/low_energy_scanner.cc index 152756353..82f3ab402 100644 --- a/service/low_energy_scanner.cc +++ b/service/low_energy_scanner.cc @@ -16,14 +16,15 @@ #include "service/low_energy_scanner.h" -#include -#include - #include "service/adapter.h" #include "service/logging_helpers.h" #include "stack/include/bt_types.h" #include "stack/include/hcidefs.h" +#include +#include +#include + using std::lock_guard; using std::mutex; diff --git a/stack/btm/ble_advertiser_hci_interface.cc b/stack/btm/ble_advertiser_hci_interface.cc index 93b517d0a..b3b00d501 100644 --- a/stack/btm/ble_advertiser_hci_interface.cc +++ b/stack/btm/ble_advertiser_hci_interface.cc @@ -17,17 +17,20 @@ ******************************************************************************/ #include "ble_advertiser_hci_interface.h" -#include -#include -#include -#include -#include #include "btm_api.h" #include "btm_ble_api.h" #include "btm_int_types.h" #include "device/include/controller.h" #include "hcidefs.h" +#include +#include + +#include +#include +#include +#include + #define BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN 8 #define BTM_BLE_MULTI_ADV_ENB_LEN 3 #define BTM_BLE_MULTI_ADV_SET_PARAM_LEN 24 @@ -44,9 +47,9 @@ using status_cb = BleAdvertiserHciInterface::status_cb; using hci_cmd_cb = base::Callback; -extern void btu_hcif_send_cmd_with_cb( - const tracked_objects::Location& posted_from, uint16_t opcode, - uint8_t* params, uint8_t params_len, hci_cmd_cb cb); +extern void btu_hcif_send_cmd_with_cb(const base::Location& posted_from, + uint16_t opcode, uint8_t* params, + uint8_t params_len, hci_cmd_cb cb); namespace { BleAdvertiserHciInterface* instance = nullptr; @@ -91,9 +94,8 @@ void known_tx_pwr(BleAdvertiserHciInterface::parameters_cb cb, int8_t tx_power, } class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface { - void SendAdvCmd(const tracked_objects::Location& posted_from, - uint8_t param_len, uint8_t* param_buf, - status_cb command_complete) { + void SendAdvCmd(const base::Location& posted_from, uint8_t param_len, + uint8_t* param_buf, status_cb command_complete) { btu_hcif_send_cmd_with_cb(posted_from, HCI_BLE_MULTI_ADV_OCF, param_buf, param_len, base::Bind(&btm_ble_multi_adv_vsc_cmpl_cback, @@ -304,7 +306,7 @@ void adv_cmd_cmpl_cback(status_cb cb, uint8_t* return_parameters, } class BleAdvertiserLegacyHciInterfaceImpl : public BleAdvertiserHciInterface { - void SendAdvCmd(const tracked_objects::Location& posted_from, uint16_t opcode, + void SendAdvCmd(const base::Location& posted_from, uint16_t opcode, uint8_t* param_buf, uint8_t param_buf_len, status_cb command_complete) { btu_hcif_send_cmd_with_cb( @@ -475,7 +477,7 @@ class BleAdvertiserLegacyHciInterfaceImpl : public BleAdvertiserHciInterface { }; class BleAdvertiserHciExtendedImpl : public BleAdvertiserHciInterface { - void SendAdvCmd(const tracked_objects::Location& posted_from, uint16_t opcode, + void SendAdvCmd(const base::Location& posted_from, uint16_t opcode, uint8_t* param_buf, uint8_t param_buf_len, status_cb command_complete) { btu_hcif_send_cmd_with_cb( diff --git a/stack/btm/ble_advertiser_hci_interface.h b/stack/btm/ble_advertiser_hci_interface.h index c08bb86c7..24e501dbf 100644 --- a/stack/btm/ble_advertiser_hci_interface.h +++ b/stack/btm/ble_advertiser_hci_interface.h @@ -19,10 +19,11 @@ #ifndef BLE_ADVERTISER_HCI_INTERFACE_H #define BLE_ADVERTISER_HCI_INTERFACE_H -#include #include #include "stack/include/bt_types.h" +#include + /* This class is an abstraction of HCI commands used for managing * advertisements. Please see VSC HCI SPEC at * https://static.googleusercontent.com/media/source.android.com/en//devices/Android-6.0-Bluetooth-HCI-Reqs.pdf diff --git a/stack/btm/btm_ble_adv_filter.cc b/stack/btm/btm_ble_adv_filter.cc index 54e038efa..f69f1a227 100644 --- a/stack/btm/btm_ble_adv_filter.cc +++ b/stack/btm/btm_ble_adv_filter.cc @@ -18,11 +18,6 @@ #define LOG_TAG "bt_btm_ble" -#include -#include -#include -#include - #include "bt_target.h" #include "bt_types.h" @@ -34,6 +29,13 @@ #include "hcidefs.h" #include "hcimsgs.h" +#include +#include +#include + +#include +#include + using base::Bind; using bluetooth::Uuid; @@ -594,8 +596,6 @@ void BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action, memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR)); } -void DoNothing(uint8_t a, uint8_t b, uint8_t c) {} - void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index, std::vector commands, tBTM_BLE_PF_CFG_CBACK cb) { @@ -620,7 +620,8 @@ void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index, target_addr.bda = cmd.address; target_addr.type = cmd.addr_type; - BTM_LE_PF_addr_filter(action, filt_index, target_addr, Bind(DoNothing)); + BTM_LE_PF_addr_filter(action, filt_index, target_addr, + base::DoNothing()); break; } @@ -632,24 +633,24 @@ void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index, case BTM_BLE_PF_SRVC_SOL_UUID: { BTM_LE_PF_uuid_filter(action, filt_index, cmd.type, cmd.uuid, BTM_BLE_PF_LOGIC_AND, cmd.uuid_mask, - Bind(DoNothing)); + base::DoNothing()); break; } case BTM_BLE_PF_LOCAL_NAME: { - BTM_LE_PF_local_name(action, filt_index, cmd.name, Bind(DoNothing)); + BTM_LE_PF_local_name(action, filt_index, cmd.name, base::DoNothing()); break; } case BTM_BLE_PF_MANU_DATA: { BTM_LE_PF_manu_data(action, filt_index, cmd.company, cmd.company_mask, - cmd.data, cmd.data_mask, Bind(DoNothing)); + cmd.data, cmd.data_mask, base::DoNothing()); break; } case BTM_BLE_PF_SRVC_DATA_PATTERN: { BTM_LE_PF_srvc_data_pattern(action, filt_index, cmd.data, cmd.data_mask, - Bind(DoNothing)); + base::DoNothing()); break; } diff --git a/stack/btm/btm_ble_multi_adv.cc b/stack/btm/btm_ble_multi_adv.cc index bc9baed65..22d2e176a 100644 --- a/stack/btm/btm_ble_multi_adv.cc +++ b/stack/btm/btm_ble_multi_adv.cc @@ -17,16 +17,6 @@ * ******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "bt_target.h" #include "device/include/controller.h" #include "osi/include/alarm.h" @@ -35,6 +25,18 @@ #include "ble_advertiser_hci_interface.h" #include "btm_int_types.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + using base::Bind; using base::TimeDelta; using base::TimeTicks; @@ -113,12 +115,9 @@ struct AdvertisingInstance { void btm_ble_adv_raddr_timer_timeout(void* data); -void DoNothing(uint8_t) {} -void DoNothing2(uint8_t, uint8_t) {} - struct closure_data { base::Closure user_task; - tracked_objects::Location posted_from; + base::Location posted_from; }; static void alarm_closure_cb(void* p) { @@ -129,9 +128,8 @@ static void alarm_closure_cb(void* p) { } // Periodic alarms are not supported, because we clean up data in callback -void alarm_set_closure(const tracked_objects::Location& posted_from, - alarm_t* alarm, uint64_t interval_ms, - base::Closure user_task) { +void alarm_set_closure(const base::Location& posted_from, alarm_t* alarm, + uint64_t interval_ms, base::Closure user_task) { closure_data* data = new closure_data; data->posted_from = posted_from; data->user_task = std::move(user_task); @@ -216,7 +214,7 @@ class BleAdvertisingManagerImpl if (restart) { p_inst->enable_status = false; hci_interface->Enable(false, p_inst->inst_id, 0x00, 0x00, - Bind(DoNothing)); + base::DoNothing()); } /* set it to controller */ @@ -233,7 +231,7 @@ class BleAdvertisingManagerImpl if (restart) { p_inst->enable_status = true; hci_interface->Enable(true, p_inst->inst_id, 0x00, 0x00, - Bind(DoNothing)); + base::DoNothing()); } }, p_inst, std::move(configuredCb))); @@ -600,7 +598,7 @@ class BleAdvertisingManagerImpl base::Closure cb = Bind( &BleAdvertisingManagerImpl::Enable, weak_factory_.GetWeakPtr(), inst_id, - 0 /* disable */, std::move(timeout_cb), 0, 0, base::Bind(DoNothing)); + 0 /* disable */, std::move(timeout_cb), 0, 0, base::DoNothing()); // schedule disable when the timeout passes alarm_set_closure(FROM_HERE, p_inst->timeout_timer, duration * 10, @@ -684,7 +682,7 @@ class BleAdvertisingManagerImpl // TODO: disable only if was enabled, currently no use scenario needs // that, // we always set parameters before enabling - // GetHciInterface()->Enable(false, inst_id, Bind(DoNothing)); + // GetHciInterface()->Enable(false, inst_id, base::DoNothing()); p_inst->advertising_event_properties = p_params->advertising_event_properties; p_inst->tx_power = p_params->tx_power; @@ -859,18 +857,18 @@ class BleAdvertisingManagerImpl if (adv_inst[inst_id].IsEnabled()) { p_inst->enable_status = false; - GetHciInterface()->Enable(false, inst_id, 0x00, 0x00, Bind(DoNothing)); + GetHciInterface()->Enable(false, inst_id, 0x00, 0x00, base::DoNothing()); } if (p_inst->periodic_enabled) { p_inst->periodic_enabled = false; GetHciInterface()->SetPeriodicAdvertisingEnable(false, inst_id, - Bind(DoNothing)); + base::DoNothing()); } alarm_cancel(p_inst->adv_raddr_timer); p_inst->in_use = false; - GetHciInterface()->RemoveAdvertisingSet(inst_id, Bind(DoNothing)); + GetHciInterface()->RemoveAdvertisingSet(inst_id, base::DoNothing()); p_inst->address_update_required = false; } @@ -913,7 +911,8 @@ class BleAdvertisingManagerImpl sets.emplace_back(SetEnableData{.handle = inst.inst_id}); } - if (!sets.empty()) GetHciInterface()->Enable(false, sets, Bind(DoNothing)); + if (!sets.empty()) + GetHciInterface()->Enable(false, sets, base::DoNothing()); } void Resume() override { @@ -928,7 +927,7 @@ class BleAdvertisingManagerImpl } } - if (!sets.empty()) GetHciInterface()->Enable(true, sets, Bind(DoNothing)); + if (!sets.empty()) GetHciInterface()->Enable(true, sets, base::DoNothing()); } void OnAdvertisingSetTerminated( @@ -969,7 +968,7 @@ class BleAdvertisingManagerImpl RecomputeTimeout(p_inst, TimeTicks::Now()); if (p_inst->enable_status) { GetHciInterface()->Enable(true, advertising_handle, p_inst->duration, - p_inst->maxExtAdvEvents, Bind(DoNothing)); + p_inst->maxExtAdvEvents, base::DoNothing()); } } else { @@ -1010,7 +1009,7 @@ class BleAdvertisingManagerImpl void btm_ble_adv_raddr_timer_timeout(void* data) { BleAdvertisingManagerImpl* ptr = instance_weakptr.get(); - if (ptr) ptr->ConfigureRpa((AdvertisingInstance*)data, base::Bind(DoNothing)); + if (ptr) ptr->ConfigureRpa((AdvertisingInstance*)data, base::DoNothing()); } } // namespace @@ -1043,7 +1042,7 @@ void btm_ble_adv_init() { if (BleAdvertiserHciInterface::Get()->QuirkAdvertiserZeroHandle()) { // If handle 0 can't be used, register advertiser for it, but never use it. - BleAdvertisingManager::Get().get()->RegisterAdvertiser(Bind(DoNothing2)); + BleAdvertisingManager::Get().get()->RegisterAdvertiser(base::DoNothing()); } } diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index e61c16a5d..c32341de5 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -49,7 +49,7 @@ #include "osi/include/log.h" #include "osi/include/osi.h" -using tracked_objects::Location; +using base::Location; extern void btm_process_cancel_complete(uint8_t status, uint8_t mode); extern void btm_ble_test_command_complete(uint8_t* p); @@ -463,9 +463,9 @@ static void btu_hcif_command_status_evt_with_cb(uint8_t status, BT_HDR* command, /* This function is called to send commands to the Host Controller. |cb| is * called when command status event is called with error code, or when the * command complete event is received. */ -void btu_hcif_send_cmd_with_cb(const tracked_objects::Location& posted_from, - uint16_t opcode, uint8_t* params, - uint8_t params_len, hci_cmd_cb cb) { +void btu_hcif_send_cmd_with_cb(const Location& posted_from, uint16_t opcode, + uint8_t* params, uint8_t params_len, + hci_cmd_cb cb) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); diff --git a/stack/btu/btu_task.cc b/stack/btu/btu_task.cc index a19770198..b6681821f 100644 --- a/stack/btu/btu_task.cc +++ b/stack/btu/btu_task.cc @@ -23,11 +23,6 @@ #include #include -#include -#include -#include -#include - #include "bta/sys/bta_sys.h" #include "btcore/include/module.h" #include "bte.h" @@ -38,6 +33,11 @@ #include "stack/include/btu.h" #include "stack/l2cap/l2c_int.h" +#include +#include +#include +#include + using bluetooth::common::MessageLoopThread; /* Define BTU storage area */ @@ -83,7 +83,7 @@ base::MessageLoop* get_main_message_loop() { return main_thread.message_loop(); } -bt_status_t do_in_main_thread(const tracked_objects::Location& from_here, +bt_status_t do_in_main_thread(const base::Location& from_here, base::OnceClosure task) { if (!main_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": failed from " << from_here.ToString(); diff --git a/stack/include/avrc_api.h b/stack/include/avrc_api.h index 1aa8ea4e8..77c37dec1 100644 --- a/stack/include/avrc_api.h +++ b/stack/include/avrc_api.h @@ -24,13 +24,13 @@ #ifndef AVRC_API_H #define AVRC_API_H -#include - #include "avct_api.h" #include "avrc_defs.h" #include "bt_target.h" #include "sdp_api.h" +#include + /***************************************************************************** * constants ****************************************************************************/ diff --git a/stack/include/btu.h b/stack/include/btu.h index 00a690cee..43bd48b6b 100644 --- a/stack/include/btu.h +++ b/stack/include/btu.h @@ -27,14 +27,15 @@ #ifndef BTU_H #define BTU_H -#include -#include -#include #include "bt_common.h" #include "bt_target.h" #include "common/message_loop_thread.h" #include "osi/include/alarm.h" +#include +#include +#include + /* Global BTU data */ extern uint8_t btu_trace_level; @@ -43,7 +44,7 @@ extern uint8_t btu_trace_level; */ void btu_hcif_process_event(uint8_t controller_id, BT_HDR* p_buf); void btu_hcif_send_cmd(uint8_t controller_id, BT_HDR* p_msg); -void btu_hcif_send_cmd_with_cb(const tracked_objects::Location& posted_from, +void btu_hcif_send_cmd_with_cb(const base::Location& posted_from, uint16_t opcode, uint8_t* params, uint8_t params_len, base::Callback cb); @@ -58,7 +59,7 @@ void btu_free_core(void); *********************************** */ base::MessageLoop* get_main_message_loop(); -bt_status_t do_in_main_thread(const tracked_objects::Location& from_here, +bt_status_t do_in_main_thread(const base::Location& from_here, base::OnceClosure task); void BTU_StartUp(void); diff --git a/stack/test/stack_btu_test.cc b/stack/test/stack_btu_test.cc index 3b0c898d6..5976bb219 100644 --- a/stack/test/stack_btu_test.cc +++ b/stack/test/stack_btu_test.cc @@ -66,7 +66,7 @@ void btu_task_shut_down(void* context); /* Below are methods and variables that must be implemented if we don't want to * compile the whole stack. They will be removed, or changed into mocks one by * one in the future, as the refactoring progresses */ -bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, +bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { helper.notify(); return BT_STATUS_SUCCESS; diff --git a/vendor_libs/test_vendor_lib/src/device_properties.cc b/vendor_libs/test_vendor_lib/src/device_properties.cc index 672dd6533..81c007aea 100644 --- a/vendor_libs/test_vendor_lib/src/device_properties.cc +++ b/vendor_libs/test_vendor_lib/src/device_properties.cc @@ -33,12 +33,12 @@ using std::vector; namespace { // Functions used by JSONValueConverter to read stringified JSON. -bool ParseUint8t(const base::StringPiece& value, uint8_t* field) { +bool ParseUint8t(base::StringPiece value, uint8_t* field) { *field = std::stoi(value.as_string()); return true; } -bool ParseUint16t(const base::StringPiece& value, uint16_t* field) { +bool ParseUint16t(base::StringPiece value, uint16_t* field) { *field = std::stoi(value.as_string()); return true; }