diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 3865b60..156b361 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -278,7 +278,7 @@
    public static boolean mUpdatePickerValue = false;
 
    private LoadedDataAndState SavedDataAndState = null;
-   private static String mBTsoc;
+   private static String mBTsoc = "invalid";
 
    /** fm stats property string */
    public static final String FM_STATS_PROP = "persist.fm.stats";
@@ -432,6 +432,7 @@
       if ((mERadioTextScroller == null) && (mERadioTextTV != null)) {
           mERadioTextScroller = new ScrollerText(mERadioTextTV);
       }
+      mBTsoc = SystemProperties.get("vendor.bluetooth.soc");
    }
 
    protected void setDisplayvalue(){
@@ -789,29 +790,12 @@
           startActivity(launchFMStatIntent);
           return true;
       case MENU_SCAN_START:
-          Log.d(LOGTAG, "mBTsoc: " + mBTsoc + " mService: " + mService);
-
-          if (mBTsoc == null) {
-              if (mService != null) {
-                  try {
-                      mBTsoc = mService.getSocName();
-                      Log.d(LOGTAG, "mBTsoc: " + mBTsoc);
-                  }catch (RemoteException e) {
-                      e.printStackTrace();
-                      return false;
-                  }
-              } else {
-                return false;
-              }
-          }
-
          if (mBTsoc.equals("rome")) {
              clearStationList();
              initiateSearch(0); // 0 - All stations
          } else {
              displayDialog(DIALOG_SEARCH);
          }
-
          return true;
       case MENU_SCAN_STOP:
          cancelSearch();
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index df6ae73..792cb23 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -2083,12 +2083,6 @@
       {
           return (mService.get().getAfJmpRmssiSamplesCnt());
       }
-
-      public String getSocName()
-      {
-          return (mService.get().getSocName());
-      }
-
       public boolean setAfJmpRmssiSamplesCnt(int afJmpRmssiSmplsCnt)
       {
           return (mService.get().setAfJmpRmssiSamplesCnt(afJmpRmssiSmplsCnt));
@@ -3893,13 +3887,6 @@
           else
              return Integer.MIN_VALUE;
    }
-
-   String getSocName() {
-          if(mReceiver != null)
-             return mReceiver.getSocName();
-          else
-             return null;
-   }
    private void setAlarmSleepExpired (long duration) {
        Intent i = new Intent(SLEEP_EXPIRED_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java
index 2042052..aeb57e7 100644
--- a/fmapp2/src/com/caf/fmradio/FMStats.java
+++ b/fmapp2/src/com/caf/fmradio/FMStats.java
@@ -334,9 +334,6 @@
                           (this, R.array.band_sweep_methods,
                             android.R.layout.simple_spinner_item);
 
-        if(mReceiver == null)
-            mReceiver = new FmReceiver();
-
         Log.d(LOGTAG, "oncreate");
         checkTransportLayer();
         if (isCherokeeChip()) {
@@ -369,6 +366,9 @@
 
         tLayout = (TableLayout) findViewById(R.id.maintable);
 
+        if(mReceiver == null)
+            mReceiver = new FmReceiver();
+
         long curTime = System.currentTimeMillis();
         mCurrentFileName = "FMStats_".concat(
                                  Long.toString(curTime).concat(".txt")
@@ -2837,8 +2837,8 @@
         }
     }
     private void checkTransportLayer() {
-       String chip = mReceiver.getSocName();
-       if (chip.equals("pronto"))
+       String chip = SystemProperties.get("vendor.bluetooth.soc","default");
+       if (chip.equals("default"))
            mIsTransportSMD = true;
        else
            mIsTransportSMD = false;
@@ -2850,8 +2850,7 @@
     private boolean isCherokeeChip() {
         Log.d(LOGTAG, "isCherokeeChip");
 
-        String chip = mReceiver.getSocName();
-
+        String chip = SystemProperties.get("vendor.bluetooth.soc");
         if (chip.equals("cherokee"))
             return true;
         else
@@ -2859,15 +2858,16 @@
     }
 
     private boolean isRomeChip() {
-        String chip = mReceiver.getSocName();
+        String chip = "";
 
+        chip = SystemProperties.get("vendor.bluetooth.soc");
         if(chip.equals("rome"))
            return true;
         return false;
     }
 
     private boolean isHastingsChip() {
-        String chip = mReceiver.getSocName();
+        String chip = SystemProperties.get("vendor.bluetooth.soc","default");
 
         if(chip.equals("hastings"))
            return true;
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
index 0d79755..cb271a3 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
@@ -69,7 +69,6 @@
     int getAfJmpRmssiTh();
     int getGoodChRmssiTh();
     int getAfJmpRmssiSamplesCnt();
-    String getSocName();
     boolean setRxRepeatCount(int count);
     long getRecordingStartTime();
     boolean isSleepTimerActive();
diff --git a/jni/Android.bp b/jni/Android.bp
index 29da75c..307ff22 100755
--- a/jni/Android.bp
+++ b/jni/Android.bp
@@ -16,12 +16,9 @@
         "libnativehelper",
         "liblog",
         "libcutils",
-        "libbtconfigstore",
     ],
 
     include_dirs: [
-        "vendor/qcom/opensource/commonsys-intf/bluetooth/include",
-        "vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext/btconfigstore",
         "vendor/qcom/opensource/commonsys/fm/helium",
     ],
 
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 72eb349..58bc762 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -43,8 +43,6 @@
 #include <dlfcn.h>
 #include "android_runtime/Log.h"
 #include "android_runtime/AndroidRuntime.h"
-#include "bt_configstore.h"
-#include <vector>
 #include "radio-helium.h"
 
 #define RADIO "/dev/radio0"
@@ -90,11 +88,6 @@
 void *lib_handle;
 static int slimbus_flag = 0;
 
-static char soc_name[16];
-bool isSocNameAvailable = false;
-static bt_configstore_interface_t* bt_configstore_intf = NULL;
-static void *bt_configstore_lib_handle = NULL;
-
 static JNIEnv *mCallbackEnv = NULL;
 static jobject mCallbacksObj = NULL;
 static bool mCallbacksObjCreated = false;
@@ -128,8 +121,6 @@
 jmethodID method_enableSoftMuteCallback;
 jmethodID method_FmReceiverJNICtor;
 
-int load_bt_configstore_lib();
-
 static bool checkCallbackThread() {
    JNIEnv* env = AndroidRuntime::getJNIEnv();
    if (mCallbackEnv != env || mCallbackEnv == NULL)
@@ -616,7 +607,11 @@
        return FM_JNI_FAILURE;
     }
 
-    if ((strcmp(soc_name, "rome") != 0) && (strcmp(soc_name, "hastings") != 0))
+    property_get("vendor.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if ((strcmp(value, "rome") != 0) && (strcmp(value, "hastings") != 0))
     {
        /*Set the mode for soc downloader*/
        property_set("vendor.hw.fm.mode", "normal");
@@ -648,7 +643,13 @@
 static jint android_hardware_fmradio_FmReceiverJNI_closeFdNative
     (JNIEnv * env, jobject thiz, jint fd)
 {
-    if ((strcmp(soc_name, "rome") != 0) && (strcmp(soc_name, "hastings") != 0))
+    char value[PROPERTY_VALUE_MAX] = {'\0'};
+
+    property_get("vendor.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if ((strcmp(value, "rome") != 0) && (strcmp(value, "hastings") != 0))
     {
         property_set("ctl.stop", "fm_dl");
     }
@@ -657,7 +658,11 @@
 }
 
 static bool is_soc_cherokee() {
-    if(strcmp(soc_name, "cherokee") == 0)
+    char value[PROPERTY_VALUE_MAX] = {'\0'};
+    property_get("vendor.bluetooth.soc", value, NULL);
+    ALOGD("BT soc is %s\n", value);
+
+    if(strcmp(value, "cherokee") == 0)
         return true;
     else
         return false;
@@ -1228,27 +1233,6 @@
     return err;
 }
 
-static jstring android_hardware_fmradio_FmReceiverJNI_getSocNameNative
- (JNIEnv* env)
-{
-    ALOGI("%s, bt_configstore_intf: %p isSocNameAvailable: %d",
-        __FUNCTION__, bt_configstore_intf, isSocNameAvailable);
-
-    if (bt_configstore_intf != NULL && isSocNameAvailable == false) {
-       std::vector<vendor_property_t> vPropList;
-
-       bt_configstore_intf->get_vendor_properties(BT_PROP_SOC_TYPE, vPropList);
-       for (auto&& vendorProp : vPropList) {
-          if (vendorProp.type == BT_PROP_SOC_TYPE) {
-            strlcpy(soc_name, vendorProp.value, sizeof(soc_name));
-            isSocNameAvailable = true;
-            ALOGI("%s:: soc_name = %s",__func__, soc_name);
-          }
-       }
-    }
-    return env->NewStringUTF(soc_name);
-}
-
 static void classInitNative(JNIEnv* env, jclass clazz) {
 
     ALOGI("ClassInit native called \n");
@@ -1382,64 +1366,13 @@
              (void*)android_hardware_fmradio_FmReceiverJNI_enableSlimbusNative},
         { "enableSoftMute", "(II)I",
              (void*)android_hardware_fmradio_FmReceiverJNI_enableSoftMuteNative},
-        {"getSocNameNative", "()Ljava/lang/String;",
-             (void*) android_hardware_fmradio_FmReceiverJNI_getSocNameNative},
 };
 
 int register_android_hardware_fm_fmradio(JNIEnv* env)
 {
-        ALOGI("%s, bt_configstore_intf", __FUNCTION__, bt_configstore_intf);
-        if (bt_configstore_intf == NULL) {
-          load_bt_configstore_lib();
-        }
-
         return jniRegisterNativeMethods(env, "qcom/fmradio/FmReceiverJNI", gMethods, NELEM(gMethods));
 }
 
-int deregister_android_hardware_fm_fmradio(JNIEnv* env)
-{
-        if (bt_configstore_lib_handle) {
-            dlclose(bt_configstore_lib_handle);
-            bt_configstore_lib_handle = NULL;
-            bt_configstore_intf = NULL;
-        }
-        return 0;
-}
-
-int load_bt_configstore_lib() {
-    const char* sym = BT_CONFIG_STORE_INTERFACE_STRING;
-
-    bt_configstore_lib_handle = dlopen("libbtconfigstore.so", RTLD_NOW);
-    if (!bt_configstore_lib_handle) {
-        const char* err_str = dlerror();
-        ALOGE("%s:: failed to load Bt Config store library, error= %s",
-            __func__, (err_str) ? err_str : "error unknown");
-        goto error;
-    }
-
-    // Get the address of the bt_configstore_interface_t.
-    bt_configstore_intf = (bt_configstore_interface_t*)dlsym(bt_configstore_lib_handle, sym);
-    if (!bt_configstore_intf) {
-        ALOGE("%s:: failed to load symbol from bt config store library = %s",
-            __func__, sym);
-        goto error;
-    }
-
-    // Success.
-    ALOGI("%s::  loaded HAL: bt_configstore_interface_t = %p , bt_configstore_lib_handle= %p",
-        __func__, bt_configstore_intf, bt_configstore_lib_handle);
-    return 0;
-
-  error:
-    if (bt_configstore_lib_handle) {
-      dlclose(bt_configstore_lib_handle);
-      bt_configstore_lib_handle = NULL;
-      bt_configstore_intf = NULL;
-    }
-
-    return -EINVAL;
-}
-
 } // end namespace
 
 jint JNI_OnLoad(JavaVM *jvm, void *reserved)
@@ -1460,22 +1393,3 @@
     }
     return JNI_VERSION_1_6;
 }
-
-jint JNI_OnUnLoad(JavaVM *jvm, void *reserved)
-{
-    JNIEnv *e;
-    int status;
-    g_jVM = jvm;
-
-    ALOGI("FM : unLoading QCOMM FM-JNI");
-    if (jvm->GetEnv((void **)&e, JNI_VERSION_1_6)) {
-        ALOGE("JNI version mismatch error");
-        return JNI_ERR;
-    }
-
-    if ((status = android::deregister_android_hardware_fm_fmradio(e)) < 0) {
-        ALOGE("jni adapter service unregistration failure, status: %d", status);
-        return JNI_ERR;
-    }
-    return JNI_VERSION_1_6;
-}
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java
index 3702aac..b7baef2 100644
--- a/qcom/fmradio/FmReceiver.java
+++ b/qcom/fmradio/FmReceiver.java
@@ -344,15 +344,15 @@
    private static final int SEARCH_SINR_INT = 1;
 
    public boolean isSmdTransportLayer() {
-       String chip = getSocName();
-       if (chip.equals("pronto"))
+       String chip = SystemProperties.get("vendor.bluetooth.soc","default");
+       if (chip.equals("default"))
            return true;
        else
            return false;
    }
 
    public static boolean isRomeChip() {
-       String chip = FmReceiverJNI.getSocNameNative();
+       String chip = SystemProperties.get("vendor.bluetooth.soc");
        if (chip.equals("rome"))
            return true;
        else
@@ -360,7 +360,7 @@
    }
 
    public static boolean isCherokeeChip() {
-       String chip = FmReceiverJNI.getSocNameNative();
+       String chip = SystemProperties.get("vendor.bluetooth.soc");
        if (chip.equals("cherokee"))
            return true;
        else
@@ -3088,8 +3088,4 @@
        Log.d(TAG, "enableSoftMute :enable =" + enable);
        mControl.enableSoftMute(sFd, enable);
    }
-
-   public String getSocName() {
-     return FmReceiverJNI.getSocNameNative();
-   }
 }
diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java
index 4d2a8b4..7329bb3 100644
--- a/qcom/fmradio/FmReceiverJNI.java
+++ b/qcom/fmradio/FmReceiverJNI.java
@@ -492,5 +492,4 @@
     static native void configurePerformanceParams(int fd);
     static native int enableSlimbus(int fd, int val);
     static native int enableSoftMute(int fd, int val);
-    static native String getSocNameNative();
 }
