Merge "FM: Add support to configure the spur Rotation table"
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 12e6841..41947da 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1056,12 +1056,6 @@
 
        if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
           (TelephonyManager.CALL_STATE_RINGING == state)) {
-           if (state == TelephonyManager.CALL_STATE_RINGING) {
-               int ringvolume = audioManager.getStreamVolume(AudioManager.STREAM_RING);
-               if (ringvolume == 0) {
-                   return;
-               }
-           }
            boolean bTempSpeaker = mSpeakerPhoneOn; //need to restore SpeakerPhone
            boolean bTempMute = mMuted;// need to restore Mute status
            int bTempCall = mCallStatus;//need to restore call status
diff --git a/fmapp2/src/com/caf/fmradio/Settings.java b/fmapp2/src/com/caf/fmradio/Settings.java
index 8f7ccdc..0ad85f1 100644
--- a/fmapp2/src/com/caf/fmradio/Settings.java
+++ b/fmapp2/src/com/caf/fmradio/Settings.java
@@ -230,10 +230,6 @@
              }
           }
 
-          // Add a new category
-          PreferenceCategory prefCat = new PreferenceCategory(this);
-          root.addPreference(prefCat);
-
           mRestoreDefaultPreference = new Preference(this);
           mRestoreDefaultPreference.setTitle(
                                        R.string.settings_revert_defaults_title);
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 505efb8..b3090dd 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -104,28 +104,35 @@
     } else {
        return FM_JNI_FAILURE;
     }
-    /*Set the mode for soc downloader*/
-    property_set("hw.fm.mode", "normal");
-    /* Need to clear the hw.fm.init firstly */
-    property_set("hw.fm.init", "0");
-    property_set("ctl.start", "fm_dl");
-    sched_yield();
-    for(i=0; i<45; i++) {
-        property_get("hw.fm.init", value, NULL);
-        if (strcmp(value, "1") == 0) {
+
+    property_get("qcom.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if (strcmp(value, "rome") != 0)
+    {
+       /*Set the mode for soc downloader*/
+       property_set("hw.fm.mode", "normal");
+       /* Need to clear the hw.fm.init firstly */
+       property_set("hw.fm.init", "0");
+       property_set("ctl.start", "fm_dl");
+       sched_yield();
+       for(i=0; i<45; i++) {
+         property_get("hw.fm.init", value, NULL);
+         if (strcmp(value, "1") == 0) {
             init_success = 1;
             break;
-        } else {
+         } else {
             usleep(WAIT_TIMEOUT);
-        }
-    }
-    ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
-    if(!init_success) {
-        property_set("ctl.stop", "fm_dl");
-       // close the fd(power down)
-
-       close(fd);
-        return FM_JNI_FAILURE;
+         }
+       }
+       ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
+       if(!init_success) {
+         property_set("ctl.stop", "fm_dl");
+         // close the fd(power down)
+         close(fd);
+         return FM_JNI_FAILURE;
+       }
     }
     return fd;
 }
@@ -136,9 +143,17 @@
 {
     int i = 0;
     int cleanup_success = 0;
-    char value = 0, retval =0;
+    char retval =0;
+    char value[PROPERTY_VALUE_MAX] = {'\0'};
 
-    property_set("ctl.stop", "fm_dl");
+    property_get("qcom.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if (strcmp(value, "rome") != 0)
+    {
+       property_set("ctl.stop", "fm_dl");
+    }
     close(fd);
     return FM_JNI_SUCCESS;
 }
@@ -419,40 +434,48 @@
     char notch[PROPERTY_VALUE_MAX] = {0x00};
     struct v4l2_control control;
     int err;
-    /*Enable/Disable the WAN avoidance*/
-    property_set("hw.fm.init", "0");
-    if (aValue)
-       property_set("hw.fm.mode", "wa_enable");
-    else
-       property_set("hw.fm.mode", "wa_disable");
 
-    property_set("ctl.start", "fm_dl");
-    sched_yield();
-    for(i=0; i<10; i++) {
-       property_get("hw.fm.init", value, NULL);
-       if (strcmp(value, "1") == 0) {
-          init_success = 1;
-          break;
-       } else {
-          usleep(WAIT_TIMEOUT);
+    property_get("qcom.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if (strcmp(value, "rome") != 0)
+    {
+       /*Enable/Disable the WAN avoidance*/
+       property_set("hw.fm.init", "0");
+       if (aValue)
+          property_set("hw.fm.mode", "wa_enable");
+       else
+          property_set("hw.fm.mode", "wa_disable");
+
+       property_set("ctl.start", "fm_dl");
+       sched_yield();
+       for(i=0; i<10; i++) {
+          property_get("hw.fm.init", value, NULL);
+          if (strcmp(value, "1") == 0) {
+             init_success = 1;
+             break;
+          } else {
+             usleep(WAIT_TIMEOUT);
+          }
        }
-    }
-    ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
+       ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
 
-    property_get("notch.value", notch, NULL);
-    ALOGE("Notch = %s",notch);
-    if (!strncmp("HIGH",notch,strlen("HIGH")))
-        control.value = HIGH_BAND;
-    else if(!strncmp("LOW",notch,strlen("LOW")))
-        control.value = LOW_BAND;
-    else
-        control.value = 0;
+       property_get("notch.value", notch, NULL);
+       ALOGE("Notch = %s",notch);
+       if (!strncmp("HIGH",notch,strlen("HIGH")))
+           control.value = HIGH_BAND;
+       else if(!strncmp("LOW",notch,strlen("LOW")))
+           control.value = LOW_BAND;
+       else
+           control.value = 0;
 
-    ALOGE("Notch value : %d", control.value);
-    control.id = id;
-    err = ioctl(fd, VIDIOC_S_CTRL,&control );
-    if(err < 0){
-          return FM_JNI_FAILURE;
+       ALOGE("Notch value : %d", control.value);
+       control.id = id;
+       err = ioctl(fd, VIDIOC_S_CTRL,&control );
+       if(err < 0){
+             return FM_JNI_FAILURE;
+       }
     }
     return FM_JNI_SUCCESS;
 }
@@ -465,22 +488,29 @@
     char value[PROPERTY_VALUE_MAX] = {'\0'};
     char firmwareVersion[80];
 
-    /*Enable/Disable Analog Mode FM*/
-    property_set("hw.fm.init", "0");
-    if (aValue) {
-        property_set("hw.fm.isAnalog", "true");
-    } else {
-        property_set("hw.fm.isAnalog", "false");
-    }
-    property_set("hw.fm.mode","config_dac");
-    property_set("ctl.start", "fm_dl");
-    sched_yield();
-    for(i=0; i<10; i++) {
-       property_get("hw.fm.init", value, NULL);
-       if (strcmp(value, "1") == 0) {
-          return 1;
+    property_get("qcom.bluetooth.soc", value, NULL);
+
+    ALOGD("BT soc is %s\n", value);
+
+    if (strcmp(value, "rome") != 0)
+    {
+       /*Enable/Disable Analog Mode FM*/
+       property_set("hw.fm.init", "0");
+       if (aValue) {
+           property_set("hw.fm.isAnalog", "true");
        } else {
-          usleep(WAIT_TIMEOUT);
+           property_set("hw.fm.isAnalog", "false");
+       }
+       property_set("hw.fm.mode","config_dac");
+       property_set("ctl.start", "fm_dl");
+       sched_yield();
+       for(i=0; i<10; i++) {
+          property_get("hw.fm.init", value, NULL);
+          if (strcmp(value, "1") == 0) {
+             return 1;
+          } else {
+             usleep(WAIT_TIMEOUT);
+          }
        }
     }