Snap for 8033408 from 573fa507773820bab8dcea865b7e2d29b79d0446 to sc-v2-release

Change-Id: I116f785e781118c95c8f92236c9a1f3fd391fd5f
diff --git a/bta/dm/bta_dm_act.cc b/bta/dm/bta_dm_act.cc
index 569cf34..689f81f 100644
--- a/bta/dm/bta_dm_act.cc
+++ b/bta/dm/bta_dm_act.cc
@@ -138,7 +138,7 @@
 
 /* Disable connection down timer (in milliseconds) */
 #ifndef BTA_DM_DISABLE_CONN_DOWN_TIMER_MS
-#define BTA_DM_DISABLE_CONN_DOWN_TIMER_MS 1000
+#define BTA_DM_DISABLE_CONN_DOWN_TIMER_MS 100
 #endif
 
 /* Switch delay timer (in milliseconds) */
diff --git a/btif/src/stack_manager.cc b/btif/src/stack_manager.cc
index ab24734..e1b142e 100644
--- a/btif/src/stack_manager.cc
+++ b/btif/src/stack_manager.cc
@@ -74,6 +74,10 @@
 #include "internal_include/stack_config.h"
 #include "main/shim/controller.h"
 
+#ifndef BT_STACK_CLEANUP_WAIT_MS
+#define BT_STACK_CLEANUP_WAIT_MS 1000
+#endif
+
 void main_thread_shut_down();
 void main_thread_start_up();
 void BTA_dm_on_hw_on();
@@ -92,7 +96,7 @@
 static void event_init_stack(void* context);
 static void event_start_up_stack(void* context);
 static void event_shut_down_stack(void* context);
-static void event_clean_up_stack(void* context);
+static void event_clean_up_stack(std::promise<void> promise);
 
 static void event_signal_stack_up(void* context);
 static void event_signal_stack_down(void* context);
@@ -129,12 +133,18 @@
 static void clean_up_stack() {
   // This is a synchronous process. Post it to the thread though, so
   // state modification only happens there.
-  semaphore_t* semaphore = semaphore_new(0);
-  management_thread.DoInThread(FROM_HERE,
-                               base::Bind(event_clean_up_stack, semaphore));
-  semaphore_wait(semaphore);
-  semaphore_free(semaphore);
-  management_thread.ShutDown();
+  std::promise<void> promise;
+  auto future = promise.get_future();
+  management_thread.DoInThread(
+      FROM_HERE, base::BindOnce(event_clean_up_stack, std::move(promise)));
+
+  auto status =
+      future.wait_for(std::chrono::milliseconds(BT_STACK_CLEANUP_WAIT_MS));
+  if (status == std::future_status::ready) {
+    management_thread.ShutDown();
+  } else {
+    LOG_ERROR("cleanup could not be completed in time, abandon it");
+  }
 }
 
 static bool get_stack_is_running() { return stack_is_running; }
@@ -383,7 +393,7 @@
 }
 
 // Synchronous function to clean up the stack
-static void event_clean_up_stack(void* context) {
+static void event_clean_up_stack(std::promise<void> promise) {
   if (!stack_is_initialized) {
     LOG_INFO("%s found the stack already in a clean state", __func__);
     goto cleanup;
@@ -407,8 +417,7 @@
   LOG_INFO("%s finished", __func__);
 
 cleanup:;
-  semaphore_t* semaphore = (semaphore_t*)context;
-  if (semaphore) semaphore_post(semaphore);
+  promise.set_value();
 }
 
 static void event_signal_stack_up(UNUSED_ATTR void* context) {
diff --git a/device/include/interop_database.h b/device/include/interop_database.h
index 12d4e2a..0934e30 100644
--- a/device/include/interop_database.h
+++ b/device/include/interop_database.h
@@ -154,6 +154,9 @@
     // because BR/EDR address and ADV random address are the same
     {{{0xd4, 0x7a, 0xe2, 0, 0, 0}}, 3, INTEROP_DISABLE_NAME_REQUEST},
 
+    // Audi Carkit
+    {{{0x90, 0x03, 0xb7, 0, 0, 0}}, 3, INTEROP_AVRCP_1_4_ONLY},
+
     // Lexus Carkit
     {{{0x64, 0xd4, 0xbd, 0, 0, 0}}, 3, INTEROP_AVRCP_1_4_ONLY},