diff --git a/system/bta/include/bta_hh_api.h b/system/bta/include/bta_hh_api.h
index 9dcf3f344f62ec1defda58697064673947e465be..c017075097788024d9e22779ab043d5d0bb0801c 100644
--- a/system/bta/include/bta_hh_api.h
+++ b/system/bta/include/bta_hh_api.h
@@ -27,6 +27,7 @@
 #include "macros.h"
 #include "stack/include/bt_hdr.h"
 #include "stack/include/hiddefs.h"
+#include "stack/include/l2c_api.h"
 #include "types/raw_address.h"
 
 /*****************************************************************************
diff --git a/system/btif/src/btif_a2dp_control.cc b/system/btif/src/btif_a2dp_control.cc
index 0707135259f0919d184eb305e0f60ccdaa2bc68d..8ed0ee5b1fe3b22ce322c0f608af415a27e255ea 100644
--- a/system/btif/src/btif_a2dp_control.cc
+++ b/system/btif/src/btif_a2dp_control.cc
@@ -26,13 +26,11 @@
 #include <stdint.h>
 
 #include "audio_a2dp_hw/include/audio_a2dp_hw.h"
-#include "btif_a2dp.h"
 #include "btif_a2dp_sink.h"
 #include "btif_a2dp_source.h"
 #include "btif_av.h"
 #include "btif_av_co.h"
 #include "btif_hf.h"
-#include "osi/include/osi.h"
 #include "types/raw_address.h"
 #include "udrv/include/uipc.h"
 
@@ -318,8 +316,7 @@ static void btif_a2dp_recv_ctrl_data(void) {
   }
 }
 
-static void btif_a2dp_ctrl_cb(UNUSED_ATTR tUIPC_CH_ID ch_id,
-                              tUIPC_EVENT event) {
+static void btif_a2dp_ctrl_cb(tUIPC_CH_ID /* ch_id */, tUIPC_EVENT event) {
   // Don't log UIPC_RX_DATA_READY_EVT by default, because it
   // could be very chatty when audio is streaming.
   if (event == UIPC_RX_DATA_READY_EVT) {
@@ -352,8 +349,7 @@ static void btif_a2dp_ctrl_cb(UNUSED_ATTR tUIPC_CH_ID ch_id,
   }
 }
 
-static void btif_a2dp_data_cb(UNUSED_ATTR tUIPC_CH_ID ch_id,
-                              tUIPC_EVENT event) {
+static void btif_a2dp_data_cb(tUIPC_CH_ID /* ch_id */, tUIPC_EVENT event) {
   LOG_WARN("%s: BTIF MEDIA (A2DP-DATA) EVENT %s", __func__,
            dump_uipc_event(event));
 
diff --git a/system/btif/src/btif_a2dp_sink.cc b/system/btif/src/btif_a2dp_sink.cc
index 1027f30ca232a3969dc6ca4f9d29ef3674045d8b..e89b01f95ad7a371db7b44efacaa5992c6eed894 100644
--- a/system/btif/src/btif_a2dp_sink.cc
+++ b/system/btif/src/btif_a2dp_sink.cc
@@ -34,12 +34,10 @@
 #include "btif/include/btif_util.h"  // CASE_RETURN_STR
 #include "common/message_loop_thread.h"
 #include "include/check.h"
-#include "internal_include/bt_target.h"
+#include "os/log.h"
 #include "osi/include/alarm.h"
 #include "osi/include/allocator.h"
 #include "osi/include/fixed_queue.h"
-#include "osi/include/log.h"
-#include "osi/include/osi.h"  // UNUSED_ATTR
 #include "stack/include/bt_hdr.h"
 #include "types/raw_address.h"
 
@@ -158,7 +156,7 @@ static void btif_a2dp_sink_clear_track_event_req();
 static void btif_a2dp_sink_on_start_event();
 static void btif_a2dp_sink_on_suspend_event();
 
-UNUSED_ATTR static const char* dump_media_event(uint16_t event) {
+static const char* dump_media_event(uint16_t event) {
   switch (event) {
     CASE_RETURN_STR(BTIF_MEDIA_SINK_DECODER_UPDATE)
     CASE_RETURN_STR(BTIF_MEDIA_SINK_CLEAR_TRACK)
@@ -425,7 +423,7 @@ void btif_a2dp_sink_on_idle() {
   btif_a2dp_sink_clear_track_event_req();
 }
 
-void btif_a2dp_sink_on_stopped(UNUSED_ATTR tBTA_AV_SUSPEND* p_av_suspend) {
+void btif_a2dp_sink_on_stopped(tBTA_AV_SUSPEND* /* p_av_suspend */) {
   LOG_INFO("%s", __func__);
   BT_HDR_RIGID* p_buf =
       reinterpret_cast<BT_HDR_RIGID*>(osi_malloc(sizeof(BT_HDR_RIGID)));
@@ -437,7 +435,7 @@ void btif_a2dp_sink_on_stopped(UNUSED_ATTR tBTA_AV_SUSPEND* p_av_suspend) {
   btif_a2dp_sink_audio_handle_stop_decoding();
 }
 
-void btif_a2dp_sink_on_suspended(UNUSED_ATTR tBTA_AV_SUSPEND* p_av_suspend) {
+void btif_a2dp_sink_on_suspended(tBTA_AV_SUSPEND* /* p_av_suspend */) {
   LOG_INFO("%s", __func__);
   BT_HDR_RIGID* p_buf =
       reinterpret_cast<BT_HDR_RIGID*>(osi_malloc(sizeof(BT_HDR_RIGID)));
@@ -486,7 +484,7 @@ static void btif_a2dp_sink_audio_handle_stop_decoding() {
   }
 }
 
-static void btif_decode_alarm_cb(UNUSED_ATTR void* context) {
+static void btif_decode_alarm_cb(void* /* context */) {
   LockGuard lock(g_mutex);
   btif_a2dp_sink_cb.worker_thread.DoInThread(
       FROM_HERE, base::BindOnce(btif_a2dp_sink_avk_handle_timer));
@@ -711,7 +709,7 @@ void btif_a2dp_sink_audio_rx_flush_req() {
       FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));
 }
 
-void btif_a2dp_sink_debug_dump(UNUSED_ATTR int fd) {
+void btif_a2dp_sink_debug_dump(int /* fd */) {
   // Nothing to do
 }
 
diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc
index 598b43ff2b13e5ff28c12d28c5fefd609e6c6d26..891a8b831d8078b22ec50e803999b225df0f8637 100644
--- a/system/btif/src/btif_dm.cc
+++ b/system/btif/src/btif_dm.cc
@@ -51,7 +51,6 @@
 #include <mutex>
 #include <optional>
 
-#include <android_bluetooth_flags.h>
 #include "advertise_data_parser.h"
 #include "bta/dm/bta_dm_disc.h"
 #include "bta/include/bta_api.h"
@@ -76,7 +75,6 @@
 #include "os/log.h"
 #include "os/logging/log_adapter.h"
 #include "osi/include/allocator.h"
-#include "osi/include/osi.h"
 #include "osi/include/properties.h"
 #include "osi/include/stack_power_telemetry.h"
 #include "stack/btm/btm_dev.h"
@@ -3168,9 +3166,8 @@ void btif_dm_proc_io_req(tBTM_AUTH_REQ* p_auth_req, bool is_orig) {
   LOG_VERBOSE("updated p_auth_req=%d", *p_auth_req);
 }
 
-void btif_dm_proc_io_rsp(UNUSED_ATTR const RawAddress& bd_addr,
-                         tBTM_IO_CAP io_cap, UNUSED_ATTR tBTM_OOB_DATA oob_data,
-                         tBTM_AUTH_REQ auth_req) {
+void btif_dm_proc_io_rsp(const RawAddress& /* bd_addr */, tBTM_IO_CAP io_cap,
+                         tBTM_OOB_DATA /* oob_data */, tBTM_AUTH_REQ auth_req) {
   if (auth_req & BTA_AUTH_BONDS) {
     LOG_DEBUG("auth_req:%d", auth_req);
     pairing_cb.auth_req = auth_req;
diff --git a/system/btif/src/btif_gatt_test.cc b/system/btif/src/btif_gatt_test.cc
index d423c6a6655c54e801f0ad6e83be4e42745045d8..ce5446310ae356dbfbe95e8154c0e3d1dba6c25a 100644
--- a/system/btif/src/btif_gatt_test.cc
+++ b/system/btif/src/btif_gatt_test.cc
@@ -27,7 +27,6 @@
 #include "gatt_api.h"
 #include "internal_include/bte_appl.h"
 #include "os/log.h"
-#include "osi/include/osi.h"
 #include "stack/include/btm_ble_sec_api.h"
 #include "types/ble_address_with_type.h"
 #include "types/bluetooth/uuid.h"
@@ -91,7 +90,7 @@ static void btif_test_command_complete_cback(uint16_t conn_id, tGATTC_OPTYPE op,
   }
 }
 
-static void btif_test_discovery_result_cback(UNUSED_ATTR uint16_t conn_id,
+static void btif_test_discovery_result_cback(uint16_t /* conn_id */,
                                              tGATT_DISC_TYPE disc_type,
                                              tGATT_DISC_RES* p_data) {
   LOG_INFO("------ GATT Discovery result %-22s -------", disc_name[disc_type]);
@@ -145,9 +144,9 @@ static void btif_test_discovery_result_cback(UNUSED_ATTR uint16_t conn_id,
   LOG_INFO("-----------------------------------------------------------");
 }
 
-static void btif_test_discovery_complete_cback(
-    UNUSED_ATTR uint16_t conn_id, UNUSED_ATTR tGATT_DISC_TYPE disc_type,
-    tGATT_STATUS status) {
+static void btif_test_discovery_complete_cback(uint16_t /* conn_id */,
+                                               tGATT_DISC_TYPE /* disc_type */,
+                                               tGATT_STATUS status) {
   LOG_INFO("%s: status=%d", __func__, status);
 }
 
diff --git a/system/btif/src/btif_gatt_util.cc b/system/btif/src/btif_gatt_util.cc
index e1e61c83341855172d563e86af8ecce3495a8d88..a054bc8fc1feb46a98b0b65b494f2acbd7bcd5fc 100644
--- a/system/btif/src/btif_gatt_util.cc
+++ b/system/btif/src/btif_gatt_util.cc
@@ -33,7 +33,6 @@
 #include "os/log.h"
 #include "os/system_properties.h"
 #include "osi/include/allocator.h"
-#include "osi/include/osi.h"
 #include "stack/btm/btm_sec.h"
 #include "stack/include/acl_api.h"
 #include "types/ble_address_with_type.h"
@@ -63,8 +62,8 @@ static bool btif_gatt_is_link_encrypted(const RawAddress& bd_addr) {
          BTM_IsEncrypted(bd_addr, BT_TRANSPORT_LE);
 }
 
-static void btif_gatt_set_encryption_cb(UNUSED_ATTR const RawAddress& bd_addr,
-                                        UNUSED_ATTR tBT_TRANSPORT transport,
+static void btif_gatt_set_encryption_cb(const RawAddress& /* bd_addr */,
+                                        tBT_TRANSPORT /* transport */,
                                         tBTA_STATUS result) {
   if (result != BTA_SUCCESS && result != BTA_BUSY) {
     LOG_WARN("%s() - Encryption failed (%d)", __func__, result);
diff --git a/system/btif/src/btif_hf_client.cc b/system/btif/src/btif_hf_client.cc
index c8be62be7f1033f1109829888f12f9eab467c6fa..c46f85e5c9bef828dc0dda01bac804a4aeea8794 100644
--- a/system/btif/src/btif_hf_client.cc
+++ b/system/btif/src/btif_hf_client.cc
@@ -55,7 +55,6 @@
 #include "btif_common.h"
 #include "btif_profile_queue.h"
 #include "btif_util.h"
-#include "osi/include/osi.h"
 #include "osi/include/properties.h"
 #include "stack/btm/btm_sco_hfp_hal.h"
 #include "stack/include/bt_uuid16.h"
@@ -470,8 +469,7 @@ static bt_status_t volume_control(const RawAddress* bd_addr,
  * Returns          bt_status_t
  *
  ******************************************************************************/
-static bt_status_t dial(UNUSED_ATTR const RawAddress* bd_addr,
-                        const char* number) {
+static bt_status_t dial(const RawAddress* bd_addr, const char* number) {
   btif_hf_client_cb_t* cb = btif_hf_client_get_cb_by_bda(*bd_addr);
   if (cb == NULL || !is_connected(cb)) return BT_STATUS_FAIL;
 
@@ -603,7 +601,7 @@ static bt_status_t handle_call_action(const RawAddress* bd_addr,
  * Returns          bt_status_t
  *
  ******************************************************************************/
-static bt_status_t query_current_calls(UNUSED_ATTR const RawAddress* bd_addr) {
+static bt_status_t query_current_calls(const RawAddress* bd_addr) {
   btif_hf_client_cb_t* cb = btif_hf_client_get_cb_by_bda(*bd_addr);
   if (cb == NULL || !is_connected(cb)) return BT_STATUS_FAIL;
 
diff --git a/system/btif/src/btif_hh.cc b/system/btif/src/btif_hh.cc
index 80be79a9741d5079acb1c7d71f73ca6e1effba56..732899fd38bf79e26b8c3952a8e7965e6fa0b346 100644
--- a/system/btif/src/btif_hh.cc
+++ b/system/btif/src/btif_hh.cc
@@ -45,7 +45,6 @@
 #include "osi/include/allocator.h"
 #include "stack/include/bt_hdr.h"
 #include "stack/include/hidh_api.h"
-#include "stack/include/l2c_api.h"
 #include "types/raw_address.h"
 
 #define COD_HID_KEYBOARD 0x0540
@@ -1537,7 +1536,7 @@ static bt_status_t set_info(RawAddress* bd_addr, bthh_hid_info_t hid_info) {
  *
  ******************************************************************************/
 static bt_status_t get_protocol(RawAddress* bd_addr,
-                                UNUSED_ATTR bthh_protocol_mode_t protocolMode) {
+                                bthh_protocol_mode_t /* protocolMode */) {
   CHECK_BTHH_INIT();
 
   VLOG(1) << __func__ << " BTHH: addr = " << ADDRESS_TO_LOGGABLE_STR(*bd_addr);
diff --git a/system/btif/src/btif_pan.cc b/system/btif/src/btif_pan.cc
index 91b6f1859f8d6e9010faf6fb10014882f373482d..7ed00ae2f8f6d9b35156b72e4b8c4e2110a4c30b 100644
--- a/system/btif/src/btif_pan.cc
+++ b/system/btif/src/btif_pan.cc
@@ -50,7 +50,6 @@
 #include "os/log.h"
 #include "osi/include/allocator.h"
 #include "osi/include/compat.h"
-#include "osi/include/osi.h"
 #include "stack/include/bt_hdr.h"
 #include "stack/include/main_thread.h"
 #include "stack/include/pan_api.h"
@@ -392,7 +391,7 @@ int btpan_tap_open() {
 
 int btpan_tap_send(int tap_fd, const RawAddress& src, const RawAddress& dst,
                    uint16_t proto, const char* buf, uint16_t len,
-                   UNUSED_ATTR bool ext, UNUSED_ATTR bool forward) {
+                   bool /* ext */, bool /* forward */) {
   if (tap_fd != INVALID_FD) {
     tETH_HDR eth_hdr;
     eth_hdr.h_dest = dst;
diff --git a/system/btif/src/btif_rc.cc b/system/btif/src/btif_rc.cc
index 62b29e5128f16c8a00c14eadf76535f63676777b..20f4ddac94e132a772de9679d2ec093c833742d4 100644
--- a/system/btif/src/btif_rc.cc
+++ b/system/btif/src/btif_rc.cc
@@ -50,7 +50,6 @@
 #include "osi/include/alarm.h"
 #include "osi/include/allocator.h"
 #include "osi/include/list.h"
-#include "osi/include/osi.h"  // UNUSED_ATTR
 #include "osi/include/properties.h"
 #include "stack/include/avrc_api.h"
 #include "stack/include/avrc_defs.h"
@@ -5821,7 +5820,7 @@ static void passthru_cmd_timeout_handler(btif_rc_device_cb_t* p_dev,
  * Returns          None
  *
  **************************************************************************/
-static void btif_rc_transaction_timeout_handler(UNUSED_ATTR uint16_t event,
+static void btif_rc_transaction_timeout_handler(uint16_t /* event */,
                                                 char* data) {
   rc_transaction_context_t* p_context = (rc_transaction_context_t*)data;
   if (p_context == nullptr) {
diff --git a/system/btif/src/btif_sock_rfc.cc b/system/btif/src/btif_sock_rfc.cc
index 26e323e4c7e41c53af16022a4ba268685f6c18d2..e5746dc3bcdd975330d5953164b1048b31ba9270 100644
--- a/system/btif/src/btif_sock_rfc.cc
+++ b/system/btif/src/btif_sock_rfc.cc
@@ -36,7 +36,6 @@
 #include "btif/include/btif_sock_util.h"
 #include "include/check.h"
 #include "include/hardware/bt_sock.h"
-#include "internal_include/bt_target.h"
 #include "os/log.h"
 #include "osi/include/allocator.h"
 #include "osi/include/compat.h"
diff --git a/system/btif/src/btif_sock_sco.cc b/system/btif/src/btif_sock_sco.cc
index 0c5168468d9a2c57e4928cd1da29c181794a60c5..a847323e7771b60ee65155374b177b5e27b55488 100644
--- a/system/btif/src/btif_sock_sco.cc
+++ b/system/btif/src/btif_sock_sco.cc
@@ -30,7 +30,7 @@
 #include "os/log.h"
 #include "osi/include/allocator.h"
 #include "osi/include/list.h"
-#include "osi/include/osi.h"  // UNUSED_ATTR
+#include "osi/include/osi.h"  // INVALID_FD
 #include "osi/include/socket.h"
 #include "osi/include/thread.h"
 #include "stack/include/btm_api.h"
@@ -98,7 +98,7 @@ bt_status_t btsock_sco_cleanup(void) {
   return BT_STATUS_SUCCESS;
 }
 
-bt_status_t btsock_sco_listen(int* sock_fd, UNUSED_ATTR int flags) {
+bt_status_t btsock_sco_listen(int* sock_fd, int /* flags */) {
   CHECK(sock_fd != NULL);
 
   std::unique_lock<std::mutex> lock(sco_lock);
@@ -113,7 +113,7 @@ bt_status_t btsock_sco_listen(int* sock_fd, UNUSED_ATTR int flags) {
 }
 
 bt_status_t btsock_sco_connect(const RawAddress* bd_addr, int* sock_fd,
-                               UNUSED_ATTR int flags) {
+                               int /* flags */) {
   CHECK(bd_addr != NULL);
   CHECK(sock_fd != NULL);
 
@@ -305,7 +305,7 @@ static void disconnect_completed_cb(uint16_t sco_handle) {
   list_remove(sco_sockets, sco_socket);
 }
 
-static void socket_read_ready_cb(UNUSED_ATTR socket_t* socket, void* context) {
+static void socket_read_ready_cb(socket_t* /* socket */, void* context) {
   std::unique_lock<std::mutex> lock(sco_lock);
 
   sco_socket_t* sco_socket = (sco_socket_t*)context;
diff --git a/system/btif/src/stack_manager.cc b/system/btif/src/stack_manager.cc
index 368b67b36f4e4cac7e06d38119b1a17c17277779..e015c4941cddcea7e798f24b46ce79b99ca1f0a4 100644
--- a/system/btif/src/stack_manager.cc
+++ b/system/btif/src/stack_manager.cc
@@ -33,7 +33,6 @@
 #include "include/check.h"
 #include "main/shim/shim.h"
 #include "os/log.h"
-#include "osi/include/osi.h"
 #include "stack/include/acl_api.h"
 #include "stack/include/btm_client_interface.h"
 #include "stack/include/main_thread.h"
@@ -431,7 +430,7 @@ cleanup:;
   promise.set_value();
 }
 
-static void event_signal_stack_up(UNUSED_ATTR void* context) {
+static void event_signal_stack_up(void* /* context */) {
   // Notify BTIF connect queue that we've brought up the stack. It's
   // now time to dispatch all the pending profile connect requests.
   btif_queue_connect_next();
@@ -439,7 +438,7 @@ static void event_signal_stack_up(UNUSED_ATTR void* context) {
       BT_STATE_ON);
 }
 
-static void event_signal_stack_down(UNUSED_ATTR void* context) {
+static void event_signal_stack_down(void* /* context */) {
   GetInterfaceToProfiles()->events->invoke_adapter_state_changed_cb(
       BT_STATE_OFF);
   future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS);