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/system/btif/include/btif_common.h b/system/btif/include/btif_common.h
index 9ceaac6..39034c3 100644
--- a/system/btif/include/btif_common.h
+++ b/system/btif/include/btif_common.h
@@ -23,8 +23,8 @@
 #include <stdlib.h>
 
 #include <base/bind.h>
+#include <base/location.h>
 #include <base/message_loop/message_loop.h>
-#include <base/tracked_objects.h>
 #include <hardware/bluetooth.h>
 
 #include "bt_types.h"
@@ -175,7 +175,7 @@
  ******************************************************************************/
 
 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 @@
  * thread
  */
 template <typename R, typename... Args>
-base::Callback<R(Args...)> jni_thread_wrapper(
-    const tracked_objects::Location& from_here, base::Callback<R(Args...)> cb) {
+base::Callback<R(Args...)> jni_thread_wrapper(const base::Location& from_here,
+                                              base::Callback<R(Args...)> cb) {
   return base::Bind(
-      [](const tracked_objects::Location& from_here,
-         base::Callback<R(Args...)> cb, Args... args) {
+      [](const base::Location& from_here, base::Callback<R(Args...)> cb,
+         Args... args) {
         do_in_jni_thread(from_here,
                          base::Bind(cb, std::forward<Args>(args)...));
       },
diff --git a/system/btif/src/btif_core.cc b/system/btif/src/btif_core.cc
index 1072b52..aa77979 100644
--- a/system/btif/src/btif_core.cc
+++ b/system/btif/src/btif_core.cc
@@ -220,7 +220,7 @@
  * 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/system/btif/src/btif_hearing_aid.cc b/system/btif/src/btif_hearing_aid.cc
index ec742fb..4f66417 100644
--- a/system/btif/src/btif_hearing_aid.cc
+++ b/system/btif/src/btif_hearing_aid.cc
@@ -37,11 +37,12 @@
 
 // template specialization
 template <>
-base::Callback<void()> jni_thread_wrapper(
-    const tracked_objects::Location& from_here, base::Callback<void()> cb) {
+base::Callback<void()> jni_thread_wrapper(const base::Location& from_here,
+                                          base::Callback<void()> cb) {
   return base::Bind(
-      [](const tracked_objects::Location& from_here,
-         base::Callback<void()> cb) { do_in_jni_thread(from_here, cb); },
+      [](const base::Location& from_here, base::Callback<void()> cb) {
+        do_in_jni_thread(from_here, cb);
+      },
       from_here, std::move(cb));
 }
 
diff --git a/system/btif/src/btif_profile_queue.cc b/system/btif/src/btif_profile_queue.cc
index 02d6ddf..41275f1 100644
--- a/system/btif/src/btif_profile_queue.cc
+++ b/system/btif/src/btif_profile_queue.cc
@@ -29,6 +29,7 @@
 #include "btif_profile_queue.h"
 
 #include <base/bind.h>
+#include <base/callback.h>
 #include <base/logging.h>
 #include <base/strings/stringprintf.h>
 #include <string.h>
diff --git a/system/btif/test/btif_profile_queue_test.cc b/system/btif/test/btif_profile_queue_test.cc
index efa9461..486959b 100644
--- a/system/btif/test/btif_profile_queue_test.cc
+++ b/system/btif/test/btif_profile_queue_test.cc
@@ -15,12 +15,14 @@
  *  limitations under the License.
  *
  ******************************************************************************/
+#include "btif/include/btif_profile_queue.h"
+
 #include <gtest/gtest.h>
 
 #include <base/bind.h>
+#include <base/callback.h>
+#include <base/location.h>
 
-#include "base/location.h"
-#include "btif/include/btif_profile_queue.h"
 #include "stack_manager.h"
 #include "types/raw_address.h"
 
@@ -33,7 +35,7 @@
 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/system/build/secondary/third_party/libchrome/BUILD.gn b/system/build/secondary/third_party/libchrome/BUILD.gn
index df6a886..2c561e6 100644
--- a/system/build/secondary/third_party/libchrome/BUILD.gn
+++ b/system/build/secondary/third_party/libchrome/BUILD.gn
@@ -208,7 +208,7 @@
     "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/system/common/message_loop_thread.cc b/system/common/message_loop_thread.cc
index 837bd59..e2c2e2d 100644
--- a/system/common/message_loop_thread.cc
+++ b/system/common/message_loop_thread.cc
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
+#include "message_loop_thread.h"
+
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <thread>
 
 #include <base/strings/stringprintf.h>
 
-#include "message_loop_thread.h"
-
 namespace bluetooth {
 
 namespace common {
@@ -56,14 +56,14 @@
   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<std::recursive_mutex> api_lock(api_mutex_);
   if (message_loop_ == nullptr) {
     LOG(ERROR) << __func__ << ": message loop is null for thread " << *this
diff --git a/system/common/message_loop_thread.h b/system/common/message_loop_thread.h
index c0b0b28..b25f438 100644
--- a/system/common/message_loop_thread.h
+++ b/system/common/message_loop_thread.h
@@ -23,10 +23,10 @@
 #include <thread>
 
 #include <base/bind.h>
+#include <base/location.h>
 #include <base/message_loop/message_loop.h>
 #include <base/run_loop.h>
 #include <base/threading/platform_thread.h>
-#include <base/tracked_objects.h>
 
 namespace bluetooth {
 
@@ -67,8 +67,7 @@
    * @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 @@
    * @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/system/common/message_loop_thread_unittest.cc b/system/common/message_loop_thread_unittest.cc
index e77a44c..0e8f0a4 100644
--- a/system/common/message_loop_thread_unittest.cc
+++ b/system/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 <condition_variable>
 #include <memory>
@@ -22,12 +23,9 @@
 
 #include <base/bind.h>
 #include <base/threading/platform_thread.h>
-#include <base/tracked_objects.h>
 #include <sys/capability.h>
 #include <syscall.h>
 
-#include "message_loop_thread.h"
-
 using bluetooth::common::MessageLoopThread;
 
 /**
diff --git a/system/common/timer.cc b/system/common/timer.cc
index f02a67d..f0037d1 100644
--- a/system/common/timer.cc
+++ b/system/common/timer.cc
@@ -34,14 +34,14 @@
 
 // This runs on user thread
 bool Timer::Schedule(const base::WeakPtr<MessageLoopThread>& 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<MessageLoopThread>& 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 @@
 
 // This runs on user thread
 bool Timer::ScheduleTaskHelper(const base::WeakPtr<MessageLoopThread>& 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/system/common/timer.h b/system/common/timer.h
index 3221fb8..5a02dd6 100644
--- a/system/common/timer.h
+++ b/system/common/timer.h
@@ -18,7 +18,7 @@
 
 #include <base/bind.h>
 #include <base/cancelable_callback.h>
-#include <base/tracked_objects.h>
+#include <base/location.h>
 #include <future>
 
 namespace bluetooth {
@@ -54,7 +54,7 @@
    * @return true iff task is scheduled successfully
    */
   bool Schedule(const base::WeakPtr<MessageLoopThread>& 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 @@
    * @return true iff task is scheduled successfully
    */
   bool SchedulePeriodic(const base::WeakPtr<MessageLoopThread>& 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 @@
   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<MessageLoopThread>& 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<void> promise);
   void CancelClosure(std::promise<void> promise);
 
diff --git a/system/hci/include/hci_layer.h b/system/hci/include/hci_layer.h
index c732e0c..5eb2bd5 100644
--- a/system/hci/include/hci_layer.h
+++ b/system/hci/include/hci_layer.h
@@ -18,8 +18,8 @@
 
 #pragma once
 
-#include <base/bind.h>
-#include <base/tracked_objects.h>
+#include <base/callback.h>
+#include <base/location.h>
 #include <stdbool.h>
 
 #include "bt_types.h"
@@ -70,8 +70,7 @@
 typedef struct hci_t {
   // Set the callback that the HCI layer uses to send data upwards
   void (*set_data_cb)(
-      base::Callback<void(const tracked_objects::Location&, BT_HDR*)>
-          send_data_cb);
+      base::Callback<void(const base::Location&, BT_HDR*)> send_data_cb);
 
   // Send a command through the HCI layer
   void (*transmit_command)(BT_HDR* command,
@@ -91,7 +90,6 @@
     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/system/hci/src/hci_layer.cc b/system/hci/src/hci_layer.cc
index a2b2797..feb5445 100644
--- a/system/hci/src/hci_layer.cc
+++ b/system/hci/src/hci_layer.cc
@@ -108,8 +108,7 @@
 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<void(const tracked_objects::Location&, BT_HDR*)>
-    send_data_upwards;
+static base::Callback<void(const base::Location&, BT_HDR*)> 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 @@
   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 @@
 // Interface functions
 
 static void set_data_cb(
-    base::Callback<void(const tracked_objects::Location&, BT_HDR*)>
-        send_data_cb) {
+    base::Callback<void(const base::Location&, BT_HDR*)> send_data_cb) {
   send_data_upwards = std::move(send_data_cb);
 }
 
diff --git a/system/hci/src/hci_layer_android.cc b/system/hci/src/hci_layer_android.cc
index 183b74e..be0a7eb 100644
--- a/system/hci/src/hci_layer_android.cc
+++ b/system/hci/src/hci_layer_android.cc
@@ -47,8 +47,7 @@
 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/system/hci/src/hci_layer_linux.cc b/system/hci/src/hci_layer_linux.cc
index e32b5ef..5a3dacc 100644
--- a/system/hci/src/hci_layer_linux.cc
+++ b/system/hci/src/hci_layer_linux.cc
@@ -93,8 +93,7 @@
 };
 
 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/system/main/bte_main.cc b/system/main/bte_main.cc
index 04e564f..0498439 100644
--- a/system/main/bte_main.cc
+++ b/system/main/bte_main.cc
@@ -96,8 +96,7 @@
  * 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/system/profile/avrcp/Android.bp b/system/profile/avrcp/Android.bp
index ff4b1d5..9011658 100644
--- a/system/profile/avrcp/Android.bp
+++ b/system/profile/avrcp/Android.bp
@@ -18,6 +18,9 @@
         "libbluetooth-types",
         "libosi",
     ],
+    shared_libs: [
+        "libchrome",
+    ],
 }
 
 cc_test {
@@ -44,6 +47,9 @@
         "libbtdevice",
         "avrcp-target-service",
     ],
+    shared_libs: [
+        "libchrome",
+    ],
     sanitize: {
         cfi: false,
     },
diff --git a/system/profile/avrcp/device.cc b/system/profile/avrcp/device.cc
index 67186cf..1d311ee 100644
--- a/system/profile/avrcp/device.cc
+++ b/system/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 <base/message_loop/message_loop.h>
 
 #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/system/service/Android.bp b/system/service/Android.bp
index 768c084..56cb53f 100644
--- a/system/service/Android.bp
+++ b/system/service/Android.bp
@@ -91,6 +91,7 @@
     ],
 
     shared_libs: [
+        "libchrome",
         "libbinder",
         "libcutils",
         "liblog",
@@ -123,6 +124,10 @@
         "libbluetooth-types",
         "libutils",
     ],
+    shared_libs: [
+        "libchrome",
+    ],
+
     host_supported: true,
     target: {
         // This includes Binder related tests that can only be run
diff --git a/system/service/example/heart_rate/server_main.cc b/system/service/example/heart_rate/server_main.cc
index 8ffded6..7423462 100644
--- a/system/service/example/heart_rate/server_main.cc
+++ b/system/service/example/heart_rate/server_main.cc
@@ -41,10 +41,7 @@
 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 @@
     }
 
     LOG(ERROR) << "Starting Heart Rate server failed asynchronously";
-    main_loop.QuitWhenIdle();
+    base::RunLoop().QuitWhenIdle();
   };
 
   bool advertise =
diff --git a/system/service/gatt_server_old.cc b/system/service/gatt_server_old.cc
index e97a6c5..b583d93 100644
--- a/system/service/gatt_server_old.cc
+++ b/system/service/gatt_server_old.cc
@@ -23,6 +23,8 @@
 #include <unistd.h>
 
 #include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <base/callback.h>
 #include <algorithm>
 #include <array>
 #include <condition_variable>
@@ -77,8 +79,6 @@
 
 }  // namespace
 
-void DoNothing(uint8_t p) {}
-
 namespace bluetooth {
 namespace gatt {
 
@@ -354,11 +354,11 @@
   // 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 @@
 
   // 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 @@
 
   // 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/system/service/hal/bluetooth_av_interface.cc b/system/service/hal/bluetooth_av_interface.cc
index 8901e73..68f5bd0 100644
--- a/system/service/hal/bluetooth_av_interface.cc
+++ b/system/service/hal/bluetooth_av_interface.cc
@@ -318,7 +318,7 @@
   std::unique_lock<shared_mutex_impl> lock(g_instance_lock);
   CHECK(!g_interface);
 
-  auto impl = base::MakeUnique<BluetoothAvInterfaceImpl>();
+  auto impl = std::make_unique<BluetoothAvInterfaceImpl>();
   if (!impl->Initialize()) {
     LOG(ERROR) << "Failed to initialize BluetoothAvInterface";
     return false;
diff --git a/system/service/ipc/ipc_handler_linux.h b/system/service/ipc/ipc_handler_linux.h
index 21c71d2..7cd6efa 100644
--- a/system/service/ipc/ipc_handler_linux.h
+++ b/system/service/ipc/ipc_handler_linux.h
@@ -17,7 +17,6 @@
 #pragma once
 
 #include <atomic>
-
 #include <base/files/file_path.h>
 #include <base/files/scoped_file.h>
 #include <base/macros.h>
diff --git a/system/service/low_energy_advertiser.cc b/system/service/low_energy_advertiser.cc
index 5f606f9..7bc5f25 100644
--- a/system/service/low_energy_advertiser.cc
+++ b/system/service/low_energy_advertiser.cc
@@ -16,14 +16,16 @@
 
 #include "service/low_energy_advertiser.h"
 
-#include <base/bind.h>
-#include <base/logging.h>
-
 #include "service/adapter.h"
 #include "service/logging_helpers.h"
 #include "stack/include/bt_types.h"
 #include "stack/include/hcidefs.h"
 
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <base/callback.h>
+#include <base/logging.h>
+
 using std::lock_guard;
 using std::mutex;
 
@@ -113,8 +115,6 @@
   out_params->scan_request_notification_enable = 0;
 }
 
-void DoNothing(uint8_t status) {}
-
 }  // namespace
 
 // LowEnergyAdvertiser implementation
@@ -133,8 +133,7 @@
 
   // 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/system/service/low_energy_scanner.cc b/system/service/low_energy_scanner.cc
index 1527563..82f3ab4 100644
--- a/system/service/low_energy_scanner.cc
+++ b/system/service/low_energy_scanner.cc
@@ -16,14 +16,15 @@
 
 #include "service/low_energy_scanner.h"
 
-#include <base/bind.h>
-#include <base/logging.h>
-
 #include "service/adapter.h"
 #include "service/logging_helpers.h"
 #include "stack/include/bt_types.h"
 #include "stack/include/hcidefs.h"
 
+#include <base/bind.h>
+#include <base/callback.h>
+#include <base/logging.h>
+
 using std::lock_guard;
 using std::mutex;
 
diff --git a/system/stack/btm/ble_advertiser_hci_interface.cc b/system/stack/btm/ble_advertiser_hci_interface.cc
index 93b517d..b3b00d5 100644
--- a/system/stack/btm/ble_advertiser_hci_interface.cc
+++ b/system/stack/btm/ble_advertiser_hci_interface.cc
@@ -17,17 +17,20 @@
  ******************************************************************************/
 
 #include "ble_advertiser_hci_interface.h"
-#include <base/callback.h>
-#include <base/location.h>
-#include <base/logging.h>
-#include <queue>
-#include <utility>
 #include "btm_api.h"
 #include "btm_ble_api.h"
 #include "btm_int_types.h"
 #include "device/include/controller.h"
 #include "hcidefs.h"
 
+#include <queue>
+#include <utility>
+
+#include <base/bind.h>
+#include <base/callback.h>
+#include <base/location.h>
+#include <base/logging.h>
+
 #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 hci_cmd_cb = base::Callback<void(uint8_t* /* return_parameters */,
                                        uint16_t /* return_parameters_length*/)>;
-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 @@
 }
 
 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 @@
 }
 
 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 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/system/stack/btm/ble_advertiser_hci_interface.h b/system/stack/btm/ble_advertiser_hci_interface.h
index c08bb86..24e501d 100644
--- a/system/stack/btm/ble_advertiser_hci_interface.h
+++ b/system/stack/btm/ble_advertiser_hci_interface.h
@@ -19,10 +19,11 @@
 #ifndef BLE_ADVERTISER_HCI_INTERFACE_H
 #define BLE_ADVERTISER_HCI_INTERFACE_H
 
-#include <base/bind.h>
 #include <vector>
 #include "stack/include/bt_types.h"
 
+#include <base/callback.h>
+
 /* 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/system/stack/btm/btm_ble_adv_filter.cc b/system/stack/btm/btm_ble_adv_filter.cc
index 54e038e..f69f1a2 100644
--- a/system/stack/btm/btm_ble_adv_filter.cc
+++ b/system/stack/btm/btm_ble_adv_filter.cc
@@ -18,11 +18,6 @@
 
 #define LOG_TAG "bt_btm_ble"
 
-#include <base/bind.h>
-#include <string.h>
-#include <algorithm>
-#include <vector>
-
 #include "bt_target.h"
 
 #include "bt_types.h"
@@ -34,6 +29,13 @@
 #include "hcidefs.h"
 #include "hcimsgs.h"
 
+#include <string.h>
+#include <algorithm>
+#include <vector>
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+
 using base::Bind;
 using bluetooth::Uuid;
 
@@ -594,8 +596,6 @@
   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<ApcfCommand> commands,
                    tBTM_BLE_PF_CFG_CBACK cb) {
@@ -620,7 +620,8 @@
         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 @@
       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/system/stack/btm/btm_ble_multi_adv.cc b/system/stack/btm/btm_ble_multi_adv.cc
index bc9baed..22d2e17 100644
--- a/system/stack/btm/btm_ble_multi_adv.cc
+++ b/system/stack/btm/btm_ble_multi_adv.cc
@@ -17,16 +17,6 @@
  *
  ******************************************************************************/
 
-#include <base/bind.h>
-#include <base/location.h>
-#include <base/logging.h>
-#include <base/memory/weak_ptr.h>
-#include <base/strings/string_number_conversions.h>
-#include <base/time/time.h>
-#include <string.h>
-#include <queue>
-#include <vector>
-
 #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 <string.h>
+#include <queue>
+#include <vector>
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <base/location.h>
+#include <base/logging.h>
+#include <base/memory/weak_ptr.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/time/time.h>
+
 using base::Bind;
 using base::TimeDelta;
 using base::TimeTicks;
@@ -113,12 +115,9 @@
 
 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 @@
 }
 
 // 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 @@
           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 @@
           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 @@
 
     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 @@
     // 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 @@
 
     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 @@
       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 @@
       }
     }
 
-    if (!sets.empty()) GetHciInterface()->Enable(true, sets, Bind(DoNothing));
+    if (!sets.empty()) GetHciInterface()->Enable(true, sets, base::DoNothing());
   }
 
   void OnAdvertisingSetTerminated(
@@ -969,7 +968,7 @@
         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 @@
 
 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 @@
 
   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/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc
index e61c16a..c32341d 100644
--- a/system/stack/btu/btu_hcif.cc
+++ b/system/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 @@
 /* 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/system/stack/btu/btu_task.cc b/system/stack/btu/btu_task.cc
index a197701..b668182 100644
--- a/system/stack/btu/btu_task.cc
+++ b/system/stack/btu/btu_task.cc
@@ -23,11 +23,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <base/bind.h>
-#include <base/logging.h>
-#include <base/run_loop.h>
-#include <base/threading/thread.h>
-
 #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 <base/bind.h>
+#include <base/logging.h>
+#include <base/run_loop.h>
+#include <base/threading/thread.h>
+
 using bluetooth::common::MessageLoopThread;
 
 /* Define BTU storage area */
@@ -83,7 +83,7 @@
   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/system/stack/include/avrc_api.h b/system/stack/include/avrc_api.h
index 1aa8ea4..77c37de 100644
--- a/system/stack/include/avrc_api.h
+++ b/system/stack/include/avrc_api.h
@@ -24,13 +24,13 @@
 #ifndef AVRC_API_H
 #define AVRC_API_H
 
-#include <base/bind.h>
-
 #include "avct_api.h"
 #include "avrc_defs.h"
 #include "bt_target.h"
 #include "sdp_api.h"
 
+#include <base/callback.h>
+
 /*****************************************************************************
  *  constants
  ****************************************************************************/
diff --git a/system/stack/include/btu.h b/system/stack/include/btu.h
index 00a690c..43bd48b 100644
--- a/system/stack/include/btu.h
+++ b/system/stack/include/btu.h
@@ -27,14 +27,15 @@
 #ifndef BTU_H
 #define BTU_H
 
-#include <base/callback.h>
-#include <base/location.h>
-#include <base/threading/thread.h>
 #include "bt_common.h"
 #include "bt_target.h"
 #include "common/message_loop_thread.h"
 #include "osi/include/alarm.h"
 
+#include <base/callback.h>
+#include <base/location.h>
+#include <base/threading/thread.h>
+
 /* Global BTU data */
 extern uint8_t btu_trace_level;
 
@@ -43,7 +44,7 @@
 */
 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<void(uint8_t*, uint16_t)> cb);
@@ -58,7 +59,7 @@
  ***********************************
 */
 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/system/stack/test/stack_btu_test.cc b/system/stack/test/stack_btu_test.cc
index 3b0c898..5976bb2 100644
--- a/system/stack/test/stack_btu_test.cc
+++ b/system/stack/test/stack_btu_test.cc
@@ -66,7 +66,7 @@
 /* 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/system/vendor_libs/test_vendor_lib/src/device_properties.cc b/system/vendor_libs/test_vendor_lib/src/device_properties.cc
index 672dd65..81c007a 100644
--- a/system/vendor_libs/test_vendor_lib/src/device_properties.cc
+++ b/system/vendor_libs/test_vendor_lib/src/device_properties.cc
@@ -33,12 +33,12 @@
 
 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;
 }