From f589e45a3c467e01c3d3d9084b128e422ba4425f Mon Sep 17 00:00:00 2001 From: Aiswarya Cyriac Date: Mon, 23 Jul 2018 15:17:48 +0530 Subject: [PATCH] Fix for Bluetooth device name is resetting to default name after reboot Reason: When the BT device name is updated is getting saved to the config data pointer but not to the persistent data (i.e. bt_config.conf). So, when the reboot is happening it is not able to get the updated device name from the persistent data (i.e. bt_config.conf) as during reboot bt_config_flush is not called. Fix: Saving the BT Device name to persistent data using btif_config_flush once it is set. Test: Manual Reboot test Bug: 110301897 Change-Id: Ie329b475eaaf208ed667f27e271a00e230e4b95c Signed-off-by: Aiswarya Cyriac Signed-off-by: Gaganpreet kaur --- btif/src/btif_storage.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/btif/src/btif_storage.cc b/btif/src/btif_storage.cc index 3b10eeea2..826244af3 100644 --- a/btif/src/btif_storage.cc +++ b/btif/src/btif_storage.cc @@ -209,10 +209,12 @@ static int prop2cfg(const RawAddress* remote_bd_addr, bt_property_t* prop) { : prop->len; strncpy(value, (char*)prop->val, name_length); value[name_length] = '\0'; - if (remote_bd_addr) + if (remote_bd_addr) { btif_config_set_str(bdstr, BTIF_STORAGE_PATH_REMOTE_NAME, value); - else + } else { btif_config_set_str("Adapter", BTIF_STORAGE_KEY_ADAPTER_NAME, value); + btif_config_flush(); + } break; } case BT_PROPERTY_REMOTE_FRIENDLY_NAME: -- 2.11.0