Move autopair blacklist to interop database

Blacklist by partial name etc. was not working and had no effect; all
BDAs in the config file start with 00:, which is implausible at best, so
deleted...

Added new mechanism to blacklist by BDA only initially and added Subaru
car kit to blacklist.

Bug: 27347017
Change-Id: Ie2941cb1ab663b5444b02c44f85032f13be4ab46
diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h
index 7b5a957..03debef 100644
--- a/btif/include/btif_storage.h
+++ b/btif/include/btif_storage.h
@@ -262,56 +262,6 @@
 *******************************************************************************/
 bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr);
 
-/*******************************************************************************
-**
-** Function         btif_storage_load_autopair_device_list
-**
-** Description      BTIF storage API - Populates auto pair device list
-**
-** Returns          BT_STATUS_SUCCESS if the auto pair blacklist is successfully populated
-**                  BT_STATUS_FAIL otherwise
-**
-*******************************************************************************/
-bt_status_t btif_storage_load_autopair_device_list();
-
-/*******************************************************************************
-**
-** Function         btif_storage_is_device_autopair_blacklisted
-**
-** Description      BTIF storage API  Checks if the given device is blacklisted for auto pairing
-**
-** Returns          TRUE if the device is found in the auto pair blacklist
-**                  FALSE otherwise
-**
-*******************************************************************************/
-
-BOOLEAN  btif_storage_is_device_autopair_blacklisted(bt_bdaddr_t *remote_bd_addr);
-
-/*******************************************************************************
-**
-** Function         btif_storage_add_device_to_autopair_blacklist
-**
-** Description      BTIF storage API - Add a remote device to the auto pairing blacklist
-**
-** Returns          BT_STATUS_SUCCESS if the device is successfully added to the auto pair blacklist
-**                  BT_STATUS_FAIL otherwise
-**
-*******************************************************************************/
-
-bt_status_t btif_storage_add_device_to_autopair_blacklist(bt_bdaddr_t *remote_bd_addr);
-
-/*******************************************************************************
-**
-** Function         btif_storage_is_fixed_pin_zeros_keyboard
-**
-** Description      BTIF storage API - checks if this device has fixed PIN key device list
-**
-** Returns          TRUE   if the device is found in the fixed pin keyboard device list
-**                  FALSE otherwise
-**
-*******************************************************************************/
-BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr);
-
 #if (BLE_INCLUDED == TRUE)
 bt_status_t btif_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
                                               char *key,
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 8345cdb..8b7edb2 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -930,9 +930,9 @@
             check_cod(&bd_addr, COD_AV_HIFI_AUDIO) ||
             check_cod(&bd_addr, COD_HID_POINTING))
         {
-            BTIF_TRACE_DEBUG("%s()cod matches for auto pair", __FUNCTION__);
             /*  Check if this device can be auto paired  */
-            if ((btif_storage_is_device_autopair_blacklisted(&bd_addr) == FALSE) &&
+            if (!interop_match_addr(INTEROP_DISABLE_AUTO_PAIRING, &bd_addr) &&
+                !interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, (const char *)bd_name.name) &&
                 (pairing_cb.autopair_attempts == 0))
             {
                 BTIF_TRACE_DEBUG("%s() Attempting auto pair", __FUNCTION__);
@@ -949,8 +949,8 @@
         else if (check_cod(&bd_addr, COD_HID_KEYBOARD) ||
                  check_cod(&bd_addr, COD_HID_COMBO))
         {
-            if(( btif_storage_is_fixed_pin_zeros_keyboard (&bd_addr) == TRUE) &&
-               (pairing_cb.autopair_attempts == 0))
+            if ((interop_match_addr(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN, &bd_addr) == TRUE) &&
+                (pairing_cb.autopair_attempts == 0))
             {
                 BTIF_TRACE_DEBUG("%s() Attempting auto pair", __FUNCTION__);
                 pin_code.pin[0] = 0x30;
@@ -1215,7 +1215,7 @@
         switch(p_auth_cmpl->fail_reason)
         {
             case HCI_ERR_PAGE_TIMEOUT:
-                if (interop_match(INTEROP_AUTO_RETRY_PAIRING, &bd_addr)
+                if (interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &bd_addr)
                     && pairing_cb.timeout_retries)
                 {
                     BTIF_TRACE_WARNING("%s() - Pairing timeout; retrying (%d) ...", __FUNCTION__, pairing_cb.timeout_retries);
@@ -1251,22 +1251,8 @@
                     __FUNCTION__, p_auth_cmpl->fail_reason);
                 if (pairing_cb.autopair_attempts  == 1)
                 {
-                    BTIF_TRACE_DEBUG("%s(): Adding device to blacklist ", __FUNCTION__);
-
-                    /* Add the device to dynamic black list only if this device belongs to Audio/pointing dev class  */
-                    if (check_cod(&bd_addr, COD_AV_HEADSETS) ||
-                        check_cod(&bd_addr, COD_AV_HANDSFREE) ||
-                        check_cod(&bd_addr, COD_AV_HEADPHONES) ||
-                        check_cod(&bd_addr, COD_AV_PORTABLE_AUDIO) ||
-                        check_cod(&bd_addr, COD_AV_HIFI_AUDIO) ||
-                        check_cod(&bd_addr, COD_HID_POINTING))
-                    {
-                        btif_storage_add_device_to_autopair_blacklist (&bd_addr);
-                    }
-                    pairing_cb.autopair_attempts++;
-
                     /* Create the Bond once again */
-                    BTIF_TRACE_DEBUG("%s() auto pair failed. Reinitiate Bond", __FUNCTION__);
+                    BTIF_TRACE_WARNING("%s() auto pair failed. Reinitiate Bond", __FUNCTION__);
                     btif_dm_cb_create_bond (&bd_addr, BTA_TRANSPORT_UNKNOWN);
                     return;
                 }
@@ -1737,8 +1723,6 @@
              */
              btif_storage_load_bonded_devices();
 
-             btif_storage_load_autopair_device_list();
-
              btif_enable_bluetooth_evt(p_data->enable.status);
         }
         break;
diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c
index e03c00d..9bc57fd 100644
--- a/btif/src/btif_rc.c
+++ b/btif/src/btif_rc.c
@@ -476,7 +476,7 @@
                      bdaddr_to_string(&avdtp_addr, addr1, sizeof(addr1)),
                      bdaddr_to_string(&rc_addr, addr2, sizeof(addr2)));
 
-    if (interop_match(INTEROP_DISABLE_ABSOLUTE_VOLUME, &rc_addr)
+    if (interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &rc_addr)
         || absolute_volume_disabled()
         || bdcmp(avdtp_addr.address, rc_addr.address))
         btif_rc_cb.rc_features &= ~BTA_AV_FEAT_ADV_CTRL;
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index 0fb1b91..e058a14 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -77,21 +77,6 @@
 #define BTIF_STORAGE_KEY_ADAPTER_SCANMODE "ScanMode"
 #define BTIF_STORAGE_KEY_ADAPTER_DISC_TIMEOUT "DiscoveryTimeout"
 
-#if defined(OS_GENERIC)
-// TODO(armansito): Find a better way than searching by a hardcoded path.
-#define BTIF_AUTO_PAIR_CONF_FILE "auto_pair_devlist.conf"
-#else  // !defined(OS_GENERIC)
-#define BTIF_AUTO_PAIR_CONF_FILE "/etc/bluetooth/auto_pair_devlist.conf"
-#endif  // defined(OS_GENERIC)
-#define BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST "AutoPairBlacklist"
-#define BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_ADDR "AddressBlacklist"
-#define BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_EXACTNAME "ExactNameBlacklist"
-#define BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_PARTIALNAME "PartialNameBlacklist"
-#define BTIF_STORAGE_KEY_AUTOPAIR_FIXPIN_KBLIST "FixedPinZerosKeyboardBlacklist"
-#define BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR "DynamicAddressBlacklist"
-
-#define BTIF_AUTO_PAIR_CONF_VALUE_SEPARATOR ","
-
 /* This is a local property to add a device found */
 #define BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP 0xFF
 
@@ -1489,179 +1474,3 @@
     return bt_status;
 }
 
-/*******************************************************************************
-**
-** Function         btif_storage_load_autopair_device_list
-**
-** Description      BTIF storage API - Populates auto pair device list
-**
-** Returns          BT_STATUS_SUCCESS if the auto pair blacklist is successfully populated
-**                  BT_STATUS_FAIL otherwise
-**
-*******************************************************************************/
-bt_status_t btif_storage_load_autopair_device_list() {
-    // Configuration has already been loaded. No need to reload.
-    if (btif_config_has_section(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST)) {
-        return BT_STATUS_SUCCESS;
-    }
-
-    static const char *key_names[] = {
-        BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_ADDR,
-        BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_EXACTNAME,
-        BTIF_STORAGE_KEY_AUTOPAIR_FIXPIN_KBLIST,
-        BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_PARTIALNAME,
-        BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR,
-    };
-
-    config_t *config = config_new(BTIF_AUTO_PAIR_CONF_FILE);
-    if (!config) {
-        LOG_ERROR(LOG_TAG, "%s failed to open auto pair blacklist conf file '%s'.", __func__, BTIF_AUTO_PAIR_CONF_FILE);
-        return BT_STATUS_FAIL;
-    }
-
-    for (size_t i = 0; i < ARRAY_SIZE(key_names); ++i) {
-        const char *value = config_get_string(config, CONFIG_DEFAULT_SECTION, key_names[i], NULL);
-        if (value) {
-            btif_config_set_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST, key_names[i], value);
-        }
-    }
-
-    config_free(config);
-    return BT_STATUS_SUCCESS;
-}
-
-/*******************************************************************************
-**
-** Function         btif_storage_is_device_autopair_blacklisted
-**
-** Description      BTIF storage API  Checks if the given device is blacklisted for auto pairing
-**
-** Returns          TRUE if the device is found in the auto pair blacklist
-**                  FALSE otherwise
-**
-*******************************************************************************/
-BOOLEAN  btif_storage_is_device_autopair_blacklisted(bt_bdaddr_t *remote_bd_addr)
-{
-    char *token;
-    bdstr_t bdstr;
-    char *dev_name_str;
-    char value[BTIF_STORAGE_MAX_LINE_SZ];
-    int value_size = sizeof(value);
-
-    bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
-
-    /* Consider only  Lower Address Part from BD Address */
-    bdstr[8] = '\0';
-
-    if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_ADDR, value, &value_size))
-    {
-        if (strcasestr(value,bdstr) != NULL)
-            return TRUE;
-    }
-
-    dev_name_str = BTM_SecReadDevName((remote_bd_addr->address));
-
-    if (dev_name_str != NULL)
-    {
-        value_size = sizeof(value);
-        if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                    BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_EXACTNAME, value, &value_size))
-        {
-            if (strstr(value,dev_name_str) != NULL)
-                return TRUE;
-        }
-        value_size = sizeof(value);
-        if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                    BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_PARTIALNAME, value, &value_size))
-        {
-            token = strtok(value, BTIF_AUTO_PAIR_CONF_VALUE_SEPARATOR);
-            while (token != NULL)
-            {
-                if (strstr(dev_name_str, token) != NULL)
-                    return TRUE;
-
-                token = strtok(NULL, BTIF_AUTO_PAIR_CONF_VALUE_SEPARATOR);
-            }
-        }
-    }
-    if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR, value, &value_size))
-    {
-        if (strstr(value,bdstr) != NULL)
-            return TRUE;
-    }
-    return FALSE;
-}
-
-/*******************************************************************************
-**
-** Function         btif_storage_add_device_to_autopair_blacklist
-**
-** Description      BTIF storage API - Add a remote device to the auto pairing blacklist
-**
-** Returns          BT_STATUS_SUCCESS if the device is successfully added to the auto pair blacklist
-**                  BT_STATUS_FAIL otherwise
-**
-*******************************************************************************/
-bt_status_t btif_storage_add_device_to_autopair_blacklist(bt_bdaddr_t *remote_bd_addr)
-{
-    int ret;
-    bdstr_t bdstr;
-    char linebuf[BTIF_STORAGE_MAX_LINE_SZ+20];
-    char input_value [20];
-
-    bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
-    strlcpy(input_value, (char*)bdstr, sizeof(input_value));
-    strlcat(input_value,BTIF_AUTO_PAIR_CONF_VALUE_SEPARATOR, sizeof(input_value));
-
-    int line_size = sizeof(linebuf);
-    if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                            BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR, linebuf, &line_size))
-    {
-         /* Append this address to the dynamic List of BD address  */
-        strncat (linebuf, input_value, BTIF_STORAGE_MAX_LINE_SZ);
-    }
-    else
-    {
-        strncpy( linebuf,input_value, BTIF_STORAGE_MAX_LINE_SZ);
-    }
-
-    /* Write back the key value */
-    ret = btif_config_set_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                        BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR, linebuf);
-
-    return ret ? BT_STATUS_SUCCESS:BT_STATUS_FAIL;
-}
-
-/*******************************************************************************
-**
-** Function         btif_storage_is_fixed_pin_zeros_keyboard
-**
-** Description      BTIF storage API - checks if this device has fixed PIN key device list
-**
-** Returns          TRUE   if the device is found in the fixed pin keyboard device list
-**                  FALSE otherwise
-**
-*******************************************************************************/
-BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr)
-{
-    bdstr_t bdstr;
-    char linebuf[BTIF_STORAGE_MAX_LINE_SZ];
-
-    bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
-
-    /*consider on LAP part of BDA string*/
-    bdstr[8] = '\0';
-
-    int line_size = sizeof(linebuf);
-    if(btif_config_get_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST,
-                            BTIF_STORAGE_KEY_AUTOPAIR_FIXPIN_KBLIST, linebuf, &line_size))
-    {
-        if (strcasestr(linebuf,bdstr) != NULL)
-            return TRUE;
-    }
-    return FALSE;
-
-}
-
diff --git a/conf/Android.mk b/conf/Android.mk
index 6108bcf..5bc5a63 100644
--- a/conf/Android.mk
+++ b/conf/Android.mk
@@ -20,13 +20,3 @@
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
 include $(BUILD_PREBUILT)
 
-# Bluetooth auto_pair_devlist.conf config file
-# ========================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := auto_pair_devlist.conf
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/bluetooth
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES :=  $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
-
diff --git a/conf/auto_pair_devlist.conf b/conf/auto_pair_devlist.conf
deleted file mode 100644
index 2b5ccb1..0000000
--- a/conf/auto_pair_devlist.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-# Do NOT change this file format without updating the parsing logic in
-# BT IF module implementation (btif_storage.c)
-
-# This file contains information to prevent auto pairing with Bluetooth devices.
-# Blacklisting by vendor prefix address:
-# The following companies are included in the list below:
-# ALPS (lexus), Murata (Prius 2007, Nokia 616), TEMIC SDS (Porsche, Audi),
-# Parrot, Zhongshan General K-mate Electronics, Great Well
-# Electronics, Flaircomm Electronics, Jatty Electronics, Delphi,
-# Clarion, Novero, Denso (Lexus, Toyota), Johnson Controls (Acura),
-# Continental Automotive, Harman/Becker, Panasonic/Kyushu Ten,
-# BMW (Motorola PCS), Visteon, Peugeot, BMW (MINI10013), Venza (Toyota)
-AddressBlacklist=00:02:C7,00:16:FE,00:19:C1,00:1B:FB,00:1E:3D,00:21:4F,00:23:06,00:24:33,00:A0:79,00:0E:6D,00:13:E0,00:21:E8,00:60:57,00:0E:9F,00:12:1C,00:18:91,00:18:96,00:13:04,00:16:FD,00:22:A0,00:0B:4C,00:60:6F,00:23:3D,00:C0:59,00:0A:30,00:1E:AE,00:1C:D7,00:80:F0,00:12:8A,00:09:93,00:80:37,00:26:7E,00:26:e8
-
-# Blacklisting by Exact Name:
-ExactNameBlacklist=Motorola IHF1000,i.TechBlueBAND,X5 Stereo v1.3,KML_CAN
-
-# Blacklisting by Partial Name (if name starts with)
-PartialNameBlacklist=BMW,Audi,Parrot,Car
-
-# Fixed PIN keyboard blacklist. Keyboards should have variable PIN
-# The keyboards below have a fixed PIN of 0000, so we will auto pair.
-# Note the reverse logic in this case compared to other's in this file
-# where its a blacklist for not auto pairing.
-FixedPinZerosKeyboardBlacklist=00:0F:F6
-
-# Blacklisting by addition of the address during usage
diff --git a/device/include/interop.h b/device/include/interop.h
index 24565df..76a83fc 100644
--- a/device/include/interop.h
+++ b/device/include/interop.h
@@ -24,6 +24,9 @@
 
 static const char INTEROP_MODULE[] = "interop_module";
 
+// NOTE:
+// Only add values at the end of this enum and do NOT delete values
+// as they may be used in dynamic device configuration.
 typedef enum {
   // Disable secure connections
   // This is for pre BT 4.1/2 devices that do not handle secure mode
@@ -39,14 +42,34 @@
   // Devices requiring this workaround do not handle Bluetooth Absolute Volume
   // control correctly, leading to undesirable (potentially harmful) volume levels
   // or general lack of controlability.
-  INTEROP_DISABLE_ABSOLUTE_VOLUME
+  INTEROP_DISABLE_ABSOLUTE_VOLUME,
+
+  // Disable automatic pairing with headsets/car-kits
+  // Some car kits do not react kindly to a failed pairing attempt and
+  // do not allow immediate re-pairing. Blacklist these so that the initial
+  // pairing attempt makes it to the user instead.
+  INTEROP_DISABLE_AUTO_PAIRING,
+
+  // Use a fixed pin for specific keyboards
+  // Keyboards should use a variable pin at all times. However, some keyboards
+  // require a fixed pin of all 0000. This workaround enables auto pairing for
+  // those keyboards.
+  INTEROP_KEYBOARD_REQUIRES_FIXED_PIN
 } interop_feature_t;
 
 // Check if a given |addr| matches a known interoperability workaround as identified
 // by the |interop_feature_t| enum. This API is used for simple address based lookups
 // where more information is not available. No look-ups or random address resolution
 // are performed on |addr|.
-bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr);
+bool interop_match_addr(const interop_feature_t feature, const bt_bdaddr_t *addr);
+
+// Check if a given remote device |name| matches a known interoperability workaround.
+// Name comparisons are case sensitive and do not allow for partial matches. As in, if
+// |name| is "TEST" and a workaround exists for "TESTING", then this function will
+// return false. But, if |name| is "TESTING" and a workaround exists for "TEST", this
+// function will return true.
+// |name| cannot be null and must be null terminated.
+bool interop_match_name(const interop_feature_t feature, const char *name);
 
 // Add a dynamic interop database entry for a device matching the first |length| bytes
 // of |addr|, implementing the workaround identified by |feature|. |addr| may not be
diff --git a/device/include/interop_database.h b/device/include/interop_database.h
index 0d4ac31..34d6a86 100644
--- a/device/include/interop_database.h
+++ b/device/include/interop_database.h
@@ -24,9 +24,9 @@
   bt_bdaddr_t addr;
   size_t length;
   interop_feature_t feature;
-} interop_entry_t;
+} interop_addr_entry_t;
 
-static const interop_entry_t interop_database[] = {
+static const interop_addr_entry_t interop_addr_database[] = {
   // Nexus Remote (Spike)
   // Note: May affect other Asus brand devices
   {{{0x08, 0x62, 0x66,      0,0,0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
@@ -75,5 +75,26 @@
   {{{0x00, 0x14, 0xf1,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 
   // VW Car Kit - not enough granularity with volume
-  {{{0x00, 0x26, 0x7e,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}
+  {{{0x00, 0x26, 0x7e,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+  // Subaru car kits (ALPS) - auto-pairing fails and rejects next pairing
+  {{{0xe0, 0x75, 0x0a,      0,0,0}}, 3, INTEROP_DISABLE_AUTO_PAIRING},
+
+  // Unknown keyboard (carried over from auto_pair_devlist.conf)
+  {{{0x00, 0x0F, 0xF6,      0,0,0}}, 3, INTEROP_KEYBOARD_REQUIRES_FIXED_PIN}
 };
+
+typedef struct {
+  char name[20];
+  size_t length;
+  interop_feature_t feature;
+} interop_name_entry_t;
+
+static const interop_name_entry_t interop_name_database[] = {
+  // Carried over from auto_pair_devlist.conf migration
+  {"BMW",     3, INTEROP_DISABLE_AUTO_PAIRING},
+  {"Audi",    4, INTEROP_DISABLE_AUTO_PAIRING},
+  {"Parrot",  6, INTEROP_DISABLE_AUTO_PAIRING},
+  {"Car",     3, INTEROP_DISABLE_AUTO_PAIRING}
+};
+
diff --git a/device/src/interop.c b/device/src/interop.c
index e8add56..8e59394 100644
--- a/device/src/interop.c
+++ b/device/src/interop.c
@@ -40,7 +40,7 @@
 
 // Interface functions
 
-bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr) {
+bool interop_match_addr(const interop_feature_t feature, const bt_bdaddr_t *addr) {
   assert(addr);
 
   if (interop_match_fixed_(feature, addr) || interop_match_dynamic_(feature, addr)) {
@@ -54,12 +54,27 @@
   return false;
 }
 
+bool interop_match_name(const interop_feature_t feature, const char *name) {
+  assert(name);
+
+  const size_t db_size = sizeof(interop_name_database) / sizeof(interop_name_entry_t);
+  for (size_t i = 0; i != db_size; ++i) {
+    if (feature == interop_name_database[i].feature &&
+        strlen(name) >= interop_name_database[i].length &&
+        strncmp(name, interop_name_database[i].name, interop_name_database[i].length) == 0) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
 void interop_database_add(const uint16_t feature, const bt_bdaddr_t *addr, size_t length) {
   assert(addr);
   assert(length > 0);
   assert(length < sizeof(bt_bdaddr_t));
 
-  interop_entry_t *entry = osi_calloc(sizeof(interop_entry_t));
+  interop_addr_entry_t *entry = osi_calloc(sizeof(interop_addr_entry_t));
   memcpy(&entry->addr, addr, length);
   entry->feature = feature;
   entry->length = length;
@@ -97,13 +112,15 @@
     CASE_RETURN_STR(INTEROP_DISABLE_LE_SECURE_CONNECTIONS)
     CASE_RETURN_STR(INTEROP_AUTO_RETRY_PAIRING)
     CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME)
+    CASE_RETURN_STR(INTEROP_DISABLE_AUTO_PAIRING)
+    CASE_RETURN_STR(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN)
   }
 
   return "UNKNOWN";
 }
 
 static void interop_free_entry_(void *data) {
-  interop_entry_t *entry = (interop_entry_t *)data;
+  interop_addr_entry_t *entry = (interop_addr_entry_t *)data;
   osi_free(entry);
 }
 
@@ -119,7 +136,7 @@
 
   const list_node_t *node = list_begin(interop_list);
   while (node != list_end(interop_list)) {
-    interop_entry_t *entry = list_node(node);
+    interop_addr_entry_t *entry = list_node(node);
     assert(entry);
 
     if (feature == entry->feature && memcmp(addr, &entry->addr, entry->length) == 0)
@@ -133,10 +150,10 @@
 static bool interop_match_fixed_(const interop_feature_t feature, const bt_bdaddr_t *addr) {
   assert(addr);
 
-  const size_t db_size = sizeof(interop_database) / sizeof(interop_entry_t);
+  const size_t db_size = sizeof(interop_addr_database) / sizeof(interop_addr_entry_t);
   for (size_t i = 0; i != db_size; ++i) {
-    if (feature == interop_database[i].feature &&
-        memcmp(addr, &interop_database[i].addr, interop_database[i].length) == 0) {
+    if (feature == interop_addr_database[i].feature &&
+        memcmp(addr, &interop_addr_database[i].addr, interop_addr_database[i].length) == 0) {
       return true;
     }
   }
diff --git a/device/test/interop_test.cpp b/device/test/interop_test.cpp
index b82ec09..ef4f1c5 100644
--- a/device/test/interop_test.cpp
+++ b/device/test/interop_test.cpp
@@ -25,40 +25,53 @@
 TEST(InteropTest, test_lookup_hit) {
   bt_bdaddr_t test_address;
   string_to_bdaddr("38:2c:4a:e6:67:89", &test_address);
-  EXPECT_TRUE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_TRUE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
   string_to_bdaddr("9c:df:03:12:34:56", &test_address);
-  EXPECT_TRUE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_TRUE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
 }
 
 TEST(InteropTest, test_lookup_miss) {
   bt_bdaddr_t test_address;
   string_to_bdaddr("00:00:00:00:00:00", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
   string_to_bdaddr("ff:ff:ff:ff:ff:ff", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
   string_to_bdaddr("42:08:15:ae:ae:ae", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
   string_to_bdaddr("38:2c:4a:59:67:89", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
 }
 
 TEST(InteropTest, test_dynamic) {
   bt_bdaddr_t test_address;
 
   string_to_bdaddr("11:22:33:44:55:66", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
 
   interop_database_add(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address, 3);
-  EXPECT_TRUE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
-  EXPECT_FALSE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_TRUE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
 
   string_to_bdaddr("66:55:44:33:22:11", &test_address);
-  EXPECT_FALSE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
 
   interop_database_add(INTEROP_AUTO_RETRY_PAIRING, &test_address, 3);
-  EXPECT_TRUE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
-  EXPECT_FALSE(interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
+  EXPECT_TRUE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
 
   interop_database_clear();
-  EXPECT_FALSE(interop_match(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
+}
+
+TEST(InteropTest, test_name_hit) {
+  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "BMW M3"));
+  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "Audi"));
+  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "Caramel")); // Starts with "Car" ;)
+}
+
+TEST(InteropTest, test_name_miss) {
+  EXPECT_FALSE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "__GOOGLE__"));
+  EXPECT_FALSE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "BM"));
+  EXPECT_FALSE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "audi"));
+  EXPECT_FALSE(interop_match_name(INTEROP_AUTO_RETRY_PAIRING, "BMW M3"));
 }
diff --git a/main/Android.mk b/main/Android.mk
index 7fb545e..25a0358 100644
--- a/main/Android.mk
+++ b/main/Android.mk
@@ -96,7 +96,6 @@
 LOCAL_LDLIBS := -Wl,-Bsymbolic,-Bsymbolic-functions
 
 LOCAL_REQUIRED_MODULES := \
-    auto_pair_devlist.conf \
     bt_did.conf \
     bt_stack.conf \
     libbt-hci \
diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c
index 2423cad..c8fe9b2 100644
--- a/stack/smp/smp_act.c
+++ b/stack/smp/smp_act.c
@@ -186,7 +186,7 @@
 
                     if (!(p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT)
                         || lmp_version_below(p_cb->pairing_bda, HCI_PROTO_VERSION_4_2)
-                        || interop_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS,
+                        || interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS,
                             (const bt_bdaddr_t *)&p_cb->pairing_bda))
                     {
                         p_cb->loc_auth_req &= ~SMP_KP_SUPPORT_BIT;