diff --git a/Android.mk b/Android.mk
index c5b42d9..be7cefc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -4,10 +4,6 @@
 
 LOCAL_MODULE_TAGS := optional
 
-#ifneq ($(TARGET_USES_AOSP),true)
-
-#ifeq ($(BOARD_HAVE_QCOM_FM),true)
-#ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
 
 LOCAL_SRC_FILES := $(call all-java-files-under, qcom/fmradio)
 LOCAL_JNI_SHARED_LIBRARIES := libqcomfm_jni
@@ -20,25 +16,13 @@
 ifeq ($(BOARD_HAS_QCA_FM_SOC), "cherokee")
 LOCAL_CFLAGS += -DFM_SOC_TYPE_CHEROKEE
 endif
+
 include $(LOCAL_PATH)/jni/Android.mk
 LOCAL_PATH := $(LOCAL_DIR_PATH)
 include $(LOCAL_PATH)/fmapp2/Android.mk
 
-#LOCAL_PATH := $(LOCAL_DIR_PATH)
-#include $(LOCAL_PATH)/FMRecord/Android.mk
-
 LOCAL_PATH := $(LOCAL_DIR_PATH)
 include $(LOCAL_PATH)/fm_hci/Android.mk
 
 LOCAL_PATH := $(LOCAL_DIR_PATH)
 include $(LOCAL_PATH)/helium/Android.mk
-
-LOCAL_PATH := $(LOCAL_DIR_PATH)
-#include $(LOCAL_PATH)/fmhalService/Android.mk
-
-#endif # is-vendor-board-platform
-#endif # BOARD_HAVE_QCOM_FM
-#endif # Not (TARGET_USES_AOSP)
-
-LOCAL_PATH := $(LOCAL_DIR_PATH)
-include $(LOCAL_PATH)/libfm_jni/Android.mk
diff --git a/FMRecord/Android.mk b/FMRecord/Android.mk
deleted file mode 100644
index b248bc3..0000000
--- a/FMRecord/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-ifeq ($(BOARD_HAVE_QCOM_FM),true)
-ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src/com/codeaurora/fmrecording/)
-
-LOCAL_PACKAGE_NAME := FMRecord
-LOCAL_CERTIFICATE := platform
-LOCAL_PROGUARD_ENABLED := disabled
-include $(BUILD_PACKAGE)
-endif
-endif # BOARD_HAVE_QCOM_FM
diff --git a/FMRecord/AndroidManifest.xml b/FMRecord/AndroidManifest.xml
deleted file mode 100644
index c1df646..0000000
--- a/FMRecord/AndroidManifest.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.codeaurora.fmrecording" >
-      <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-      <uses-permission android:name="android.permission.RECORD_AUDIO" />
-      <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
-      <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
-      <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
-      <uses-permission android:name="android.permission.REAL_GET_TASKS" />
-
-<application>
-
-<receiver android:name="FMRecordingReceiver">
-      <intent-filter>
-         <action android:name="codeaurora.intent.action.FM" />
-      </intent-filter>
-</receiver>
-
-<service android:name="com.codeaurora.fmrecording.FMRecordingService"></service>
-</application>
-</manifest>
diff --git a/FMRecord/res/drawable/ic_menu_record.png b/FMRecord/res/drawable/ic_menu_record.png
deleted file mode 100755
index 60f7a01..0000000
--- a/FMRecord/res/drawable/ic_menu_record.png
+++ /dev/null
Binary files differ
diff --git a/FMRecord/res/layout/record_status_bar.xml b/FMRecord/res/layout/record_status_bar.xml
deleted file mode 100644
index 9651fd0..0000000
--- a/FMRecord/res/layout/record_status_bar.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2013-14, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-   android:id="@+id/fmradio"
-   android:layout_width="fill_parent"
-   android:layout_height="fill_parent"
-   android:orientation="vertical">
-
-   <TextView
-       android:id="@+id/record_label"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:textSize="15sp"
-       android:textColor="#000000"
-       android:text="@string/fm_record_progress"/>
-
-</RelativeLayout>
diff --git a/FMRecord/res/values-zh-rCN/strings.xml b/FMRecord/res/values-zh-rCN/strings.xml
deleted file mode 100644
index 660f743..0000000
--- a/FMRecord/res/values-zh-rCN/strings.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- -->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="spaceIsLow_content">"USB 存储设备空间不足，请更改录音时长设置，或删除某些录音或者其他文件。</string>
-
-    <!-- prompt message for stopping record -->
-    <string name="save_record_file">"录音已保存至 "<xliff:g id="record_file">%1$s</xliff:g>"</string>
-    <!-- all recordings will show up in the media database with this 'artist' name -->
-    <string name="audio_db_artist_name">我的 FM 录音</string>
-    <!-- all recordings will show up in the media database with this 'album' name -->
-    <string name="audio_db_album_name">FM 录音</string>
-    <!-- all recordings will show up in the media database in a playlist with this name -->
-    <string name="audio_db_playlist_name">FM 录音</string>
-    <string name="fm_record_progress">FM 录音进行中</string>
-    <string name="FMRecording_reach_size_limit">已到达最长限制.</string>
-    <string name="unable_to_store">无法保存已录音频</string>
-</resources>
diff --git a/FMRecord/res/values-zh-rTW/strings.xml b/FMRecord/res/values-zh-rTW/strings.xml
deleted file mode 100644
index 8820deb..0000000
--- a/FMRecord/res/values-zh-rTW/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
-Copyright (c) 2012, The Linux Foundation. All Rights Reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of the Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="spaceIsLow_content">USB 存儲設備空間不足，請更改錄音時長設置，或刪除某些錄音或者其他檔案。</string>
-    <string name="sdcard_no_space_cannot_recording">SD卡空間不足，不能錄音</string>
-    <string name="recording_stop_no_space">SD卡空間不足，錄音停止</string>
-	<string name="audio_db_artist_name">我的FM錄音</string>
-	<!-- all recordings will show up in the media database with this 'album' name -->
-	<string name="audio_db_album_name">FM 錄音</string>
-	<!-- all recordings will show up in the media database in a playlist with this name -->
-	<string name="audio_db_playlist_name">FM 錄音</string>
-	<string name="fm_record_progress">FM 錄音進行中</string>
-	<string name="unable_to_store">無法保存已錄音頻</string>
-	<string name="FMRecording_reach_size_limit">已到達最長限制.</string>
-    <!-- prompt message for stopping record -->
-    <string name="save_record_file">錄音已保存至 "<xliff:g id="record_file">%1$s</xliff:g>"</string>
-</resources>
diff --git a/FMRecord/res/values/customize.xml b/FMRecord/res/values/customize.xml
deleted file mode 100644
index 1ef358c..0000000
--- a/FMRecord/res/values/customize.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright (c) 2014, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
-    <!-- enabled the prefix of recordings files name or not,default value is false -->
-    <bool name="def_save_name_prefix_enabled">false</bool>
-
-    <!-- the prefix of recordings files name.File name like this "FM-yyyy-MM-dd-HH-mm-ss.3gpp" -->
-    <string name="def_save_name_prefix" translatable="false">FM</string>
-
-    <!-- enabled the name format of recordings files or not,default value is false -->
-    <bool name="def_save_name_format_enabled">false</bool>
-
-    <!-- the name format of recordings files -->
-    <string name="def_save_name_format" translatable="false">yyyy-MM-dd-HH-mm-ss</string>
-
-    <!-- the save path of recordings files -->
-    <string name="def_fmRecord_savePath" translatable="false">/SoundRecorder</string>
-
-    <!-- the suffix of recordings files.default value is ".3gpp" -->
-    <string name="def_save_name_suffix" translatable="false">.3gpp</string>
-
-</resources>
diff --git a/FMRecord/res/values/strings.xml b/FMRecord/res/values/strings.xml
deleted file mode 100644
index 244d41c..0000000
--- a/FMRecord/res/values/strings.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- alert to the user that USB storage must be available before using FM recording  [CHAR LIMIT=NONE] -->
-   <string name="no_storage">Mount SD card before start recording.</string>
-   <!-- alert to the user that the USB storage is being disk-checked [CHAR LIMIT=30] -->
-   <string name="preparing_sd">Preparing SD card</string>
-   <!-- alert to the user that the FM fails to read or write the USB storage. [CHAR LIMIT=NONE] -->
-   <string name="access_sd_fail">Couldn\'t access SD card.</string>
-   <!-- Low-memory dialog message [CHAR LIMT=NONE] -->
-   <string name="spaceIsLow_content">Your SD card storage is running out of space. Change the quality setting or delete some images or other files.</string>
-   <!-- The messsage shown when FM record reaches size limit. -->
-   <string name="FMRecording_reach_size_limit">Size limit reached.</string>
-    <!-- the name under which recordings will be visible in the media database is formatted like this -->
-    <string name="audio_db_title_format"><xliff:g id="format">yyyy-MM-dd HH:mm:ss</xliff:g></string>
-    <!-- all recordings will show up in the media database with this 'artist' name -->
-    <string name="audio_db_artist_name">My FM recordings</string>
-    <!-- all recordings will show up in the media database with this 'album' name -->
-    <string name="audio_db_album_name">FM recordings</string>
-    <!-- all recordings will show up in the media database in a playlist with this name -->
-    <string name="audio_db_playlist_name">FM recordings</string>
-    <string name="save_record_file">FM Recorded file saved to "<xliff:g id="record_file">%1$s</xliff:g>"</string>
-    <string name="fm_record_progress">FM Recording in progress</string>
-    <string name="unable_to_store">Unable to save recorded audio</string>
-</resources>
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingReceiver.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingReceiver.java
deleted file mode 100644
index 9389f10..0000000
--- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingReceiver.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmrecording;
-
-import android.content.Intent;
-import android.content.BroadcastReceiver;
-import android.content.pm.PackageManager;
-import android.content.Context;
-import android.content.ComponentName;
-import android.util.Log;
-import java.lang.String;
-
-
-public class FMRecordingReceiver extends BroadcastReceiver {
-
-    private static final String TAG = "FMRecordingReceiver";
-    public static final String ACTION_FM =
-           "codeaurora.intent.action.FM";
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
-        Log.d(TAG, "Received intent: " + action);
-        if((action != null) && action.equals(ACTION_FM)) {
-            Log.d(TAG, "FM intent received");
-            Intent in = new Intent();
-            in.putExtras(intent);
-            in.setClass(context, FMRecordingService.class);
-            int state = intent.getIntExtra("state", 0);
-            boolean startService = true;
-
-            if (state == 1) {
-                Log.d(TAG, "FM ON intent received");
-                startService = true;
-                context.startService(in);
-            } else if(state == 0){
-                Log.d(TAG, "FM OFF intent received");
-                startService = false;
-                context.stopService(in);
-            }
-        }
-   }
-}
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
deleted file mode 100644
index 2aa1684..0000000
--- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmrecording;
-
-import java.util.*;
-import android.app.Service;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-import android.media.AudioManager;
-import android.media.AudioManager.OnAudioFocusChangeListener;
-import android.media.AudioSystem;
-import android.media.MediaRecorder;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.util.Log;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import android.provider.MediaStore;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.database.Cursor;
-import java.io.File;
-import android.widget.Toast;
-import android.os.UserHandle;
-import android.net.Uri;
-import android.content.res.Resources;
-import android.os.StatFs;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.widget.RemoteViews;
-import android.R.layout;
-import android.R.drawable;
-import android.content.ComponentName;
-import android.content.res.Resources;
-import android.os.Process;
-import android.app.ActivityManager;
-import android.app.ActivityManager.RunningAppProcessInfo;
-
-public class FMRecordingService extends Service {
-    private static final String TAG     = "FMRecordingService";
-    private BroadcastReceiver mFmRecordingReceiver = null;
-    private BroadcastReceiver mFmShutdownReceiver = null;
-    public static final long UNAVAILABLE = -1L;
-    public static final long PREPARING = -2L;
-    public static final long UNKNOWN_SIZE = -3L;
-    public static final long LOW_STORAGE_THRESHOLD = 50000000;
-    private long mStorageSpace;
-    private boolean mFmRecordingOn = false;
-    public static final String ACTION_FM_RECORDING =
-                       "codeaurora.intent.action.FM_Recording";
-    public static final String ACTION_FM_RECORDING_STATUS =
-                "codeaurora.intent.action.FM.Recording.Status";
-
-    private File mSampleFile = null;
-    private MediaRecorder mRecorder = null;
-    private long mSampleStart = 0;
-    static final int START = 1;
-    static final int STOP = 0;
-    private int mRecordDuration = -1;
-    private Thread mStatusCheckThread = null;
-    private int clientPid = -1;
-    private String clientProcessName = "";
-    private String mAudioType = "audio/*";
-    private long startTimerMs = 0;
-    private long stopTimerMs = 0;
-
-    public void onCreate() {
-
-        super.onCreate();
-        Log.d(TAG, "FMRecording Service onCreate");
-        registerRecordingListner();
-        registerShutdownListner();
-    }
-
-    public int onStartCommand(Intent intent, int flags, int startId) {
-
-        Log.d(TAG, "FMRecording Service onCreate");
-        return START_NOT_STICKY;
-    }
-
-    public void onDestroy() {
-        Log.d(TAG, "FMRecording Service onDestroy");
-        if (mFmRecordingOn == true) {
-            Log.d(TAG, "Still recording on progress, Stoping it");
-            stopRecord();
-        }
-        unregisterBroadCastReceiver(mFmRecordingReceiver);
-        unregisterBroadCastReceiver(mFmShutdownReceiver);
-        super.onDestroy();
-    }
-
-    public IBinder onBind(Intent intent) {
-        Log.v(TAG, "FMRecording Service onBind");
-        return null;
-    }
-
-    private void unregisterBroadCastReceiver(BroadcastReceiver myreceiver) {
-
-       if (myreceiver != null) {
-           unregisterReceiver(myreceiver);
-           myreceiver = null;
-       }
-    }
-
-    private void registerShutdownListner() {
-        if (mFmShutdownReceiver == null) {
-            mFmShutdownReceiver = new BroadcastReceiver() {
-                 @Override
-                 public void onReceive(Context context, Intent intent) {
-                     Log.d(TAG, "Received intent " +intent);
-                     String action = intent.getAction();
-                     Log.d(TAG, " action = " +action);
-                     if (action.equals("android.intent.action.ACTION_SHUTDOWN")) {
-                         Log.d(TAG, "android.intent.action.ACTION_SHUTDOWN Intent received");
-                         stopRecord();
-                     }
-                 }
-            };
-            IntentFilter iFilter = new IntentFilter();
-            iFilter.addAction("android.intent.action.ACTION_SHUTDOWN");
-            registerReceiver(mFmShutdownReceiver, iFilter);
-        }
-    }
-
-    private static long getAvailableSpace() {
-        String state = Environment.getExternalStorageState();
-        Log.d(TAG, "External storage state=" + state);
-        if (Environment.MEDIA_CHECKING.equals(state)) {
-            return PREPARING;
-        }
-        if (!Environment.MEDIA_MOUNTED.equals(state)) {
-            return UNAVAILABLE;
-        }
-
-        try {
-             File sampleDir = Environment.getExternalStorageDirectory();
-             StatFs stat = new StatFs(sampleDir.getAbsolutePath());
-             return stat.getAvailableBlocks() * (long) stat.getBlockSize();
-        } catch (Exception e) {
-             Log.i(TAG, "Fail to access external storage", e);
-        }
-        return UNKNOWN_SIZE;
-    }
-
-    private boolean updateAndShowStorageHint() {
-        mStorageSpace = getAvailableSpace();
-        return showStorageHint();
-    }
-
-    private boolean showStorageHint() {
-        String errorMessage = null;
-        if (mStorageSpace == UNAVAILABLE) {
-            errorMessage = getString(R.string.no_storage);
-        } else if (mStorageSpace == PREPARING) {
-            errorMessage = getString(R.string.preparing_sd);
-        } else if (mStorageSpace == UNKNOWN_SIZE) {
-            errorMessage = getString(R.string.access_sd_fail);
-        } else if (mStorageSpace < LOW_STORAGE_THRESHOLD) {
-            errorMessage = getString(R.string.spaceIsLow_content);
-        }
-
-        if (errorMessage != null) {
-            Toast.makeText(this, errorMessage,
-                         Toast.LENGTH_LONG).show();
-            return false;
-        }
-        return true;
-    }
-
-    private void sendRecordingStatusIntent(int status) {
-        Intent intent = new Intent(ACTION_FM_RECORDING_STATUS);
-        intent.putExtra("state", status);
-        Log.d(TAG, "posting intent for FM Recording status as = " +status);
-        getApplicationContext().sendBroadcastAsUser(intent, UserHandle.ALL);
-    }
-    private boolean startRecord() {
-
-        Log.d(TAG, "Enter startRecord");
-        if (mRecorder != null) { /* Stop existing recording if any */
-            Log.d(TAG, "Stopping existing record");
-            try {
-                 mRecorder.stop();
-                 mRecorder.reset();
-                 mRecorder.release();
-                 mRecorder = null;
-            } catch(Exception e) {
-                 e.printStackTrace();
-            }
-        }
-        if (!updateAndShowStorageHint())
-            return false;
-        long maxFileSize = mStorageSpace - LOW_STORAGE_THRESHOLD;
-        mRecorder = new MediaRecorder();
-        try {
-             mRecorder.setMaxFileSize(maxFileSize);
-             if(mRecordDuration >= 0)
-                mRecorder.setMaxDuration(mRecordDuration);
-        } catch (RuntimeException exception) {
-
-        }
-        mSampleFile = null;
-        File sampleDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +"/FMRecording");
-
-        if (getResources().getBoolean(R.bool.def_save_name_prefix_enabled)) {
-            String fmRecordSavePath = getApplicationContext().getResources()
-                    .getString(R.string.def_fmRecord_savePath);
-            sampleDir = new File(Environment.getExternalStorageDirectory().toString()
-                    + fmRecordSavePath);
-            if (!sampleDir.exists()) {
-                sampleDir.mkdirs();
-            }
-        }
-        if(!(sampleDir.mkdirs() || sampleDir.isDirectory()))
-            return false;
-
-        try {
-             mSampleFile = File.createTempFile("FMRecording", ".3gpp", sampleDir);
-            if (getResources().getBoolean(R.bool.def_save_name_format_enabled)) {
-                String suffix = getResources().getString(R.string.def_save_name_suffix);
-                suffix = "".equals(suffix) ? ".3gpp" : suffix;
-                mSampleFile = createTempFile("FMRecording", suffix, sampleDir);
-            }
-        } catch (IOException e) {
-             Log.e(TAG, "Not able to access SD Card");
-             Toast.makeText(this, "Not able to access SD Card", Toast.LENGTH_SHORT).show();
-        }
-        try {
-             Log.d(TAG, "AudioSource.FM_RX" +MediaRecorder.AudioSource.FM_RX);
-             mRecorder.setAudioSource(MediaRecorder.AudioSource.FM_RX);
-             mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
-             mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
-             mAudioType = "audio/3gpp";
-        } catch (RuntimeException exception) {
-             Log.d(TAG, "RuntimeException while settings");
-             mRecorder.reset();
-             mRecorder.release();
-             mRecorder = null;
-             return false;
-        }
-        Log.d(TAG, "setOutputFile");
-        mRecorder.setOutputFile(mSampleFile.getAbsolutePath());
-        try {
-             mRecorder.prepare();
-             Log.d(TAG, "start");
-             mRecorder.start();
-             startTimerMs = System.currentTimeMillis();
-        } catch (IOException e) {
-             Log.d(TAG, "IOException while start");
-             mRecorder.reset();
-             mRecorder.release();
-             mRecorder = null;
-             return false;
-        } catch (RuntimeException e) {
-             Log.d(TAG, "RuntimeException while start");
-             mRecorder.reset();
-             mRecorder.release();
-             mRecorder = null;
-             return false;
-        }
-        mFmRecordingOn = true;
-        Log.d(TAG, "mSampleFile.getAbsolutePath() " +mSampleFile.getAbsolutePath());
-        mRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {
-             public void onInfo(MediaRecorder mr, int what, int extra) {
-                 if ((what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) ||
-                     (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED)) {
-                     if (mFmRecordingOn) {
-                         Log.d(TAG, "Maximum file size/duration reached, stopping the recording");
-                         stopRecord();
-                     }
-                     if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED) {
-                         // Show the toast.
-                         Toast.makeText(FMRecordingService.this,
-                                        R.string.FMRecording_reach_size_limit,
-                                        Toast.LENGTH_LONG).show();
-                     }
-                 }
-             }
-             // from MediaRecorder.OnErrorListener
-             public void onError(MediaRecorder mr, int what, int extra) {
-                 Log.e(TAG, "MediaRecorder error. what=" + what + ". extra=" + extra);
-                 if (what == MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN) {
-                     // We may have run out of space on the sdcard.
-                     if (mFmRecordingOn) {
-                         stopRecord();
-                     }
-                     updateAndShowStorageHint();
-                 }
-             }
-        });
-        mSampleStart = System.currentTimeMillis();
-        sendRecordingStatusIntent(START);
-        startNotification();
-        return true;
-    }
-
-    private void startNotification() {
-        RemoteViews views = new RemoteViews(getPackageName(), R.layout.record_status_bar);
-        Notification status = new Notification();
-        status.contentView = views;
-        status.flags |= Notification.FLAG_ONGOING_EVENT;
-        status.icon = R.drawable.ic_menu_record;
-        startForeground(102, status);
-    }
-
-    private void stopRecord() {
-        Log.d(TAG, "Enter stopRecord");
-        mFmRecordingOn = false;
-        if (mRecorder == null)
-            return;
-        try {
-             mRecorder.stop();
-             stopTimerMs = System.currentTimeMillis();
-             mRecorder.reset();
-             mRecorder.release();
-             mRecorder = null;
-        } catch(Exception e) {
-             e.printStackTrace();
-        }
-
-        sendRecordingStatusIntent(STOP);
-        saveFile();
-        stopForeground(true);
-        stopClientStatusCheck();
-    }
-
-    private void saveFile() {
-        int sampleLength = (int)((System.currentTimeMillis() - mSampleStart)/1000 );
-        Log.d(TAG, "Enter saveFile");
-        if (sampleLength == 0)
-            return;
-        String state = Environment.getExternalStorageState();
-        Log.d(TAG, "storage state is " + state);
-
-        if (Environment.MEDIA_MOUNTED.equals(state)) {
-            try {
-                 this.addToMediaDB(mSampleFile);
-                 Toast.makeText(this,getString(R.string.save_record_file,
-                                               mSampleFile.getAbsolutePath( )),
-                                               Toast.LENGTH_LONG).show();
-            } catch(Exception e) {
-                 e.printStackTrace();
-            }
-        } else {
-            Log.e(TAG, "SD card must have removed during recording. ");
-            Toast.makeText(this, "Recording aborted", Toast.LENGTH_SHORT).show();
-        }
-        return;
-    }
-
-    /*
-     * Adds file and returns content uri.
-     */
-    private Uri addToMediaDB(File file) {
-        Log.d(TAG, "In addToMediaDB");
-        Resources res = getResources();
-        ContentValues cv = new ContentValues();
-        int audioId = -1;
-        long current = System.currentTimeMillis();
-        long modDate = file.lastModified();
-        long recordDuration = stopTimerMs - startTimerMs;
-        Date date = new Date(current);
-        SimpleDateFormat formatter = new SimpleDateFormat(
-                  res.getString(R.string.audio_db_title_format));
-        String title = formatter.format(date);
-
-        // Lets label the recorded audio file as NON-MUSIC so that the file
-        // won't be displayed automatically, except for in the playlist.
-        cv.put(MediaStore.Audio.Media.IS_MUSIC, "1");
-        cv.put(MediaStore.Audio.Media.TITLE, title);
-        cv.put(MediaStore.Audio.Media.DATA, file.getAbsolutePath());
-        cv.put(MediaStore.Audio.Media.DATE_ADDED, (int) (current / 1000));
-        cv.put(MediaStore.Audio.Media.DATE_MODIFIED, (int) (modDate / 1000));
-        cv.put(MediaStore.Audio.Media.DURATION, recordDuration);
-        cv.put(MediaStore.Audio.Media.MIME_TYPE, mAudioType);
-        cv.put(MediaStore.Audio.Media.ARTIST,
-                res.getString(R.string.audio_db_artist_name));
-        cv.put(MediaStore.Audio.Media.ALBUM,
-                res.getString(R.string.audio_db_album_name));
-        audioId = getFileIdInVideoDB(file);
-        if (audioId != -1) {//remove the record if it is already added into video table.
-            removeRecordInVideoDB(audioId);
-            Log.d(TAG, "Remove audio record " + audioId + " in video database");
-        }
-        Log.d(TAG, "Inserting audio record: " + cv.toString());
-        ContentResolver resolver = getContentResolver();
-        Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
-        Log.d(TAG, "ContentURI: " + base);
-        Uri result = resolver.insert(base, cv);
-        if (result == null) {
-            Toast.makeText(this, R.string.unable_to_store, Toast.LENGTH_SHORT).show();
-            return null;
-        }
-        if (getPlaylistId(res) == -1) {
-            createPlaylist(res, resolver);
-        }
-        audioId = Integer.valueOf(result.getLastPathSegment());
-        addToPlaylist(resolver, audioId, getPlaylistId(res));
-
-        // Notify those applications such as Music listening to the
-        // scanner events that a recorded audio file just created.
-        sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, result));
-        return result;
-    }
-
-    private int getFileIdInVideoDB(File file) {
-        int id = -1;
-        final String where = MediaStore.Video.Media.DATA + "=?";
-        final String[] args = new String[] { file.getAbsolutePath() };
-        final String[] ids = new String[] { MediaStore.Video.Media._ID };
-        Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
-
-        Cursor cursor = query(base, ids, where, args, null);
-        if (cursor == null) {
-            Log.v(TAG, "Data query returns null");
-        } else {
-            if (cursor.moveToNext() != false) {
-                id = cursor.getInt(0);
-                cursor.close();
-            }
-        }
-        return id;
-    }
-
-    private void removeRecordInVideoDB(int id) {
-        final String where = MediaStore.Video.Media._ID + "=" + id;
-        Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
-        ContentValues cv = new ContentValues();
-        ContentResolver resolver = getContentResolver();
-
-        cv.put(MediaStore.Video.Media.DATA, "null");
-        resolver.update(base, cv, where, null);
-        resolver.delete(base, where, null);
-    }
-
-    private int getPlaylistId(Resources res) {
-        Uri uri = MediaStore.Audio.Playlists.getContentUri("external");
-        final String[] ids = new String[] { MediaStore.Audio.Playlists._ID };
-        final String where = MediaStore.Audio.Playlists.NAME + "=?";
-        final String[] args = new String[] { res.getString(R.string.audio_db_playlist_name) };
-        Cursor cursor = query(uri, ids, where, args, null);
-        if (cursor == null) {
-            Log.v(TAG, "query returns null");
-        }
-        int id = -1;
-        if (cursor != null) {
-            cursor.moveToFirst();
-            if (!cursor.isAfterLast()) {
-                id = cursor.getInt(0);
-            }
-            cursor.close();
-        }
-        return id;
-    }
-
-    private Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
-        try {
-             ContentResolver resolver = getContentResolver();
-             if (resolver == null) {
-                 return null;
-             }
-             return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
-        } catch (UnsupportedOperationException ex) {
-             return null;
-        }
-    }
-
-    private Uri createPlaylist(Resources res, ContentResolver resolver) {
-        ContentValues cv = new ContentValues();
-        cv.put(MediaStore.Audio.Playlists.NAME, res.getString(R.string.audio_db_playlist_name));
-        Uri uri = resolver.insert(MediaStore.Audio.Playlists.getContentUri("external"), cv);
-        if (uri == null) {
-            Toast.makeText(this, R.string.unable_to_store, Toast.LENGTH_SHORT).show();
-        }
-        return uri;
-    }
-
-    private void addToPlaylist(ContentResolver resolver, int audioId, long playlistId) {
-        String[] cols = new String[] {
-               "count(*)"
-        };
-        Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId);
-        Cursor cur = resolver.query(uri, cols, null, null, null);
-        final int base;
-        if (cur != null) {
-            cur.moveToFirst();
-            base = cur.getInt(0);
-            cur.close();
-        } else {
-            base = 0;
-        }
-        ContentValues values = new ContentValues();
-        values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, Integer.valueOf(base + audioId));
-        values.put(MediaStore.Audio.Playlists.Members.AUDIO_ID, audioId);
-        resolver.insert(uri, values);
-    }
-
-    private void registerRecordingListner() {
-        if (mFmRecordingReceiver == null) {
-            mFmRecordingReceiver = new BroadcastReceiver() {
-                 @Override
-                 public void onReceive(Context context, Intent intent) {
-                     Log.d(TAG, "Received intent " +intent);
-                     String action = intent.getAction();
-                     Log.d(TAG, " action = " +action);
-                     if (action.equals(ACTION_FM_RECORDING)) {
-                         int state = intent.getIntExtra("state", STOP);
-                         Log.d(TAG, "ACTION_FM_RECORDING Intent received" + state);
-                         if (state == START) {
-                             Log.d(TAG, "Recording start");
-                             mRecordDuration = intent.getIntExtra("record_duration", mRecordDuration);
-                             if(startRecord()) {
-                                clientProcessName = intent.getStringExtra("process_name");
-                                clientPid = intent.getIntExtra("process_id", -1);
-                                startClientStatusCheck();
-                             }
-                         } else if (state == STOP) {
-                             Log.d(TAG, "Stop recording");
-                             stopRecord();
-                         }
-                     }
-                 }
-            };
-            IntentFilter iFilter = new IntentFilter();
-            iFilter.addAction(ACTION_FM_RECORDING);
-            registerReceiver(mFmRecordingReceiver, iFilter);
-        }
-    }
-
-    private boolean getClientStatus(int pid, String processName) {
-      boolean status = false;
-      ActivityManager actvityManager =
-                    (ActivityManager)this.getSystemService(
-                                                           this.ACTIVITY_SERVICE);
-
-      List<RunningAppProcessInfo> procInfos =
-                                     actvityManager.getRunningAppProcesses();
-
-      for(RunningAppProcessInfo procInfo : procInfos) {
-         if ((pid == procInfo.pid)
-               &&
-              (procInfo.processName.equals(processName))) {
-              status = true;
-              break;
-         }
-      }
-      procInfos.clear();
-      return status;
-    }
-
-    private Runnable clientStatusCheckThread = new Runnable() {
-       @Override
-       public void run() {
-          while(!Thread.currentThread().isInterrupted()) {
-                try {
-                     if(!getClientStatus(clientPid, clientProcessName)) {
-                        stopRecord();
-                        break;
-                     };
-                     Thread.sleep(500);
-                }catch(Exception e) {
-                     Log.d(TAG, "Client status check thread interrupted");
-                     break;
-                }
-          }
-       }
-    };
-
-   private void startClientStatusCheck() {
-       if((mStatusCheckThread == null) ||
-          (mStatusCheckThread.getState() == Thread.State.TERMINATED)) {
-           mStatusCheckThread = new Thread(null,
-                                           clientStatusCheckThread,
-                                           "GetClientStatus");
-       }
-       if((mStatusCheckThread != null) &&
-          (mStatusCheckThread.getState() == Thread.State.NEW)) {
-           mStatusCheckThread.start();
-       }
-   }
-
-   private void stopClientStatusCheck() {
-       if(mStatusCheckThread != null) {
-          mStatusCheckThread.interrupt();
-       }
-   }
-
-    public File createTempFile(String prefix, String suffix, File directory)
-            throws IOException {
-        prefix = getResources().getString(R.string.def_save_name_prefix) + '-';
-        // Force a prefix null check first
-        if (prefix.length() < 3) {
-            throw new IllegalArgumentException("prefix must be at least 3 characters");
-        }
-        if (suffix == null) {
-            suffix = ".tmp";
-        }
-        File tmpDirFile = directory;
-        if (tmpDirFile == null) {
-            String tmpDir = System.getProperty("java.io.tmpdir", ".");
-            tmpDirFile = new File(tmpDir);
-        }
-
-        String nameFormat = getResources().getString(R.string.def_save_name_format);
-        SimpleDateFormat df = new SimpleDateFormat(nameFormat);
-        String currentTime = df.format(System.currentTimeMillis());
-
-        File result;
-        do {
-            result = new File(tmpDirFile, prefix + currentTime + suffix);
-        } while (!result.createNewFile());
-        return result;
-   }
-}
diff --git a/fmapp/Android.mk b/fmapp/Android.mk
deleted file mode 100644
index cb1f066..0000000
--- a/fmapp/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-ifeq ($(BOARD_HAVE_QCOM_FM),true)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src/com/codeaurora/fmradio) \
-        src/com/codeaurora/fmradio/IFMRadioServiceCallbacks.aidl \
-        src/com/codeaurora/fmradio/IFMRadioService.aidl \
-        src/com/codeaurora/fmradio/IFMTransmitterServiceCallbacks.aidl \
-        src/com/codeaurora/fmradio/IFMTransmitterService.aidl \
-
-
-ifeq (1,$(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) >= 11 ))" )))
-LOCAL_SRC_FILES +=  $(call all-java-files-under, src/com/codeaurora/hc_utils)
-else
-LOCAL_SRC_FILES +=  $(call all-java-files-under, src/com/codeaurora/utils)
-endif
-LOCAL_PACKAGE_NAME := FM
-LOCAL_CERTIFICATE := platform
-LOCAL_JNI_SHARED_LIBRARIES := libqcomfm_jni
-LOCAL_JAVA_LIBRARIES := qcom.fmradio
-include $(BUILD_PACKAGE)
-
-endif
diff --git a/fmapp/AndroidManifest.xml b/fmapp/AndroidManifest.xml
deleted file mode 100644
index ff31982..0000000
--- a/fmapp/AndroidManifest.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.codeaurora.fmradio"
-      android:sharedUserId="android.uid.system" >
-    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-    <uses-permission android:name="android.permission.BLUETOOTH" />
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.RECORD_AUDIO" />
-    <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
-
-    <application
-        android:icon="@drawable/ic_launcher_fmradio"
-        android:label="@string/app_name"
-        android:name=".FMAdapterApp">
-        <activity android:icon="@drawable/ic_launcher_fmradio"
-                  android:name=".FMRadio"
-                  android:label="@string/app_name"
-                  android:clearTaskOnLaunch="true"
-                  android:taskAffinity=""
-                  android:launchMode="singleTask"
-                  android:excludeFromRecents="false" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-
-            <intent-filter>
-                <action android:name="com.codeaurora.fmradio.FMRADIO_ACTIVITY" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <receiver android:name="com.codeaurora.fmradio.FMMediaButtonIntentReceiver">
-            <intent-filter>
-                   <action android:name="android.intent.action.MEDIA_BUTTON" />
-            </intent-filter>
-        </receiver>
-
-        <activity android:name=".Settings"
-                  android:label="@string/settings_menu">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:icon="@drawable/ic_launcher_fm_tx"
-                  android:name=".FMTransmitterActivity"
-                  android:label="@string/tx_app_name"
-                  android:clearTaskOnLaunch="true"
-                  android:taskAffinity=""
-                  android:excludeFromRecents="false">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-
-            <intent-filter>
-                <action android:name="com.codeaurora.fmradio.FMTRANSMITTER_ACTIVITY" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-     <receiver android:name="FMTransmitterConfigReceiver">
-            <intent-filter>
-                   <action android:name="android.intent.action.BOOT_COMPLETED" />
-            </intent-filter>
-  </receiver>
-
-     <service android:name=".FMTransmitterService" android:exported="true" />
-        <activity android:name=".FMStats"
-                  android:label="@string/test_menu">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-        <activity android:name=".FmTags"
-                  android:label="@string/rt_plus_tags">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-        <service android:name=".FMRadioService" android:exported="true" />
-
-    </application>
-</manifest>
diff --git a/fmapp/fmtransmitter.xml b/fmapp/fmtransmitter.xml
deleted file mode 100644
index 3331f6f..0000000
--- a/fmapp/fmtransmitter.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-
-        <!--
-                This LinearLayout contains Station Information display and the
-                function buttons
-        -->
-        <LinearLayout android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:orientation="horizontal">
-
-                <LinearLayout android:background="@drawable/station_border"
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:orientation="vertical"
-                        android:gravity="top|fill_vertical">
-
-                        <RelativeLayout android:id="@+id/station_layout"
-                                android:layout_width="fill_parent"
-                                android:layout_height="fill_parent">
-
-                                <!-- This included layout contains Station Information to display -->
-                                <LinearLayout android:id="@+id/stationinfo_layout"
-                                        android:layout_width="fill_parent"
-                                        android:layout_height="wrap_content"
-                                        android:layout_marginTop="5px"
-                                        android:layout_marginLeft="5px"
-                                        android:layout_marginRight="5px"
-                                        android:orientation="vertical"
-                                        android:gravity="fill_vertical">
-
-                                        <LinearLayout android:id="@+id/station_frequency_row"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="wrap_content"
-                                                android:orientation="vertical"
-                                                android:paddingTop="25px"
-                                                android:paddingBottom="25px"
-                                                android:gravity="fill_vertical|center">
-
-                                                <TextView android:id="@+id/transmit_msg_tv"
-                                                        android:textAppearance="?android:attr/textAppearanceSmall"
-                                                        android:layout_width="wrap_content"
-                                                        android:layout_height="wrap_content"
-                                                        android:textSize="15px"
-                                                        android:layout_centerHorizontal="true"
-                                                        android:layout_alignWithParentIfMissing="true"
-                                                        android:text="@string/transmit_msg_string" />
-
-                                                <TextView android:id="@+id/prog_frequency_tv"
-                                                        android:textAppearance="?android:attr/textAppearanceLarge"
-                                                        android:layout_width="wrap_content"
-                                                        android:layout_height="wrap_content"
-                                                        android:layout_centerHorizontal="true"
-                                                        android:layout_alignWithParentIfMissing="true"
-                                                        android:layout_alignParentTop="true"
-                                                        android:layout_alignParentLeft="true"
-                                                        android:textSize="56px"
-                                                        android:text="@string/frequency_string" />
-                                        </LinearLayout>
-
-                                        <!-- Station Radio Text information display -->
-                                        <TextView android:id="@+id/radio_text_tv"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="wrap_content"
-                                                android:textAppearance="?android:attr/textAppearanceMedium"
-                                                android:textSize="16sp"
-                                                android:singleLine="true"
-                                                android:textStyle="bold"
-                                                android:paddingBottom="2px"
-                                                android:paddingLeft="5px"
-                                                android:paddingRight="5px"
-                                                android:gravity="center_horizontal"
-                                                android:text="@string/radio_text_string" />
-                                       <!-- android:gravity="center_horizontal" -->
-                                </LinearLayout>
-
-                                <ImageView android:id="@+id/btn_back"
-                                        android:clickable="true"
-                                        android:focusable="true"
-                                        android:layout_width="wrap_content"
-                                        android:layout_height="fill_parent"
-                                        android:paddingLeft="10px"
-                                        android:paddingRight="2px"
-                                        android:layout_alignParentLeft="true"
-                                        android:layout_centerVertical="true"
-                                        android:visibility="visible"
-                                        android:src="@drawable/btn_arrow_left" />
-
-                                <ImageView android:id="@+id/btn_forward"
-                                        android:clickable="true"
-                                        android:focusable="true"
-                                        android:layout_width="wrap_content"
-                                        android:layout_height="fill_parent"
-                                        android:paddingLeft="2px"
-                                        android:paddingRight="10px"
-                                        android:layout_alignParentRight="true"
-                                        android:layout_centerVertical="true"
-                                        android:visibility="visible"
-                                        android:src="@drawable/btn_arrow_right" />
-
-                        </RelativeLayout>
-                </LinearLayout>
-                <LinearLayout android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:orientation="vertical"
-                        android:layout_gravity="center"
-                        android:layout_marginLeft="5px"
-                        android:layout_marginRight="5px"
-                        android:layout_marginBottom="2px">
-                        <!-- On-Off button -->
-                        <ImageButton android:id="@+id/btn_onoff"
-                                android:layout_width="75px"
-                                android:layout_height="75px"
-                                android:src="@drawable/ic_btn_onoff"
-                                android:layout_marginTop="15px"
-                                android:layout_marginBottom="15px" />
-                </LinearLayout>
-
-         </LinearLayout>
-     <View
-        android:layout_width="fill_parent"
-        android:layout_height="1px"
-        android:background="#ffffffff" />
-
-        <!--
-                Layout contains the Next/Previous Presets and Tune buttons and status
-                msg text
-        -->
-     <LinearLayout android:id="@+id/presets_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layout_weight="0"
-            android:layout_gravity="center"
-            android:layout_marginTop="15dip"
-            android:layout_marginBottom="10dip"
-            android:gravity="center_horizontal">
-
-         <Button android:id="@+id/presets_button_1"
-         android:text="@string/default_station"
-         android:layout_marginLeft="20dip"
-         android:layout_marginRight="20dip"
-         android:textSize="24sp"
-         android:singleLine="true"
-         android:layout_width="110dip"
-         android:layout_height="65dip" />
-
-         <Button android:id="@+id/presets_button_2"
-             android:text="@string/default_station"
-             android:layout_marginRight="20dip"
-             android:textSize="24sp"
-             android:singleLine="true"
-             android:layout_width="110dip"
-             android:layout_height="65dip" />
-
-         <Button android:id="@+id/presets_button_3"
-         android:text="@string/default_station"
-         android:layout_marginRight="20dip"
-             android:textSize="24sp"
-             android:singleLine="true"
-             android:layout_width="110dip"
-             android:layout_height="65dip" />
-
-         <Button android:id="@+id/presets_button_4"
-             android:text="@string/default_blank"
-             android:layout_marginRight="20dip"
-             android:textSize="24sp"
-             android:singleLine="true"
-             android:layout_width="110dip"
-             android:layout_height="65dip" />
-
-         <Button android:id="@+id/presets_button_5"
-             android:text="@string/default_blank"
-             android:layout_marginRight="20dip"
-             android:textSize="24sp"
-             android:singleLine="true"
-             android:layout_width="110dip"
-             android:layout_height="65dip" />
-
-            <Button android:id="@+id/presets_button_6"
-                android:text="@string/default_blank"
-                android:layout_marginRight="20dip"
-                android:textSize="24sp"
-                android:singleLine="true"
-                android:layout_width="110dip"
-                android:layout_height="65dip"/>
-
-        </LinearLayout>
-
-
-</LinearLayout>
diff --git a/fmapp/res/anim/preset_select.xml b/fmapp/res/anim/preset_select.xml
deleted file mode 100644
index 8fcf768..0000000
--- a/fmapp/res/anim/preset_select.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<scale xmlns:android="http://schemas.android.com/apk/res/android"
-    android:fromXScale="0.75"
-    android:toXScale="1.5"
-    android:fromYScale="0.75"
-    android:toYScale="1.5"
-    android:pivotX="50%"
-    android:pivotY="50%"
-    android:startOffset="0"
-    android:duration="500"
-    android:fillBefore="true" />
diff --git a/fmapp/res/drawable/album_border_large.1.png b/fmapp/res/drawable/album_border_large.1.png
deleted file mode 100644
index e5ffbc7..0000000
--- a/fmapp/res/drawable/album_border_large.1.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/alert_dialog_icon.png b/fmapp/res/drawable/alert_dialog_icon.png
deleted file mode 100644
index 0a7de04..0000000
--- a/fmapp/res/drawable/alert_dialog_icon.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/application_border.xml b/fmapp/res/drawable/application_border.xml
deleted file mode 100644
index 479dd75..0000000
--- a/fmapp/res/drawable/application_border.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
-    <stroke android:width="1dp" android:color="#A0000000" />
-    <padding android:left="1dp" android:top="1dp"
-            android:right="1dp" android:bottom="1dp" />
-    <corners android:radius="1dp" />
-</shape>
diff --git a/fmapp/res/drawable/btn_arrow_left.xml b/fmapp/res/drawable/btn_arrow_left.xml
deleted file mode 100644
index 260c62b..0000000
--- a/fmapp/res/drawable/btn_arrow_left.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_arrow_left_press" />
-
-    <item android:state_window_focused="true" android:state_focused="true"
-        android:drawable="@drawable/btn_arrow_left_selected" />
-
-    <item
-        android:drawable="@drawable/btn_arrow_left_default" />
-
-</selector>
diff --git a/fmapp/res/drawable/btn_arrow_left_default.png b/fmapp/res/drawable/btn_arrow_left_default.png
deleted file mode 100644
index 2a35952..0000000
--- a/fmapp/res/drawable/btn_arrow_left_default.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/btn_arrow_left_press.png b/fmapp/res/drawable/btn_arrow_left_press.png
deleted file mode 100644
index 8b72f0a..0000000
--- a/fmapp/res/drawable/btn_arrow_left_press.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/btn_arrow_left_selected.png b/fmapp/res/drawable/btn_arrow_left_selected.png
deleted file mode 100644
index 6cd3c9f..0000000
--- a/fmapp/res/drawable/btn_arrow_left_selected.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/btn_arrow_right.xml b/fmapp/res/drawable/btn_arrow_right.xml
deleted file mode 100644
index 1e37d0a..0000000
--- a/fmapp/res/drawable/btn_arrow_right.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_arrow_right_press" />
-
-    <item android:state_window_focused="true" android:state_focused="true"
-        android:drawable="@drawable/btn_arrow_right_selected" />
-
-    <item
-        android:drawable="@drawable/btn_arrow_right_default" />
-
-</selector>
diff --git a/fmapp/res/drawable/btn_arrow_right_default.png b/fmapp/res/drawable/btn_arrow_right_default.png
deleted file mode 100644
index ae6fd53..0000000
--- a/fmapp/res/drawable/btn_arrow_right_default.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/btn_arrow_right_press.png b/fmapp/res/drawable/btn_arrow_right_press.png
deleted file mode 100644
index a4ae45b..0000000
--- a/fmapp/res/drawable/btn_arrow_right_press.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/btn_arrow_right_selected.png b/fmapp/res/drawable/btn_arrow_right_selected.png
deleted file mode 100644
index 93bcc77..0000000
--- a/fmapp/res/drawable/btn_arrow_right_selected.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_forward.png b/fmapp/res/drawable/ic_btn_forward.png
deleted file mode 100644
index 0936fac..0000000
--- a/fmapp/res/drawable/ic_btn_forward.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_forward_dis.png b/fmapp/res/drawable/ic_btn_forward_dis.png
deleted file mode 100755
index cd9a2f5..0000000
--- a/fmapp/res/drawable/ic_btn_forward_dis.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_onoff.png b/fmapp/res/drawable/ic_btn_onoff.png
deleted file mode 100644
index 4405b43..0000000
--- a/fmapp/res/drawable/ic_btn_onoff.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_preset.png b/fmapp/res/drawable/ic_btn_preset.png
deleted file mode 100644
index 35449b3..0000000
--- a/fmapp/res/drawable/ic_btn_preset.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_search.png b/fmapp/res/drawable/ic_btn_search.png
deleted file mode 100644
index 7eea584..0000000
--- a/fmapp/res/drawable/ic_btn_search.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_btn_search_stop.png b/fmapp/res/drawable/ic_btn_search_stop.png
deleted file mode 100644
index 0b8c4e8..0000000
--- a/fmapp/res/drawable/ic_btn_search_stop.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_launcher_fm_tx.png b/fmapp/res/drawable/ic_launcher_fm_tx.png
deleted file mode 100644
index c6e41b2..0000000
--- a/fmapp/res/drawable/ic_launcher_fm_tx.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_launcher_fmradio.png b/fmapp/res/drawable/ic_launcher_fmradio.png
deleted file mode 100644
index 2b1250c..0000000
--- a/fmapp/res/drawable/ic_launcher_fmradio.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_menu_record.png b/fmapp/res/drawable/ic_menu_record.png
deleted file mode 100644
index 60f7a01..0000000
--- a/fmapp/res/drawable/ic_menu_record.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_signal_2.png b/fmapp/res/drawable/ic_signal_2.png
deleted file mode 100644
index efe4b5f..0000000
--- a/fmapp/res/drawable/ic_signal_2.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_silent_mode.png b/fmapp/res/drawable/ic_silent_mode.png
deleted file mode 100644
index c89291a..0000000
--- a/fmapp/res/drawable/ic_silent_mode.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_silent_mode_off.png b/fmapp/res/drawable/ic_silent_mode_off.png
deleted file mode 100644
index 4748b9e..0000000
--- a/fmapp/res/drawable/ic_silent_mode_off.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_status_fm_tx.png b/fmapp/res/drawable/ic_status_fm_tx.png
deleted file mode 100644
index 29383c9..0000000
--- a/fmapp/res/drawable/ic_status_fm_tx.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/ic_stereo.png b/fmapp/res/drawable/ic_stereo.png
deleted file mode 100644
index b9bfec6..0000000
--- a/fmapp/res/drawable/ic_stereo.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/icon.png b/fmapp/res/drawable/icon.png
deleted file mode 100644
index 7502484..0000000
--- a/fmapp/res/drawable/icon.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/image_border_bg_normal.9.png b/fmapp/res/drawable/image_border_bg_normal.9.png
deleted file mode 100644
index 18e3607..0000000
--- a/fmapp/res/drawable/image_border_bg_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/preset_page_button.xml b/fmapp/res/drawable/preset_page_button.xml
deleted file mode 100644
index f208ae5..0000000
--- a/fmapp/res/drawable/preset_page_button.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2012,2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
- <selector xmlns:android="http://schemas.android.com/apk/res/android">
-     <item android:state_enabled="false"
-           android:drawable="@drawable/ic_btn_forward_dis" /> <!-- disabled -->
-     <item android:state_enabled="true"
-           android:drawable="@drawable/ic_btn_forward" /> <!-- enabled -->
-     <item android:drawable="@drawable/ic_btn_forward" /> <!-- default -->
- </selector>
diff --git a/fmapp/res/drawable/stat_notify_fm.png b/fmapp/res/drawable/stat_notify_fm.png
deleted file mode 100644
index 16ed9bc..0000000
--- a/fmapp/res/drawable/stat_notify_fm.png
+++ /dev/null
Binary files differ
diff --git a/fmapp/res/drawable/station_border.xml b/fmapp/res/drawable/station_border.xml
deleted file mode 100644
index df1e28a..0000000
--- a/fmapp/res/drawable/station_border.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
-    <stroke android:width="1dp" android:color="#FFFFFFFF" />
-    <padding android:left="1dp" android:top="1dp"
-            android:right="1dp" android:bottom="1dp" />
-    <corners android:radius="1dp" />
-</shape>
diff --git a/fmapp/res/layout-normal-land-finger/fmradio.xml b/fmapp/res/layout-normal-land-finger/fmradio.xml
deleted file mode 100644
index 939dcc5..0000000
--- a/fmapp/res/layout-normal-land-finger/fmradio.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:orientation="horizontal"
-    android:layout_height="fill_parent">
-
-    <!-- This LinearLayout contains Station Information display and the function buttons -->
-    <LinearLayout android:id="@+id/station_info_wrapper_layout"
-        android:background="@drawable/station_border"
-        android:orientation="vertical"
-        android:layout_weight="0.6"
-        android:layout_width="0dp"
-        android:layout_height="fill_parent">
-
-        <include layout="@layout/station_info" />
-
-     </LinearLayout>
-
-     <LinearLayout android:id="@+id/navigate_wrapper_layout"
-         android:layout_height="fill_parent"
-         android:layout_weight="0.4"
-         android:layout_width="0dp"
-         android:orientation="vertical"
-         android:layout_alignTop="@id/station_info_wrapper_layout"
-         android:layout_alignBottom="@id/station_info_wrapper_layout"
-         android:layout_toRightOf="@id/station_info_wrapper_layout">
-
-         <!-- Layout contains the Next/Previous Presets and Tune buttons and status msg text-->
-         <include layout="@layout/navigate"/>
-
-     </LinearLayout>
-
-</LinearLayout>
diff --git a/fmapp/res/layout-normal-land-finger/fmtransmitter.xml b/fmapp/res/layout-normal-land-finger/fmtransmitter.xml
deleted file mode 100644
index 3d6014c..0000000
--- a/fmapp/res/layout-normal-land-finger/fmtransmitter.xml
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content" >
-
-    <!--
-        This LinearLayout contains Station Information display and the
-        function buttons
-     -->
-    <RelativeLayout android:id="@+id/station_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:weightSum="1.0">
-
-        <!-- This included layout contains Station Information to display -->
-        <RelativeLayout android:id="@+id/stationinfo_layout"
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:layout_marginTop="5dp"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp" >
-
-           <RelativeLayout android:background="@drawable/station_border"
-               android:layout_width="fill_parent"
-               android:layout_height="wrap_content"
-               android:layout_weight="1" >
-
-               <RelativeLayout android:id="@+id/transmit_msg_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:paddingTop="5dp"
-                   android:paddingBottom="5dp" >
-
-                   <TextView android:id="@+id/transmit_msg_tv"
-                       android:textAppearance="?android:attr/textAppearanceSmall"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:layout_centerInParent="true"
-                       android:textSize="15dp"
-                       android:text="@string/transmit_msg_string" />
-
-               </RelativeLayout>
-
-               <RelativeLayout android:id="@+id/frequency_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:layout_below="@id/transmit_msg_layout" >
-
-                   <ImageView android:id="@+id/btn_back"
-                       android:clickable="true"
-                       android:focusable="true"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:paddingLeft="10dp"
-                       android:layout_alignParentLeft="true"
-                       android:visibility="visible"
-                       android:src="@drawable/btn_arrow_left" />
-
-                   <TextView android:id="@+id/prog_frequency_tv"
-                       android:textAppearance="?android:attr/textAppearanceLarge"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:layout_centerInParent="true"
-                       android:textSize="56dp"
-                       android:text="@string/frequency_string" />
-
-                   <ImageView android:id="@+id/btn_forward"
-                       android:clickable="true"
-                       android:focusable="true"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:paddingRight="10dp"
-                       android:layout_alignParentRight="true"
-                       android:visibility="visible"
-                       android:src="@drawable/btn_arrow_right" />
-
-               </RelativeLayout>
-
-               <!-- Station Radio Text information display -->
-               <RelativeLayout android:id="@+id/radio_text_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:layout_below="@id/frequency_layout" >
-
-                   <TextView android:id="@+id/radio_text_tv"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:textAppearance="?android:attr/textAppearanceMedium"
-                       android:textSize="16dp"
-                       android:singleLine="true"
-                       android:textStyle="bold"
-                       android:paddingLeft="5dp"
-                       android:paddingRight="5dp"
-                       android:layout_centerInParent="true"
-                       android:text="@string/radio_text_string" />
-
-               </RelativeLayout>
-
-           </RelativeLayout>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/presets_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/stationinfo_layout"
-            android:layout_marginTop="15dp"
-            android:layout_marginBottom="10dp" >
-
-            <RelativeLayout android:layout_width="wrap_content"
-                android:layout_centerInParent="true"
-                android:layout_height="wrap_content" >
-
-                <Button android:id="@+id/presets_button_1"
-                    android:text="@string/default_station"
-                    android:layout_marginLeft="10dp"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-                <Button android:id="@+id/presets_button_2"
-                    android:text="@string/default_station"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_1"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-                <Button android:id="@+id/presets_button_3"
-                    android:text="@string/default_station"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_2"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-                <Button android:id="@+id/presets_button_4"
-                    android:text="@string/default_blank"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_3"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-                <Button android:id="@+id/presets_button_5"
-                    android:text="@string/default_blank"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_4"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-                <Button android:id="@+id/presets_button_6"
-                    android:text="@string/default_blank"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_5"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"/>
-
-            </RelativeLayout>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/layout_on_off"
-            android:layout_below="@id/presets_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp"
-            android:layout_marginBottom="2dp">
-
-            <!-- On-Off button -->
-            <ImageButton android:id="@+id/btn_onoff"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/ic_btn_onoff"
-                android:layout_marginTop="5dp"
-                android:layout_centerInParent="true"
-                android:layout_marginBottom="5dp" />
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-normal-land-finger/navigate.xml b/fmapp/res/layout-normal-land-finger/navigate.xml
deleted file mode 100644
index ddc650b..0000000
--- a/fmapp/res/layout-normal-land-finger/navigate.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-     <RelativeLayout android:id="@+id/message_row"
-         android:layout_width="fill_parent"
-         android:layout_height="wrap_content">
-
-         <TextView android:id="@+id/record_msg_tv"
-             android:textAppearance="?android:attr/textAppearanceMedium"
-             android:layout_width="wrap_content"
-             android:layout_height="wrap_content"
-             android:layout_alignParentLeft="true"
-             android:textSize="16dp"
-             android:textStyle="bold"
-             android:text="@string/default_record"/>
-
-         <Button android:id="@+id/btn_presets_list"
-             android:text= "@string/default_preset_list_name"
-             android:textSize="24dp"
-             android:singleLine="true"
-             android:textStyle="bold"
-             android:layout_centerHorizontal="true"
-             android:layout_width="wrap_content"
-             android:layout_height="wrap_content" />
-
-         <TextView android:id="@+id/sleep_msg_tv"
-             android:textAppearance="?android:attr/textAppearanceMedium"
-             android:layout_width="wrap_content"
-             android:layout_height="wrap_content"
-             android:layout_alignParentRight="true"
-             android:textSize="16dp"
-             android:textStyle="bold"
-             androidtext="@string/default_sleep"/>
-
-     </RelativeLayout>
-
-     <RelativeLayout android:id="@+id/presets_upper_layout"
-         android:layout_width="fill_parent"
-         android:layout_height="wrap_content"
-         android:layout_below="@id/message_row"
-         android:layout_marginTop="1dp"
-         android:layout_marginBottom="5dp">
-
-         <RelativeLayout android:id="@+id/presets_upper_layout1"
-             android:layout_width="wrap_content"
-             android:layout_height="wrap_content">
-
-             <Button android:id="@+id/presets_button_1"
-                 android:text="@string/default_station"
-                 android:textSize="24dp"
-                 android:layout_marginRight="10dp"
-                 android:singleLine="true"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content" />
-
-             <Button android:id="@+id/presets_button_2"
-                 android:text="@string/default_station"
-                 android:layout_marginRight="10dp"
-                 android:textSize="24dp"
-                 android:singleLine="true"
-                 android:layout_alignTop="@id/presets_button_1"
-                 android:layout_alignBottom="@id/presets_button_1"
-                 android:layout_toRightOf="@id/presets_button_1"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content" />
-
-             <Button android:id="@+id/presets_button_3"
-                 android:text="@string/default_station"
-                 android:textSize="24dp"
-                 android:singleLine="true"
-                 android:layout_alignTop="@id/presets_button_2"
-                 android:layout_alignBottom="@id/presets_button_2"
-                 android:layout_toRightOf="@id/presets_button_2"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content" />
-
-          </RelativeLayout>
-
-          <RelativeLayout android:id="@+id/presets_upper_layout2"
-            android:layout_width="wrap_content"
-            android:layout_below="@id/presets_upper_layout1"
-            android:layout_height="wrap_content">
-
-             <Button android:id="@+id/presets_button_4"
-                 android:text="@string/default_blank"
-                 android:layout_marginRight="10dp"
-                 android:textSize="24dp"
-                 android:singleLine="true"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content"/>
-
-             <Button android:id="@+id/presets_button_5"
-                 android:text="@string/default_blank"
-                 android:layout_marginRight="10dp"
-                 android:textSize="24dp"
-                 android:singleLine="true"
-                 android:layout_alignTop="@id/presets_button_4"
-                 android:layout_alignBottom="@id/presets_button_4"
-                 android:layout_toRightOf="@id/presets_button_4"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content" />
-
-             <ImageButton android:id="@+id/btn_preset_page"
-                 android:src="@drawable/ic_btn_forward"
-                 android:layout_alignTop="@id/presets_button_5"
-                 android:layout_alignBottom="@id/presets_button_5"
-                 android:layout_toRightOf="@id/presets_button_5"
-                 android:layout_width="75dp"
-                 android:layout_height="wrap_content"/>
-
-         </RelativeLayout>
-
-         <RelativeLayout android:id="@+id/silent_on_off_layout"
-             android:layout_width="wrap_content"
-             android:layout_centerHorizontal="true"
-             android:layout_below="@id/presets_upper_layout2"
-             android:layout_height="wrap_content">
-
-             <ImageButton android:id="@+id/btn_silent"
-                 android:src="@drawable/ic_silent_mode_off"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"/>
-
-             <ImageButton android:id="@+id/btn_onoff"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:layout_toRightOf="@id/btn_silent"
-                 android:src="@drawable/ic_btn_onoff"/>
-
-         </RelativeLayout>
-
-     </RelativeLayout>
-
-</merge>
diff --git a/fmapp/res/layout-normal-land-finger/station_info.xml b/fmapp/res/layout-normal-land-finger/station_info.xml
deleted file mode 100644
index e2304d5..0000000
--- a/fmapp/res/layout-normal-land-finger/station_info.xml
+++ /dev/null
@@ -1,178 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <RelativeLayout android:id="@+id/stationinfo_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="1dip"
-        android:layout_marginLeft="1dip"
-        android:layout_marginRight="1dip">
-
-        <RelativeLayout android:id="@+id/top_most"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="5dip"
-            android:layout_alignParentTop="true"
-            android:layout_marginRight="5dip">
-
-            <ImageView android:id="@+id/signal_level"
-                android:src="@drawable/ic_signal_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentLeft="true"/>
-
-            <TextView android:id="@+id/prog_service_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:layout_centerHorizontal="true"
-                android:layout_alignBaseline="@id/signal_level"
-                android:textSize="16dip"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:text="@string/prog_service_string"/>
-
-            <TextView android:id="@+id/stereo_text_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentRight="true"
-                android:layout_alignBaseline="@id/signal_level"
-                android:textSize="16dip"
-                android:text="@string/default_audio"/>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/station_id_row"
-            android:layout_below="@id/top_most"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content" >
-
-            <TextView android:id="@+id/call_sign_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_centerInParent="true"
-                android:layout_alignParentTop="true"
-                android:textSize="16dip"
-                android:paddingRight="5dip"
-                android:paddingLeft="5dip"
-                android:text="@string/station_id_string" />
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/frequency_layout"
-             android:layout_width="fill_parent"
-             android:layout_below="@id/station_id_row"
-             android:layout_height="wrap_content">
-
-             <ImageView
-                 android:id="@+id/btn_back"
-                 android:clickable="true"
-                 android:focusable="true"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:layout_alignParentLeft="true"
-                 android:visibility="visible"
-                 android:src="@drawable/btn_arrow_left"/>
-
-             <TextView android:id="@+id/prog_frequency_tv"
-                 android:textAppearance="?android:attr/textAppearanceLarge"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:layout_centerInParent="true"
-                 android:textSize="50dip"
-                 android:text="@string/frequency_string" />
-
-             <ImageView
-                 android:id="@+id/btn_forward"
-                 android:clickable="true"
-                 android:focusable="true"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:paddingLeft="2dip"
-                 android:paddingRight="10dip"
-                 android:layout_alignParentRight="true"
-                 android:visibility="visible"
-                 android:src="@drawable/btn_arrow_right"/>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/pty_string_row"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/frequency_layout">
-
-            <TextView android:id="@+id/pty_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_centerInParent="true"
-                android:textSize="16dip"
-                android:text="@string/pty_string" />
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/radio_text_row"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/pty_string_row">
-
-            <!-- Station Radio Text information display -->
-            <TextView android:id="@+id/radio_text_tv"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="16dp"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:gravity="center_horizontal"
-                android:text="@string/radio_text_string"/>
-
-            <TextView android:id="@+id/eradio_text_tv"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="16dip"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:paddingLeft="2dip"
-                android:paddingRight="2dip"
-                android:paddingBottom="5dip"
-                android:gravity="center_horizontal"
-                android:layout_below ="@id/radio_text_tv"
-                android:text="@string/eradio_text_string"/>
-
-        </RelativeLayout>
-    </RelativeLayout>
-</merge>
diff --git a/fmapp/res/layout-normal/fmradio.xml b/fmapp/res/layout-normal/fmradio.xml
deleted file mode 100644
index 5b9197c..0000000
--- a/fmapp/res/layout-normal/fmradio.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/fmradio"
-    android:background="@drawable/application_border"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content">
-
-    <!-- This LinearLayout contains Station Information display and the function buttons -->
-
-    <RelativeLayout android:id="@+id/stationinfo_layout"
-        android:background="@drawable/station_border"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="5dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true" >
-
-       <!-- This included layout contains Station Information to display -->
-       <include layout="@layout/station_info" />
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/preset_full_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/stationinfo_layout"
-        android:layout_alignParentLeft="true">
-
-     <!-- Layout contains the Next/Previous Presets and Tune buttons and status msg text-->
-        <include layout="@layout/navigate" />
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/on_off_separator_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="20dp"
-        android:layout_below="@id/preset_full_layout">
-
-        <View android:id="@+id/on_off_separator"
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:background="#ffffffff"/>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/layout_on_off"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="1dp"
-        android:layout_centerInParent="true"
-        android:layout_below="@id/on_off_separator_layout">
-
-      <ImageButton android:id="@+id/btn_silent"
-        android:src="@drawable/ic_silent_mode_off"
-        android:layout_width="120dp"
-        android:layout_height="65dp" />
-
-      <ImageButton android:id="@+id/btn_onoff"
-        android:src="@drawable/ic_btn_onoff"
-        android:layout_toRightOf="@id/btn_silent"
-        android:layout_width="120dp"
-        android:layout_height="65dp" />
-    </RelativeLayout>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-normal/fmtags.xml b/fmapp/res/layout-normal/fmtags.xml
deleted file mode 100644
index 352320f..0000000
--- a/fmapp/res/layout-normal/fmtags.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="fill_parent"
-    android:layout_width="fill_parent">
-
-    <ListView
-        android:id="@+id/TagListView"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:textSize="30sp"/>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-normal/fmtransmitter.xml b/fmapp/res/layout-normal/fmtransmitter.xml
deleted file mode 100644
index 1cffca9..0000000
--- a/fmapp/res/layout-normal/fmtransmitter.xml
+++ /dev/null
@@ -1,239 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/fmtransmitter"
-    android:background="@drawable/application_border"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
-
-    <!-- This RelativeLayout contains Station Information display and the function buttons -->
-    <RelativeLayout android:id="@+id/stationinfo_layout"
-        android:background="@drawable/station_border"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="10dp"
-        android:layout_marginBottom="20dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true" >
-
-        <RelativeLayout android:id="@+id/transmit_msg_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true" >
-
-            <TextView android:id="@+id/transmit_msg_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textSize="15dp"
-                android:layout_centerInParent="true"
-                android:layout_alignWithParentIfMissing="true"
-                android:text="@string/transmit_msg_string"/>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/frequency_layout"
-            android:layout_below="@id/transmit_msg_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content">
-
-            <ImageView android:id="@+id/btn_back"
-                android:clickable="true"
-                android:focusable="true"
-                android:layout_alignParentLeft="true"
-                android:paddingLeft="2dip"
-                android:visibility="visible"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/btn_arrow_left"/>
-
-            <TextView android:id="@+id/prog_frequency_tv"
-                android:textAppearance="?android:attr/textAppearanceLarge"
-                android:textSize="60dip"
-                android:layout_centerInParent="true"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/frequency_string"/>
-
-            <ImageView android:id="@+id/btn_forward"
-                android:clickable="true"
-                android:focusable="true"
-                android:paddingRight="2dp"
-                android:layout_alignParentRight="true"
-                android:visibility="visible"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/btn_arrow_right"/>
-
-        </RelativeLayout>
-
-        <!-- Station Radio Text information display -->
-        <RelativeLayout android:id="@+id/radio_text_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/frequency_layout">
-
-            <TextView android:id="@+id/radio_text_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20dp"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:paddingLeft="2dp"
-                android:paddingRight="2dp"
-                android:paddingBottom="5dp"
-                android:layout_marginTop="20dp"
-                android:layout_marginBottom="10dp"
-                android:layout_centerInParent="true"
-                android:text="@string/radio_text_string"/>
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/presets_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/stationinfo_layout">
-
-        <RelativeLayout android:id="@+id/presets_layout_center"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_centerInParent="true">
-
-            <!--  Upper Presets -->
-            <RelativeLayout android:id="@+id/presets_upper_layout"
-                android:gravity="top"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content">
-
-                <Button android:id="@+id/presets_button_1"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-                <Button android:id="@+id/presets_button_2"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_1"
-                    android:layout_alignTop="@id/presets_button_1"
-                    android:layout_alignBottom="@id/presets_button_1"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-                <Button android:id="@+id/presets_button_3"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_2"
-                    android:layout_alignTop="@id/presets_button_2"
-                    android:layout_alignBottom="@id/presets_button_2"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-            </RelativeLayout>
-
-            <!--  Lower Presets -->
-            <RelativeLayout android:id="@+id/presets_lower_layout"
-                android:layout_below="@id/presets_upper_layout"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" >
-
-                <Button android:id="@+id/presets_button_4"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-                <Button android:id="@+id/presets_button_5"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_4"
-                    android:layout_alignTop="@id/presets_button_4"
-                    android:layout_alignBottom="@id/presets_button_4"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-                <Button android:id="@+id/presets_button_6"
-                    android:text="@string/default_blank"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textSize="24dp"
-                    android:singleLine="true"
-                    android:layout_toRightOf="@id/presets_button_5"
-                    android:layout_alignTop="@id/presets_button_5"
-                    android:layout_alignBottom="@id/presets_button_5"
-                    android:layout_width="120dp"
-                    android:layout_height="65dp"/>
-
-            </RelativeLayout>
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/on_off_separator_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="20dp"
-        android:layout_below="@id/presets_layout">
-
-        <View android:id="@+id/on_off_separator"
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:background="#ffffffff"/>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/layout_on_off"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/on_off_separator_layout"
-        android:layout_marginBottom="20dp">
-
-        <ImageButton android:id="@+id/btn_onoff"
-            android:src="@drawable/ic_btn_onoff"
-            android:layout_below="@id/on_off_separator"
-            android:layout_centerInParent="true"
-            android:layout_width="120dp"
-            android:layout_height="65dp"/>
-
-    </RelativeLayout>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-normal/navigate.xml b/fmapp/res/layout-normal/navigate.xml
deleted file mode 100644
index bd8cdea..0000000
--- a/fmapp/res/layout-normal/navigate.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-  <RelativeLayout android:id="@+id/message_row"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="1dp"
-        android:paddingTop="1dp"
-        android:paddingBottom="1dp">
-
-     <TextView android:id="@+id/record_msg_tv"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
-        android:textSize="15dp"
-        android:textStyle="bold"
-        android:gravity="fill"
-        android:text="@string/default_record" />
-
-     <Button android:id="@+id/btn_presets_list"
-        android:text="@string/default_preset_list_name"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:textSize="24dp"
-        android:textStyle="bold"
-        android:singleLine="true"
-        android:layout_centerHorizontal="true"
-        android:layout_alignParentTop="true"
-        android:layout_gravity="center"
-        android:layout_marginLeft="10dp"
-        android:layout_marginRight="10dp"
-        android:layout_marginBottom="10dp"
-        android:gravity="fill"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
-
-     <TextView android:id="@+id/sleep_msg_tv"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentRight="true"
-        android:layout_alignBaseline="@+id/btn_presets_list"
-        android:textSize="15dp"
-        android:textStyle="bold"
-        android:gravity="fill"
-        android:text="@string/default_sleep" />
-  </RelativeLayout>
-
-  <RelativeLayout android:id="@+id/presets_layout"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/message_row"
-        android:layout_centerInParent="true">
-
-   <!--  Upper Presets -->
-   <RelativeLayout android:id="@+id/presets_upper_layout"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:gravity="top">
-
-     <Button android:id="@+id/presets_button_1"
-        android:text="@string/default_blank"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="24dp"
-        android:singleLine="true"
-        android:gravity="fill"
-        android:layout_width="85dp"
-        android:layout_height="wrap_content" />
-
-     <Button android:id="@+id/presets_button_2"
-        android:text="@string/default_blank"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="24dp"
-        android:singleLine="true"
-        android:layout_toRightOf="@id/presets_button_1"
-        android:layout_alignTop="@id/presets_button_1"
-        android:layout_alignBottom="@id/presets_button_1"
-        android:gravity="fill"
-        android:layout_width="85dp"
-        android:layout_height="wrap_content" />
-
-     <Button android:id="@+id/presets_button_3"
-        android:text="@string/default_blank"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="24dp"
-        android:singleLine="true"
-        android:layout_toRightOf="@id/presets_button_2"
-        android:layout_alignTop="@id/presets_button_2"
-        android:layout_alignBottom="@id/presets_button_2"
-        android:layout_width="85dp"
-        android:gravity="fill"
-        android:layout_height="wrap_content" />
-  </RelativeLayout>
-
-<!--  Lower Presets -->
-  <RelativeLayout android:id="@+id/presets_lower_layout"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/presets_upper_layout"
-        android:layout_alignLeft="@id/presets_upper_layout"
-        android:layout_alignRight="@id/presets_upper_layout">
-
-     <Button android:id="@+id/presets_button_4"
-        android:text="@string/default_blank"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="24dp"
-        android:singleLine="true"
-        android:layout_width="85dp"
-        android:gravity="fill"
-        android:layout_alignLeft="@id/presets_button_1"
-        android:layout_alignRight="@id/presets_button_1"
-        android:layout_height="wrap_content" />
-
-     <Button android:id="@+id/presets_button_5"
-        android:text="@string/default_blank"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="24dp"
-        android:singleLine="true"
-        android:layout_toRightOf="@id/presets_button_4"
-        android:layout_alignTop="@id/presets_button_4"
-        android:layout_alignBottom="@id/presets_button_4"
-        android:layout_alignLeft="@id/presets_button_2"
-        android:layout_alignRight="@id/presets_button_2"
-        android:gravity="fill"
-        android:layout_width="85dp"
-        android:layout_height="wrap_content" />
-
-     <ImageButton android:id="@+id/btn_preset_page"
-        android:src="@drawable/ic_btn_forward"
-        android:layout_toRightOf="@id/presets_button_5"
-        android:layout_alignTop="@id/presets_button_5"
-        android:layout_alignBottom="@id/presets_button_5"
-        android:layout_alignLeft="@id/presets_button_3"
-        android:layout_alignRight="@id/presets_button_3"
-        android:gravity="fill"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
-   </RelativeLayout>
- </RelativeLayout>
-
- <RelativeLayout android:id="@+id/scanning_stoplayout"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="gone"
-        android:gravity="center">
-
-    <Button android:id="@+id/btn_scanning_stop"
-        android:clickable="true"
-        android:text="@string/stop_scanning"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="32dp"
-        android:singleLine="true"
-        android:padding="20dp"
-        android:gravity="fill"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content" />
- </RelativeLayout>
-
-</merge>
diff --git a/fmapp/res/layout-normal/station_info.xml b/fmapp/res/layout-normal/station_info.xml
deleted file mode 100644
index e47f823..0000000
--- a/fmapp/res/layout-normal/station_info.xml
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-<RelativeLayout android:id="@+id/station_info"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:layout_weight="0"
-    android:gravity="top">
-
-    <RelativeLayout android:id="@+id/top_most"
-       android:layout_width="fill_parent"
-       android:gravity="top"
-       android:layout_height="wrap_content">
-
-       <ImageView android:id="@+id/signal_level"
-          android:src="@drawable/ic_signal_2"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:paddingLeft="5dp"
-          android:layout_alignParentTop="true"
-          android:layout_alignParentLeft="true"/>
-
-       <TextView android:id="@+id/prog_service_tv"
-          android:textAppearance="?android:attr/textAppearanceMedium"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_alignParentTop="true"
-          android:layout_centerHorizontal="true"
-          android:layout_alignBaseline="@id/signal_level"
-          android:textSize="16dp"
-          android:singleLine="true"
-          android:textStyle="bold"
-          android:text="@string/prog_service_string" />
-
-      <TextView android:id="@+id/stereo_text_tv"
-         android:textAppearance="?android:attr/textAppearanceMedium"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="5dp"
-         android:layout_alignParentTop="true"
-         android:layout_alignParentRight="true"
-         android:layout_alignBaseline="@id/signal_level"
-         android:textSize="16dp"
-         android:text="@string/default_audio" />
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/station_id_row"
-       android:layout_width="fill_parent"
-       android:layout_below="@id/top_most"
-       android:layout_height="wrap_content">
-
-       <TextView android:id="@+id/call_sign_tv"
-         android:textAppearance="?android:attr/textAppearanceMedium"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:textSize="16dp"
-         android:layout_centerInParent="true"
-         android:text="@string/station_id_string" />
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/station_frequency_row"
-       android:layout_width="fill_parent"
-       android:layout_below="@id/station_id_row"
-       android:layout_height="wrap_content"
-       android:gravity="center" >
-
-       <TextView android:id="@+id/prog_frequency_tv"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textSize="50dp"
-        android:layout_centerHorizontal="true"
-        android:layout_centerVertical="true"
-        android:text="@string/frequency_string"/>
-
-       <ImageView android:id="@+id/btn_back"
-        android:clickable="true"
-        android:focusable="true"
-        android:layout_width="wrap_content"
-        android:layout_height="100dp"
-        android:paddingLeft="2dp"
-        android:layout_alignParentLeft="true"
-        android:visibility="visible"
-        android:layout_alignWithParentIfMissing="true"
-        android:src="@drawable/btn_arrow_left" />
-
-      <ImageView android:id="@+id/btn_forward"
-        android:clickable="true"
-        android:focusable="true"
-        android:layout_width="wrap_content"
-        android:layout_height="100dp"
-        android:paddingRight="2dp"
-        android:layout_alignParentRight="true"
-        android:visibility="visible"
-        android:layout_alignWithParentIfMissing="true"
-        android:src="@drawable/btn_arrow_right" />
-    </RelativeLayout>
-
-     <RelativeLayout android:id="@+id/second_layout"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_alignLeft="@id/station_frequency_row"
-       android:layout_alignRight="@id/station_frequency_row"
-       android:layout_below="@id/station_frequency_row" >
-
-      <TextView android:id="@+id/pty_tv"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textSize="16dp"
-        android:layout_centerInParent="true"
-        android:text="@string/pty_string" />
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/third_layout"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:gravity="center_vertical"
-       android:layout_alignLeft="@id/second_layout"
-       android:layout_alignRight="@id/second_layout"
-       android:layout_below="@id/second_layout" >
-
-      <TextView android:id="@+id/radio_text_tv"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textSize="16dp"
-        android:singleLine="true"
-        android:textStyle="bold"
-        android:paddingLeft="2dp"
-        android:paddingRight="2dp"
-        android:paddingBottom="5dp"
-        android:gravity="center"
-        android:text="@string/radio_text_string" />
-
-      <TextView android:id="@+id/eradio_text_tv"
-         android:layout_width="fill_parent"
-         android:layout_height="wrap_content"
-         android:textAppearance="?android:attr/textAppearanceMedium"
-         android:textSize="16dp"
-         android:singleLine="true"
-         android:textStyle="bold"
-         android:paddingLeft="2dp"
-         android:paddingRight="2dp"
-         android:paddingBottom="5dp"
-         android:layout_below="@id/radio_text_tv"
-         android:gravity="center_horizontal"
-         android:text="@string/eradio_text_string"/>
-   </RelativeLayout>
-    <!-- Station Radio Text information display -->
- </RelativeLayout>
-</merge>
diff --git a/fmapp/res/layout-small-land-finger/fmradio.xml b/fmapp/res/layout-small-land-finger/fmradio.xml
deleted file mode 100644
index e55c239..0000000
--- a/fmapp/res/layout-small-land-finger/fmradio.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
-
-    <!-- This LinearLayout contains Station Information display and the function buttons -->
-    <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="horizontal">
-
-        <LinearLayout
-            android:background="@drawable/station_border"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:layout_weight="1"
-            android:orientation="vertical"
-            android:gravity="top|fill_vertical">
-
-            <RelativeLayout android:id="@+id/station_layout"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-
-                <!-- This included layout contains Station Information to display -->
-                <include layout="@layout/station_info" />
-
-                <ImageView
-                    android:id="@+id/btn_back"
-                    android:clickable="true"
-                    android:focusable="true"
-                    android:layout_width="wrap_content"
-                    android:layout_height="fill_parent"
-                    android:paddingLeft="10dip"
-                    android:paddingRight="2dip"
-                    android:layout_alignParentLeft="true"
-                    android:layout_centerVertical="true"
-                    android:visibility="visible"
-                    android:src="@drawable/btn_arrow_left"/>
-
-                <ImageView
-                    android:id="@+id/btn_forward"
-                    android:clickable="true"
-                    android:focusable="true"
-                    android:layout_width="wrap_content"
-                    android:layout_height="fill_parent"
-                    android:paddingLeft="2dip"
-                    android:paddingRight="10dip"
-                    android:layout_alignParentRight="true"
-                    android:layout_centerVertical="true"
-                    android:visibility="visible"
-                    android:src="@drawable/btn_arrow_right"/>
-
-            </RelativeLayout>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:layout_gravity="center"
-            android:layout_marginLeft="5dip"
-            android:layout_marginRight="5dip"
-            android:layout_marginBottom="2dip">
-
-            <!-- On-Off button -->
-            <ImageButton android:id="@+id/btn_onoff"
-                android:layout_width="70dip"
-                android:layout_height="60dip"
-                android:src="@drawable/ic_btn_onoff"
-                android:layout_marginBottom="15dp"/>
-
-            <ImageButton android:id="@+id/btn_silent"
-                android:src="@drawable/ic_silent_mode_off"
-                android:layout_width="70dip"
-                android:layout_height="60dip"
-                android:layout_marginBottom="15dip"/>
-
-        </LinearLayout>
-
-    </LinearLayout>
-
-    <!-- Layout contains the Next/Previous Presets and Tune buttons and status msg text-->
-    <include layout="@layout/navigate" />
-
-</LinearLayout>
diff --git a/fmapp/res/layout-small-land-finger/fmtransmitter.xml b/fmapp/res/layout-small-land-finger/fmtransmitter.xml
deleted file mode 100644
index f9a9853..0000000
--- a/fmapp/res/layout-small-land-finger/fmtransmitter.xml
+++ /dev/null
@@ -1,215 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-    <!--
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-    -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content">
-
-    <!--
-        This LinearLayout contains Station Information display and the
-        function buttons
-    -->
-       <RelativeLayout android:background="@drawable/station_border"
-           android:layout_width="fill_parent"
-           android:layout_height="wrap_content"
-           android:layout_weight="1" >
-
-           <RelativeLayout android:id="@+id/station_layout"
-               android:layout_width="fill_parent"
-               android:layout_height="wrap_content">
-
-               <!-- This included layout contains Station Information to display -->
-               <RelativeLayout android:id="@+id/stationinfo_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:layout_marginTop="5dp"
-                   android:layout_marginLeft="5dp"
-                   android:layout_marginRight="5dp" >
-
-                   <RelativeLayout android:id="@+id/transmit_msg_layout"
-                       android:layout_width="fill_parent"
-                       android:layout_height="wrap_content"
-                       android:paddingTop="20dp"
-                       android:paddingBottom="20dp" >
-
-                       <TextView android:id="@+id/transmit_msg_tv"
-                           android:textAppearance="?android:attr/textAppearanceSmall"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:layout_centerInParent="true"
-                           android:textSize="15dp"
-                           android:text="@string/transmit_msg_string" />
-
-                   </RelativeLayout>
-
-                   <RelativeLayout android:id="@+id/frequency_layout"
-                       android:layout_width="fill_parent"
-                       android:layout_height="wrap_content"
-                       android:layout_below="@id/transmit_msg_layout" >
-
-                       <ImageView android:id="@+id/btn_back"
-                           android:clickable="true"
-                           android:focusable="true"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:paddingLeft="10dp"
-                           android:layout_alignParentLeft="true"
-                           android:visibility="visible"
-                           android:src="@drawable/btn_arrow_left" />
-
-                       <TextView android:id="@+id/prog_frequency_tv"
-                           android:textAppearance="?android:attr/textAppearanceLarge"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:layout_centerInParent="true"
-                           android:textSize="56dp"
-                           android:text="@string/frequency_string" />
-
-                       <ImageView android:id="@+id/btn_forward"
-                           android:clickable="true"
-                           android:focusable="true"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:paddingRight="10dp"
-                           android:layout_alignParentRight="true"
-                           android:visibility="visible"
-                           android:src="@drawable/btn_arrow_right" />
-
-                   </RelativeLayout>
-
-                   <!-- Station Radio Text information display -->
-                   <RelativeLayout android:id="@+id/radio_text_layout"
-                       android:layout_width="fill_parent"
-                       android:layout_height="wrap_content"
-                       android:layout_below="@id/frequency_layout" >
-
-                       <TextView android:id="@+id/radio_text_tv"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:textAppearance="?android:attr/textAppearanceMedium"
-                           android:textSize="16dp"
-                           android:singleLine="true"
-                           android:textStyle="bold"
-                           android:paddingLeft="5dp"
-                           android:paddingRight="5dp"
-                           android:layout_centerInParent="true"
-                           android:text="@string/radio_text_string" />
-
-                   </RelativeLayout>
-
-               </RelativeLayout>
-
-               <RelativeLayout android:id="@+id/presets_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:layout_below="@id/stationinfo_layout"
-                   android:layout_marginTop="15dp"
-                   android:layout_marginBottom="10dp" >
-
-                   <RelativeLayout android:layout_width="wrap_content"
-                       android:layout_centerInParent="true"
-                       android:layout_height="wrap_content" >
-
-                       <Button android:id="@+id/presets_button_1"
-                           android:text="@string/default_station"
-                           android:layout_marginLeft="10dp"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content" />
-
-                       <Button android:id="@+id/presets_button_2"
-                           android:text="@string/default_station"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_toRightOf="@id/presets_button_1"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content" />
-
-                       <Button android:id="@+id/presets_button_3"
-                           android:text="@string/default_station"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_toRightOf="@id/presets_button_2"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content" />
-
-                       <Button android:id="@+id/presets_button_4"
-                           android:text="@string/default_blank"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_toRightOf="@id/presets_button_3"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content" />
-
-                       <Button android:id="@+id/presets_button_5"
-                           android:text="@string/default_blank"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_toRightOf="@id/presets_button_4"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content" />
-
-                       <Button android:id="@+id/presets_button_6"
-                           android:text="@string/default_blank"
-                           android:textSize="24dp"
-                           android:singleLine="true"
-                           android:layout_toRightOf="@id/presets_button_5"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"/>
-
-                   </RelativeLayout>
-
-               </RelativeLayout>
-
-               <RelativeLayout android:id="@+id/layout_on_off"
-                   android:layout_below="@id/presets_layout"
-                   android:layout_width="fill_parent"
-                   android:layout_height="wrap_content"
-                   android:layout_marginLeft="5dp"
-                   android:layout_marginRight="5dp"
-                   android:layout_marginBottom="2dp">
-
-                   <!-- On-Off button -->
-                   <ImageButton android:id="@+id/btn_onoff"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:src="@drawable/ic_btn_onoff"
-                       android:layout_marginTop="5dp"
-                       android:layout_centerInParent="true"
-                       android:layout_marginBottom="5dp" />
-
-               </RelativeLayout>
-
-           </RelativeLayout>
-
-       </RelativeLayout>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-small-land-finger/navigate.xml b/fmapp/res/layout-small-land-finger/navigate.xml
deleted file mode 100644
index 269793b..0000000
--- a/fmapp/res/layout-small-land-finger/navigate.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-     <View
-        android:layout_width="fill_parent"
-        android:layout_height="1dip"
-        android:background="#ffffffff" />
-
-    <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="2dip"
-        android:layout_marginLeft="5dip"
-        android:layout_marginRight="5dip"
-        android:layout_marginBottom="2dip"
-        android:orientation="vertical"
-        android:gravity="bottom"
-        >
-            <RelativeLayout android:id="@+id/message_row"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                >
-
-                <TextView android:id="@+id/record_msg_tv"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical"
-                    android:layout_alignParentLeft="true"
-                    android:textSize="14dip"
-                    android:textStyle="bold"
-                    android:text="@string/default_record"
-                    />
-
-                <Button android:id="@+id/btn_presets_list"
-                    android:text= "@string/default_preset_list_name"
-                    android:textStyle="bold"
-                    android:singleLine="true"
-                    android:layout_gravity="center"
-                    android:layout_centerHorizontal="true"
-                    android:layout_marginLeft="10dip"
-                    android:layout_marginRight="10dip"
-                    android:layout_width="140dip"
-                    android:layout_height="45dip" />
-
-                <TextView android:id="@+id/sleep_msg_tv"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_alignParentRight="true"
-                    android:layout_alignBaseline="@+id/btn_presets_list"
-                    android:layout_gravity="center_vertical"
-                    android:textSize="14dip"
-                    android:textStyle="bold"
-                    android:text="@string/default_sleep"
-                    />
-            </RelativeLayout>
-         </LinearLayout>
-
-        <LinearLayout android:id="@+id/presets_upper_layout"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layout_gravity="center"
-            android:layout_marginBottom="5dip"
-            android:gravity="center_horizontal">
-
-            <Button android:id="@+id/presets_button_1"
-                android:text="@string/default_station"
-                android:layout_width="80dip"
-                android:layout_height="50dip" />
-
-            <Button android:id="@+id/presets_button_2"
-                android:text="@string/default_station"
-                android:layout_width="80dp"
-                android:layout_height="50dp" />
-
-            <Button android:id="@+id/presets_button_3"
-                android:text="@string/default_station"
-                android:layout_width="80dip"
-                android:layout_height="50dip"
-                android:visibility="visible" />
-
-            <Button android:id="@+id/presets_button_4"
-                android:text="@string/default_blank"
-                android:layout_width="80dip"
-                android:layout_height="50dip"  />
-
-            <Button android:id="@+id/presets_button_5"
-                android:text="@string/default_blank"
-                android:layout_width="80dip"
-                android:layout_height="50dip"  />
-
-            <ImageButton android:id="@+id/btn_preset_page"
-                android:src="@drawable/ic_btn_forward"
-                android:layout_marginRight="2dp"
-                android:layout_width="80dip"
-                android:layout_height="50dip"
-                android:visibility="visible" />
-        </LinearLayout>
-</merge>
diff --git a/fmapp/res/layout-small-land-finger/station_info.xml b/fmapp/res/layout-small-land-finger/station_info.xml
deleted file mode 100644
index 48ce642..0000000
--- a/fmapp/res/layout-small-land-finger/station_info.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <LinearLayout android:id="@+id/stationinfo_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="5dip"
-        android:layout_marginLeft="5dip"
-        android:layout_marginRight="5dip"
-        android:orientation="vertical"
-        android:gravity="fill_vertical">
-
-        <RelativeLayout android:id="@+id/top_most"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="5dip"
-            android:layout_marginRight="5dip">
-
-           <ImageView android:id="@+id/signal_level"
-               android:src="@drawable/ic_signal_2"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_alignParentTop="true"
-               android:layout_alignParentLeft="true"/>
-
-           <TextView android:id="@+id/prog_service_tv"
-               android:textAppearance="?android:attr/textAppearanceMedium"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_alignParentTop="true"
-               android:layout_centerHorizontal="true"
-               android:layout_alignBaseline="@id/signal_level"
-               android:textSize="20dip"
-               android:singleLine="true"
-               android:textStyle="bold"
-               android:text="@string/prog_service_string"/>
-
-           <TextView android:id="@+id/stereo_text_tv"
-               android:textAppearance="?android:attr/textAppearanceSmall"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_alignParentTop="true"
-               android:layout_alignParentRight="true"
-               android:layout_alignBaseline="@id/signal_level"
-               android:textSize="14dip"
-               android:text="@string/default_audio"/>
-
-       </RelativeLayout>
-
-    <LinearLayout android:id="@+id/station_frequency_row"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:paddingTop="25dip"
-        android:paddingBottom="25dip"
-        android:gravity="fill_vertical|center">
-
-        <TextView android:id="@+id/prog_frequency_tv"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentLeft="true"
-            android:textSize="56dip"
-            android:text="@string/frequency_string" />
-
-        <RelativeLayout android:id="@+id/second_row"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:orientation="vertical"
-            android:layout_toRightOf="@id/prog_frequency_tv">
-
-            <TextView android:id="@+id/call_sign_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentTop="true"
-                android:textSize="14dip"
-                android:paddingRight="5dip"
-                android:paddingBottom="2dip"
-                android:paddingLeft="5dip"
-                android:text="@string/station_id_string" />
-
-            <TextView android:id="@+id/pty_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentBottom="true"
-                android:textSize="16dip"
-                android:paddingTop="5dip"
-                android:paddingRight="5dip"
-                android:paddingLeft="5dip"
-                android:text="@string/pty_string" />
-        </RelativeLayout>
-      </LinearLayout>
-
-      <!-- Station Radio Text information display -->
-      <TextView android:id="@+id/radio_text_tv"
-          android:layout_width="fill_parent"
-          android:layout_height="wrap_content"
-          android:textAppearance="?android:attr/textAppearanceMedium"
-          android:textSize="16dip"
-          android:singleLine="true"
-          android:textStyle="bold"
-          android:paddingBottom="2dip"
-          android:paddingLeft="5dip"
-          android:paddingRight="5dip"
-          android:gravity="center_horizontal"
-          android:text="@string/radio_text_string"/>
-
-      <TextView android:id="@+id/eradio_text_tv"
-          android:layout_width="fill_parent"
-          android:layout_height="wrap_content"
-          android:textAppearance="?android:attr/textAppearanceMedium"
-          android:textSize="20dip"
-          android:singleLine="true"
-          android:textStyle="bold"
-          android:paddingLeft="2dip"
-          android:paddingRight="2dip"
-          android:paddingBottom="5dip"
-          android:gravity="center_horizontal"
-          android:layout_below="@id/radio_text_tv"
-          android:text="@string/eradio_text_string"/>
-
-    </LinearLayout>
-</merge>
diff --git a/fmapp/res/layout-small/alert_dialog_list.xml b/fmapp/res/layout-small/alert_dialog_list.xml
deleted file mode 100644
index 5d20985..0000000
--- a/fmapp/res/layout-small/alert_dialog_list.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical">
-
-    <ListView android:id="@+id/list"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content">
-  </ListView>
-
-</LinearLayout>
diff --git a/fmapp/res/layout-small/alert_dialog_text_entry.xml b/fmapp/res/layout-small/alert_dialog_text_entry.xml
deleted file mode 100644
index 828e914..0000000
--- a/fmapp/res/layout-small/alert_dialog_text_entry.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical">
-
-    <EditText
-        android:id="@+id/list_edit"
-        android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
-        android:layout_marginLeft="20dp"
-        android:layout_marginRight="20dp"
-        android:scrollHorizontally="true"
-        android:hint="Enter a name"
-        android:singleLine="true"
-        android:inputType="text"
-        android:autoText="false"
-        android:capitalize="none"
-        android:gravity="fill_horizontal"
-        android:textAppearance="?android:attr/textAppearanceMedium" android:saveEnabled="false"/>
-
-
-</LinearLayout>
diff --git a/fmapp/res/layout-small/fmradio.xml b/fmapp/res/layout-small/fmradio.xml
deleted file mode 100644
index e929965..0000000
--- a/fmapp/res/layout-small/fmradio.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/fmradio"
-    android:background="@drawable/application_border"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="vertical">
-
-    <!-- This LinearLayout contains Station Information display and the function buttons -->
-    <LinearLayout android:id="@+id/stationinfo_layout"
-        android:background="@drawable/station_border"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:layout_marginTop="5dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true">
-
-        <!-- This included layout contains Station Information to display -->
-        <include layout="@layout/station_info" />
-
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/preset_full_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:layout_alignParentLeft="true"
-        android:layout_below="@+id/stationinfo_layout"
-        android:layout_weight="1"
-        android:gravity="center">
-
-        <!-- Layout contains the Next/Previous Presets and Tune buttons and status msg text-->
-        <include layout="@layout/navigate" />
-
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/layout_on_off"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:layout_gravity="center"
-        android:layout_marginTop="2dp"
-        android:layout_marginBottom="2dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentBottom="true"
-        android:layout_weight="0"
-        android:gravity="center_horizontal">
-
-        <ImageButton android:id="@+id/btn_silent"
-            android:src="@drawable/ic_silent_mode_off"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="20dp"
-            android:layout_width="100dp"
-            android:layout_height="50dp"/>
-
-        <ImageButton android:id="@+id/btn_onoff"
-            android:src="@drawable/ic_btn_onoff"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="10dp"
-            android:layout_width="100dp"
-            android:layout_height="50dp"/>
-
-    </LinearLayout>
-
-    <View
-        android:layout_width="fill_parent"
-        android:layout_height="1dp"
-        android:background="#ffffffff"
-        android:layout_above="@+id/layout_on_off"/>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-small/fmstats.xml b/fmapp/res/layout-small/fmstats.xml
deleted file mode 100644
index 1cf8023..0000000
--- a/fmapp/res/layout-small/fmstats.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:scrollbars="vertical"
-    android:layout_height="fill_parent"
-    android:layout_width="fill_parent">
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:orientation="vertical">
-
-       <Spinner
-           android:id="@+id/spinner"
-           android:layout_width="fill_parent"
-           android:layout_height="75dp"
-           android:prompt="@string/test_prompt"
-           android:textSize="25sp"/>
-
-       <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-           android:layout_width="fill_parent"
-           android:layout_height="100dp">
-
-           <Button
-               android:id= "@+id/Runbutton"
-               android:text="@string/band_sweep_setting"
-               android:layout_width="wrap_content"
-               android:layout_height="100dp"
-               android:textSize="25dp"
-               android:visibility="gone"/>
-
-           <TextView
-               android:id= "@+id/BandSweepSetting"
-               android:text="@string/band_sweep_setting"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_toRightOf="@id/Runbutton"
-               android:textSize="25sp"
-               android:visibility="gone"/>
-
-           <ProgressBar android:id="@+id/progressbar"
-               android:layout_width="100dp"
-               android:layout_height="100dp"
-               android:layout_toRightOf="@id/Runbutton"
-               android:visibility="gone"/>
-
-           <TextView
-               android:id="@+id/label"
-               android:layout_width="fill_parent"
-               android:layout_height="wrap_content"
-               android:textSize="15sp"
-               android:text="@string/enter_rssi"
-               android:visibility="gone"/>
-
-           <EditText
-               android:id="@+id/txtbox1"
-               android:layout_width="100dp"
-               android:layout_height="50dp"
-               android:text="@string/type_rd"
-               android:textSize="15sp"
-               android:layout_alignParentRight="true"
-               android:visibility="gone"/>
-
-           <Button
-               android:id= "@+id/Setbutton"
-               android:text="@string/set_rmmsi_delta"
-               android:layout_width="wrap_content"
-               android:layout_height="100dp"
-               android:layout_below="@id/txtbox1"
-               android:textSize="15sp"
-               android:visibility="gone"/>
-
-           <Button
-               android:id="@+id/SearchMpxDcc"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:text="@string/search_algo_mpx"
-               android:visibility="gone"/>
-
-           <Button
-               android:id="@+id/SearchSinrInt"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:text="@string/search_algo_sinrint"
-               android:layout_below="@id/SearchMpxDcc"
-               android:visibility="gone"/>
-
-       </RelativeLayout>
-
-       <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-           android:id="@+id/maintable"
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent"
-           android:scrollbars="vertical">
-
-           <TableRow
-               android:id="@+id/mainrow">
-           </TableRow>
-
-       </TableLayout>
-
-    </LinearLayout>
-
-</ScrollView>
diff --git a/fmapp/res/layout-small/fmtags.xml b/fmapp/res/layout-small/fmtags.xml
deleted file mode 100644
index 352320f..0000000
--- a/fmapp/res/layout-small/fmtags.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="fill_parent"
-    android:layout_width="fill_parent">
-
-    <ListView
-        android:id="@+id/TagListView"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:textSize="30sp"/>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-small/fmtransmitter.xml b/fmapp/res/layout-small/fmtransmitter.xml
deleted file mode 100644
index f9e7b08..0000000
--- a/fmapp/res/layout-small/fmtransmitter.xml
+++ /dev/null
@@ -1,235 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/fmtransmitter"
-    android:background="@drawable/application_border"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
-
-    <!-- This RelativeLayout contains Station Information display and the function buttons -->
-    <RelativeLayout android:id="@+id/stationinfo_layout"
-        android:background="@drawable/station_border"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:layout_marginTop="5dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true">
-
-        <RelativeLayout android:id="@+id/transmit_msg_layout"
-             android:layout_width="fill_parent"
-             android:layout_height="wrap_content"
-             android:layout_alignParentTop="true" >
-
-             <TextView android:id="@+id/transmit_msg_tv"
-                 android:textAppearance="?android:attr/textAppearanceMedium"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:textSize="15dp"
-                 android:layout_centerInParent="true"
-                 android:text="@string/transmit_msg_string"/>
-
-        </RelativeLayout>
-
-        <RelativeLayout android:id="@+id/frequency_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="20dp"
-            android:layout_below="@id/transmit_msg_layout"
-            android:layout_marginBottom="20dp">
-
-            <ImageView android:id="@+id/btn_back"
-                android:clickable="true"
-                android:focusable="true"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="2dp"
-                android:layout_alignParentLeft="true"
-                android:visibility="visible"
-                android:src="@drawable/btn_arrow_left"/>
-
-            <TextView android:id="@+id/prog_frequency_tv"
-                android:textAppearance="?android:attr/textAppearanceLarge"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textSize="60dp"
-                android:layout_centerVertical="true"
-                android:layout_toRightOf="@id/btn_back"
-                android:text="@string/frequency_string"/>
-
-            <ImageView android:id="@+id/btn_forward"
-                android:clickable="true"
-                android:focusable="true"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingRight="2dp"
-                android:layout_toRightOf="@id/prog_frequency_tv"
-                android:layout_alignParentRight="true"
-                android:visibility="visible"
-                android:src="@drawable/btn_arrow_right"/>
-
-        </RelativeLayout>
-
-        <!-- Station Radio Text information display -->
-        <RelativeLayout android:id="@+id/radio_text_layout"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/frequency_layout">
-
-            <TextView android:id="@+id/radio_text_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20dp"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:layout_centerInParent="true"
-                android:text="@string/radio_text_string"/>
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/presets_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:layout_alignParentLeft="true"
-        android:layout_below="@+id/stationinfo_layout"
-        android:layout_weight="1"
-        android:layout_marginTop = "15dp"
-        android:layout_marginBottom="15dp"
-        android:gravity="center">
-
-       <!--  Upper Presets -->
-        <RelativeLayout android:id="@+id/presets_upper_layout"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_centerVertical="true">
-
-            <Button android:id="@+id/presets_button_1"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_width="90dp"
-                android:layout_height="55dp"/>
-
-            <Button android:id="@+id/presets_button_2"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_toRightOf="@id/presets_button_1"
-                android:layout_alignTop="@id/presets_button_1"
-                android:layout_alignBottom="@id/presets_button_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"/>
-
-            <Button android:id="@+id/presets_button_3"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_toRightOf="@id/presets_button_2"
-                android:layout_alignTop="@id/presets_button_2"
-                android:layout_alignBottom="@id/presets_button_2"
-                android:layout_width="90dp"
-                android:layout_height="55dp"/>
-
-        </RelativeLayout>
-
-        <!--  Lower Presets -->
-        <RelativeLayout android:id="@+id/presets_lower_layout"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/presets_upper_layout"
-            android:layout_centerVertical="true">
-
-            <Button android:id="@+id/presets_button_4"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_width="90dp"
-                android:layout_height="55dp"/>
-
-            <Button android:id="@+id/presets_button_5"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_toRightOf="@id/presets_button_4"
-                android:layout_alignTop="@id/presets_button_4"
-                android:layout_alignBottom="@id/presets_button_4"
-                android:layout_width="90dp"
-                android:layout_height="55dp"/>
-
-            <Button android:id="@+id/presets_button_6"
-                android:text="@string/default_blank"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="24dp"
-                android:singleLine="true"
-                android:layout_toRightOf="@id/presets_button_5"
-                android:layout_alignTop="@id/presets_button_5"
-                android:layout_alignBottom="@id/presets_button_5"
-                android:layout_width="90dp"
-                android:layout_height="55dp"/>
-
-        </RelativeLayout>
-
-    </RelativeLayout>
-
-    <RelativeLayout android:id="@+id/layout_on_off"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/presets_layout"
-        android:layout_marginTop="20dp"
-        android:layout_marginBottom="20dp"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentBottom="true"
-        android:layout_weight="0">
-
-        <View android:id="@+id/on_off_separator"
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:background="#ffffffff"/>
-
-        <ImageButton android:id="@+id/btn_onoff"
-            android:src="@drawable/ic_btn_onoff"
-            android:layout_marginLeft="25dp"
-            android:layout_marginRight="25dp"
-            android:layout_below="@id/on_off_separator"
-            android:layout_centerVertical="true"
-            android:layout_width="110dp"
-            android:layout_height="65dp"/>
-
-    </RelativeLayout>
-
-</RelativeLayout>
diff --git a/fmapp/res/layout-small/frequency_picker.xml b/fmapp/res/layout-small/frequency_picker.xml
deleted file mode 100644
index 2d89a62..0000000
--- a/fmapp/res/layout-small/frequency_picker.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:layout_gravity="center_horizontal"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
-    <!-- MHz -->
-    <android.widget.NumberPicker
-        android:id="@+id/mhz"
-        android:layout_width="80dp"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="1dp"
-        android:layout_marginRight="1dp"
-        android:focusable="true"
-        android:focusableInTouchMode="true" />
-
-    <!-- KHz -->
-    <android.widget.NumberPicker
-        android:id="@+id/khz"
-        android:layout_width="80dp"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="1dp"
-        android:layout_marginRight="1dp"
-        android:focusable="true"
-        android:focusableInTouchMode="true"
-        />
-</LinearLayout>
diff --git a/fmapp/res/layout-small/frequency_picker_dialog.xml b/fmapp/res/layout-small/frequency_picker_dialog.xml
deleted file mode 100644
index 89a6e4f..0000000
--- a/fmapp/res/layout-small/frequency_picker_dialog.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<com.codeaurora.utils.FrequencyPicker xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/frequencyPicker"
-    android:padding="5dp"
-    android:layout_gravity="center_horizontal"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"/>
diff --git a/fmapp/res/layout-small/navigate.xml b/fmapp/res/layout-small/navigate.xml
deleted file mode 100644
index 8d7a603..0000000
--- a/fmapp/res/layout-small/navigate.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <RelativeLayout android:id="@+id/message_row"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="5dp"
-        android:orientation="horizontal">
-
-        <TextView android:id="@+id/record_msg_tv"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentLeft="true"
-            android:textSize="14dp"
-            android:textStyle="bold"
-            android:text="@string/default_record"/>
-
-        <Button android:id="@+id/btn_presets_list"
-            android:text="@string/default_preset_list_name"
-            android:textStyle="bold"
-            android:singleLine="true"
-            android:layout_centerHorizontal="true"
-            android:layout_alignParentTop="true"
-            android:layout_gravity="center"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="10dp"
-            android:layout_width="140dp"
-            android:layout_height="45dp" />
-
-        <TextView android:id="@+id/sleep_msg_tv"
-           android:textAppearance="?android:attr/textAppearanceMedium"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentTop="true"
-           android:layout_alignParentRight="true"
-           android:layout_alignBaseline="@+id/btn_presets_list"
-           android:textSize="14dp"
-           android:textStyle="bold"
-           android:text="@string/default_sleep" />
-
-  </RelativeLayout>
-
-  <LinearLayout android:id="@+id/presets_layout"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_centerHorizontal="true"
-      android:orientation="vertical">
-
-      <!--  Upper Presets -->
-     <LinearLayout android:id="@+id/presets_upper_layout"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:orientation="horizontal"
-         android:layout_gravity="center"
-         android:layout_marginBottom="5dp"
-         android:gravity="center_horizontal">
-
-         <Button android:id="@+id/presets_button_1"
-             android:text="@string/default_station"
-             android:layout_marginLeft="10dip"
-             android:layout_width="90dp"
-             android:layout_height="55dp" />
-
-         <Button android:id="@+id/presets_button_2"
-             android:text="@string/default_station"
-             android:layout_marginLeft="10dp"
-             android:layout_marginRight="10dp"
-             android:layout_width="90dp"
-             android:layout_height="55dp" />
-
-         <Button android:id="@+id/presets_button_3"
-             android:text="@string/default_station"
-             android:layout_marginRight="10dp"
-             android:layout_width="90dp"
-             android:layout_height="55dp"
-             android:visibility="visible" />
-
-     </LinearLayout>
-
-     <!--  Lower Presets -->
-     <LinearLayout android:id="@+id/presets_lower_layout"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:orientation="horizontal"
-         android:layout_gravity="center"
-         android:layout_marginBottom="5dp"
-         android:gravity="center_horizontal">
-
-         <Button android:id="@+id/presets_button_4"
-             android:text="@string/default_blank"
-             android:layout_marginLeft="10dp"
-             android:layout_width="90dp"
-             android:layout_height="55dp" />
-
-         <Button android:id="@+id/presets_button_5"
-             android:text="@string/default_blank"
-             android:layout_marginLeft="10dp"
-             android:layout_marginRight="10dp"
-             android:layout_width="90dp"
-             android:layout_height="55dp" />
-
-         <ImageButton android:id="@+id/btn_preset_page"
-             android:src="@drawable/preset_page_button"
-             android:layout_marginRight="10dp"
-             android:layout_width="90dp"
-             android:layout_height="55dp"
-             android:visibility="visible" />
-
-     </LinearLayout>
-
-  </LinearLayout>
-
-  <LinearLayout android:id="@+id/scanning_stoplayout"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:visibility="gone"
-      android:gravity="center">
-
-      <Button android:id="@+id/btn_scanning_stop"
-          android:clickable="true"
-          android:text="@string/stop_scanning"
-          android:singleLine="true"
-          android:padding="20dp"
-          android:layout_width="fill_parent"
-          android:layout_height="wrap_content" />
-
-  </LinearLayout>
-
-</merge>
diff --git a/fmapp/res/layout-small/station_info.xml b/fmapp/res/layout-small/station_info.xml
deleted file mode 100644
index 0f3fce4..0000000
--- a/fmapp/res/layout-small/station_info.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <LinearLayout android:id="@+id/station_info"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:orientation="vertical"
-        android:gravity="top">
-
-        <RelativeLayout android:id="@+id/top_most"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content">
-
-            <ImageView android:id="@+id/signal_level"
-                android:src="@drawable/ic_signal_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentLeft="true"/>
-
-            <TextView android:id="@+id/prog_service_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:layout_centerHorizontal="true"
-                android:layout_alignBaseline="@id/signal_level"
-                android:textSize="20dp"
-                android:singleLine="true"
-                android:textStyle="bold"
-                android:text="@string/prog_service_string"/>
-
-            <TextView android:id="@+id/stereo_text_tv"
-                android:textAppearance="?android:attr/textAppearanceSmall"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingRight="5dp"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentRight="true"
-                android:layout_alignBaseline="@id/signal_level"
-                android:textSize="14dp"
-                android:text="@string/default_audio"/>
-
-        </RelativeLayout>
-
-        <LinearLayout android:id="@+id/station_frequency_row"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:paddingTop="5dp"
-            android:paddingBottom="5dp"
-            android:layout_alignWithParentIfMissing="true"
-            android:gravity="center">
-
-            <TextView android:id="@+id/call_sign_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textSize="14dp"
-                android:paddingTop="2dp"
-                android:paddingRight="2dp"
-                android:paddingBottom="2dp"
-                android:paddingLeft="2dp"
-                android:text="@string/station_id_string" />
-
-            <RelativeLayout android:id="@+id/second_layout"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="2dp"
-                android:layout_marginBottom="2dp"
-                android:layout_marginLeft="2dp"
-                android:layout_marginRight="2dp">
-
-                <TextView android:id="@+id/prog_frequency_tv"
-                     android:textAppearance="?android:attr/textAppearanceLarge"
-                     android:layout_width="wrap_content"
-                     android:layout_height="wrap_content"
-                     android:textSize="64dp"
-                     android:layout_centerHorizontal="true"
-                     android:text="@string/frequency_string"/>
-
-                <ImageView android:id="@+id/btn_back"
-                     android:clickable="true"
-                     android:focusable="true"
-                     android:layout_width="wrap_content"
-                     android:layout_height="100dp"
-                     android:paddingLeft="2dp"
-                     android:layout_alignParentLeft="true"
-                     android:visibility="visible"
-                     android:layout_alignWithParentIfMissing="true"
-                     android:src="@drawable/btn_arrow_left"/>
-
-                <ImageView android:id="@+id/btn_forward"
-                     android:clickable="true"
-                     android:focusable="true"
-                     android:layout_width="wrap_content"
-                     android:layout_height="100dp"
-                     android:paddingRight="2dp"
-                     android:layout_alignParentRight="true"
-                     android:visibility="visible"
-                     android:layout_alignWithParentIfMissing="true"
-                     android:src="@drawable/btn_arrow_right"/>
-
-            </RelativeLayout>
-
-            <TextView android:id="@+id/pty_tv"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textSize="14dp"
-                android:paddingTop="2dp"
-                android:paddingRight="2dp"
-                android:paddingBottom="2dp"
-                android:paddingLeft="2dp"
-                android:text="@string/pty_string" />
-
-        </LinearLayout>
-
-        <!-- Station Radio Text information display -->
-        <TextView android:id="@+id/radio_text_tv"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textSize="20dp"
-            android:singleLine="true"
-            android:textStyle="bold"
-            android:paddingLeft="2dp"
-            android:paddingRight="2dp"
-            android:paddingBottom="5dp"
-            android:gravity="center_horizontal"
-            android:text="@string/radio_text_string"/>
-
-        <TextView android:id="@+id/eradio_text_tv"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textSize="20dp"
-            android:singleLine="true"
-            android:textStyle="bold"
-            android:paddingLeft="2dp"
-            android:paddingRight="2dp"
-            android:paddingBottom="5dp"
-            android:gravity="center_horizontal"
-            android:text="@string/eradio_text_string"/>
-    </LinearLayout>
-
-</merge>
diff --git a/fmapp/res/layout-small/statusbar.xml b/fmapp/res/layout-small/statusbar.xml
deleted file mode 100644
index b8a8189..0000000
--- a/fmapp/res/layout-small/statusbar.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="horizontal">
-
-    <ImageView android:id="@+id/icon"
-        android:padding="4dp"
-        android:gravity="center"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-    </ImageView>
-
-    <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
-
-        <TextView android:id="@+id/frequency"
-            android:textAppearance="?android:attr/textAppearanceMediumInverse"
-            android:focusable="true"
-            android:ellipsize="marquee"
-            android:singleLine="true"
-            android:layout_gravity="left"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" />
-    </LinearLayout>
-</LinearLayout>
diff --git a/fmapp/res/layout/band_sweep_setting.xml b/fmapp/res/layout/band_sweep_setting.xml
deleted file mode 100644
index 777332c..0000000
--- a/fmapp/res/layout/band_sweep_setting.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     * Copyright (c) 2013 The Linux Foundation. All rights reserved.
-     *
-     * Redistribution and use in source and binary forms, with or without
-     * modification, are permitted provided that the following conditions are met:
-     *    * Redistributions of source code must retain the above copyright
-     *      notice, this list of conditions and the following disclaimer.
-     *    * Redistributions in binary form must reproduce the above copyright
-     *      notice, this list of conditions and the following disclaimer in the
-     *      documentation and/or other materials provided with the distribution.
-     *    * Neither the name of The Linux Foundation nor
-     *      the names of its contributors may be used to endorse or promote
-     *      products derived from this software without specific prior written
-     *      permission.
-     *
-     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-     * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-     * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-     * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:scrollbars="vertical"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_gravity="center_horizontal"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-
-        <TextView
-            android:id="@+id/lbl_band_sweep_spinner"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textSize="15sp"
-            android:text="@string/band_sweep_choose"/>
-
-        <Spinner
-            android:id="@+id/band_sweep_spinner"
-            android:layout_width="fill_parent"
-            android:layout_height="75dp"
-            android:layout_below="@id/lbl_band_sweep_spinner"
-            android:prompt="@string/band_method_prompt"
-            android:textSize="25sp"/>
-
-        <TextView
-            android:id="@+id/LabelStartdelay"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textSize="15sp"
-            android:layout_below="@id/band_sweep_spinner"
-            android:text="@string/enter_start_delay_time"/>
-
-        <EditText
-            android:id="@+id/txtboxDelayTime"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textSize="15sp"
-            android:inputType="number"
-            android:layout_toRightOf="@id/LabelStartdelay"/>
-
-        <TextView
-            android:id="@+id/LabelDwellTime"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textSize="15sp"
-            android:layout_below="@id/LabelStartdelay"
-            android:text="@string/enter_dwell_time"/>
-
-        <EditText
-            android:id="@+id/txtboxDwellTime"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:textSize="15sp"
-            android:inputType="number"
-            android:layout_toRightOf="@id/LabelDwellTime"/>
-
-    </LinearLayout>
-
-</ScrollView>
diff --git a/fmapp/res/menu/menu_rf_stats.xml b/fmapp/res/menu/menu_rf_stats.xml
deleted file mode 100644
index 505e49b..0000000
--- a/fmapp/res/menu/menu_rf_stats.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     * Copyright (c) 2013 The Linux Foundation. All rights reserved.
-     *
-     * Redistribution and use in source and binary forms, with or without
-     * modification, are permitted provided that the following conditions are met:
-     *    * Redistributions of source code must retain the above copyright
-     *      notice, this list of conditions and the following disclaimer.
-     *    * Redistributions in binary form must reproduce the above copyright
-     *      notice, this list of conditions and the following disclaimer in the
-     *      documentation and/or other materials provided with the distribution.
-     *    * Neither the name of The Linux Foundation nor
-     *      the names of its contributors may be used to endorse or promote
-     *      products derived from this software without specific prior written
-     *      permission.
-     *
-     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-     * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-     * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-     * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:id="@+id/menu_recording"
-        android:icon="@drawable/ic_menu_record"
-        android:showAsAction="ifRoom|withText" />
-
-    <item android:id="@+id/menu_record_duration"
-        android:showAsAction="ifRoom|withText"
-        android:title=""/>
-
-</menu>
-
diff --git a/fmapp/res/values/arrays.xml b/fmapp/res/values/arrays.xml
deleted file mode 100644
index 3778be1..0000000
--- a/fmapp/res/values/arrays.xml
+++ /dev/null
@@ -1,391 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2011-2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<resources>
-
-  <string-array name="ster_mon_entries">
-    <item>Stereo</item>
-    <item>Mono</item>
-  </string-array>
-
-  <string-array name="ster_mon_values">
-    <item>0</item>
-    <item>1</item>
-  </string-array>
-
-  <string-array name="record_durations_entries">
-    <item>5 minutes</item>
-    <item>15 minutes</item>
-    <item>30 minutes</item>
-    <item>Until stopped</item>
-  </string-array>
-
-
-  <string-array name="record_duration_values">
-    <item>5</item>
-    <item>15</item>
-    <item>30</item>
-    <item>-1</item>
-  </string-array>
-
-  <string-array name="sleep_duration_values">
-    <item>15 minutes</item>
-    <item>30 minutes</item>
-    <item>45 minutes</item>
-    <item>1 Hour</item>
-  </string-array>
-
-    <!-- This array should be in seconds and should match the values above -->
-  <string-array name="sleep_duration_values_seconds">
-    <item>900</item>
-    <item>1800</item>
-    <item>2700</item>
-    <item>3600</item>
-  </string-array>
-
-  <string-array name="search_category_rbds_entries">
-    <item>All Stations</item>
-    <item>Adult Hits</item>
-    <item>Classical</item>
-    <item>Classic Rock</item>
-    <item>College</item>
-    <item>Country</item>
-    <item>Emergency</item>
-    <item>Emergency Test</item>
-    <item>Foreign Language</item>
-    <item>Information</item>
-    <item>Jazz</item>
-    <item>News</item>
-    <item>Nostalgia</item>
-    <item>Oldies</item>
-    <item>Personality</item>
-    <item>Public</item>
-    <item>Religious Music</item>
-    <item>Religious Talk</item>
-    <item>Rhythm and Blues</item>
-    <item>Rock</item>
-    <item>Soft</item>
-    <item>Soft Rock</item>
-    <item>Soft Rhythm and Blues</item>
-    <item>Sports</item>
-    <item>Talk</item>
-    <item>Top 40</item>
-    <item>Weather</item>
-  </string-array>
-
-  <string-array name="search_category_rbds_values">
-    <item>0</item>
-    <item>7</item>
-    <item>15</item>
-    <item>6</item>
-    <item>23</item>
-    <item>10</item>
-    <item>31</item>
-    <item>30</item>
-    <item>18</item>
-    <item>2</item>
-    <item>14</item>
-    <item>1</item>
-    <item>13</item>
-    <item>11</item>
-    <item>21</item>
-    <item>22</item>
-    <item>19</item>
-    <item>20</item>
-    <item>16</item>
-    <item>5</item>
-    <item>12</item>
-    <item>8</item>
-    <item>17</item>
-    <item>3</item>
-    <item>4</item>
-    <item>9</item>
-    <item>29</item>
-  </string-array>
-
-
-  <string-array name="search_category_rds_entries">
-    <item>All Stations</item>
-    <item>Culture</item>
-    <item>Current Affairs</item>
-    <item>Children programs</item>
-    <item>Country Music</item>
-    <item>Documentary</item>
-    <item>Drama</item>
-    <item>Easy Listening Music</item>
-    <item>Education</item>
-    <item>Emergency</item>
-    <item>Emergency Test</item>
-    <item>Finance</item>
-    <item>Folk Music</item>
-    <item>Information</item>
-    <item>Jazz Music</item>
-    <item>Light classical</item>
-    <item>Leisure</item>
-    <item>News</item>
-    <item>National Music</item>
-    <item>Other Music</item>
-    <item>Oldies Music</item>
-    <item>Phone In</item>
-    <item>Pop Music</item>
-    <item>Religion</item>
-    <item>Rock Music</item>
-    <item>Science</item>
-    <item>Serious classical</item>
-    <item>Social Affairs</item>
-    <item>Sport</item>
-    <item>Travel</item>
-    <item>Varied</item>
-    <item>Weather</item>
-  </string-array>
-
-  <string-array name="search_category_rds_values">
-    <item>0</item>
-    <item>7</item>
-    <item>2</item>
-    <item>18</item>
-    <item>25</item>
-    <item>29</item>
-    <item>6</item>
-    <item>12</item>
-    <item>5</item>
-    <item>31</item>
-    <item>30</item>
-    <item>17</item>
-    <item>28</item>
-    <item>3</item>
-    <item>24</item>
-    <item>13</item>
-    <item>23</item>
-    <item>1</item>
-    <item>26</item>
-    <item>15</item>
-    <item>27</item>
-    <item>21</item>
-    <item>10</item>
-    <item>20</item>
-    <item>11</item>
-    <item>8</item>
-    <item>14</item>
-    <item>19</item>
-    <item>4</item>
-    <item>22</item>
-    <item>9</item>
-    <item>16</item>
-  </string-array>
-
-  <string-array name="presetlist_edit_category">
-    <item>Rename</item>
-    <item>Auto-Select</item>
-    <item>Delete</item>
-  </string-array>
-
-
-  <string-array name="regional_band_entries">
-    <item>North America</item>
-    <item>Europe</item>
-    <item>Japan</item>
-    <item>Japan (Wide)</item>
-    <item>Australia</item>
-    <item>Austria</item>
-    <item>Belgium</item>
-    <item>Brazil</item>
-    <item>China</item>
-    <item>Czech</item>
-    <item>Denmark</item>
-    <item>Finland</item>
-    <item>France</item>
-    <item>Germany</item>
-    <item>Greece</item>
-    <item>Hong Kong</item>
-    <item>India</item>
-    <item>Ireland</item>
-    <item>Italy</item>
-    <item>Korea</item>
-    <item>Mexico</item>
-    <item>Netherlands</item>
-    <item>New Zealand</item>
-    <item>Norway</item>
-    <item>Poland</item>
-    <item>Portugal</item>
-    <item>Russia</item>
-    <item>Singapore</item>
-    <item>Slovakia</item>
-    <item>Spain</item>
-    <item>Switzerland</item>
-    <item>Sweden</item>
-    <item>Taiwan</item>
-    <item>Turkey</item>
-    <item>United Kingdom </item>
-    <item>United States</item>
-    <item>User Defined Band</item>
-  </string-array>
-
-  <string-array name="regional_band_values">
-    <item>0</item>
-    <item>1</item>
-    <item>2</item>
-    <item>3</item>
-    <item>4</item>
-    <item>5</item>
-    <item>6</item>
-    <item>7</item>
-    <item>8</item>
-    <item>9</item>
-    <item>10</item>
-    <item>11</item>
-    <item>12</item>
-    <item>13</item>
-    <item>14</item>
-    <item>15</item>
-    <item>16</item>
-    <item>17</item>
-    <item>18</item>
-    <item>19</item>
-    <item>20</item>
-    <item>21</item>
-    <item>22</item>
-    <item>23</item>
-    <item>24</item>
-    <item>25</item>
-    <item>26</item>
-    <item>27</item>
-    <item>28</item>
-    <item>29</item>
-    <item>30</item>
-    <item>31</item>
-    <item>32</item>
-    <item>33</item>
-    <item>34</item>
-    <item>35</item>
-    <item>36</item>
-  </string-array>
-
-  <string-array name="regional_band_summary">
-    <item>North America (87.5MHz To 108.0MHz In 200 Khz Steps)</item>
-    <item>Europe (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Japan (76.0MHz To  90.0MHz In 100 Khz Steps)</item>
-    <item>Japan (Wide) (90.0MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Australia (87.7MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Austria (87.5MHz To 108.0MHz In  50 Khz Steps)</item>
-    <item>Belgium (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Brazil (87.5MHz To 108.0MHz In 200 Khz Step)</item>
-    <item>China (87.0MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Czech (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Denmark (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Finland (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>France (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Germany (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Greece (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Hong Kong (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>India (91.0MHz To 106.4MHz In 100 Khz Steps)</item>
-    <item>Ireland (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Italy (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Korea (87.5MHz To 108.0MHz In 200 Khz Steps)</item>
-    <item>Mexico (88.1MHz To 107.9MHz In 200 Khz Steps)</item>
-    <item>Netherlands (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>New Zealand (88.0MHz To 107.0MHz In 100 Khz Steps)</item>
-    <item>Norway (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Poland (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Portugal (87.5MHz To 108.0MHz In 50 Khz Steps)</item>
-    <item>Russia (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Singapore (88.0MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Slovakia (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Spain (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Switzerland (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Sweden (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Taiwan (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>Turkey (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>United Kingdom (87.5MHz To 108.0MHz In 100 Khz Steps)</item>
-    <item>United States (88.1MHz To 107.9MHz In 200 Khz Steps)</item>
-    <item>User Defined Band</item>
-  </string-array>
-
-  <string-array name="rf_cfg">
-      <item> Get Current Station Parameters</item>
-      <item> Get Station Parameters Repeat 20 times</item>
-      <item> Get Search  station parameters</item>
-      <item> Get FM Band sweep parameters</item>
-      <item> Configure Performance Parameters</item>
-  </string-array>
-
-  <string-array name="cfg_rf1">
-      <item> Set FM RSSI Delta</item>
-      <item> Set Signal Threshold</item>
-      <item> RF Statistics</item>
-  </string-array>
-
-  <string-array name="cfg_rf2">
-      <item> Set SINR Samples Count</item>
-      <item> Set SINR Threshold</item>
-      <item> Set IntfDetoutLow Threshold</item>
-      <item> Set IntfDetoutHigh Threshold</item>
-      <item> Set SinrFirstStage</item>
-      <item> Set RmssiFirstStage</item>
-      <item> Set CF0Th12</item>
-      <item> Set SearchAlgo Type</item>
-      <item> Get SINR Samples Count</item>
-      <item> Get SINR Threshold</item>
-      <item> Get SinrFirstStage</item>
-      <item> Get RmssiFirstStage</item>
-      <item> Get CF0Th12</item>
-      <item> Get Search Algo Type</item>
-      <item> Set AfJmpRmssi Threshold</item>
-      <item> Set GoodChRmssi Threshold</item>
-      <item> Set AfJmpRmssi Samples count</item>
-      <item> Get AfJmpRmssi Threshold</item>
-      <item> Get GoodChRmssi Threshold</item>
-      <item> Get AfJmpRmssi Samples count</item>
-      <item> RF Statistics</item>
-      <item> Set RXREPEAT Count</item>
-  </string-array>
-
-  <string-array name="stats_options">
-      <item> Select the option</item>
-      <item> Configure Performance parameters</item>
-      <item> RF Statistics</item>
-  </string-array>
-
-  <string-array name="channel_spacing_val">
-      <item>2</item>
-      <item>1</item>
-      <item>0</item>
-  </string-array>
-
-  <string-array name="channel_spacing_entries">
-      <item>50 Khz</item>
-      <item>100 Khz</item>
-      <item>200 Khz</item>
-  </string-array>
-
-  <string-array name="band_sweep_methods">
-      <item>Manual</item>
-      <item>From File</item>
-  </string-array>
-
-</resources>
diff --git a/fmapp/res/values/strings.xml b/fmapp/res/values/strings.xml
deleted file mode 100644
index 995ae04..0000000
--- a/fmapp/res/values/strings.xml
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_name">FM Radio</string>
-    <string name="tx_app_name">FM Transmitter</string>
-
-    <string name="default_sleep">Sleep 12:34</string>
-    <string name="menu_add_to_preset">Add to Presets</string>
-    <string name="menu_settings">Settings</string>
-    <string name="menu_record_start">Start Recording</string>
-    <string name="menu_record_stop">Stop Recording</string>
-    <string name="button_ok">OK</string>
-    <string name="error_sdcard_access">Unable to access SD card</string>
-    <string name="fm_service_started">FM Service</string>
-    <string name="menu_sleep">Sleep</string>
-    <string name="menu_sleep_cancel">Cancel Sleep</string>
-    <string name="menu_wired_headset">Wired Headset</string>
-    <string name="menu_speaker_on">Enable Speaker</string>
-    <string name="menu_display_tags">Show Tags</string>
-    <string name="menu_speaker_off">Disable Speaker</string>
-    <string name="menu_scan_start">Scan</string>
-    <string name="menu_scan_stop">Stop Searching</string>
-    <string name="menu_stats">FM RF Stats</string>
-    <string name="button_text_stop">Stop</string>
-    <string name="msg_seeking">Searching FM Station</string>
-    <string name="msg_scanning">Scanning for all FM Stations</string>
-    <string name="msg_scanning_pty">Scanning for "<xliff:g id="pty_name">%1$s</xliff:g>"</string>
-    <string name="msg_search_title">FM - <xliff:g id="frequency_string">%1$s</xliff:g></string>
-    <string name="msg_searching">Searching for Strong Stations to create a Preset List </string>
-    <string name="msg_searching_title">Auto-Select Presets</string>
-    <string name="msg_weak_searching">Searching for frequencies to transmit</string>
-
-    <string name="msg_noantenna">Please plug in a Headset to use FM
-        Radio </string>
-    <string name="msg_headsetpluggedin">Disconnect all Headsets for using FM Tx</string>
-    <string name="msg_callactive">FM Tx is not supported when there is active voice call</string>
-    <string name="dialog_sleep_title">Select Auto-Off Sleep Time</string>
-        <string name="preset_select_name">Select "<xliff:g id="preset_name">%1$s</xliff:g>"</string>
-        <string name="presetlist_select_name">Select "<xliff:g id="presetlist_name">%1$s</xliff:g>"</string>
-    <string name="presetlist_add_new">Add New List</string>
-    <string name="dialog_presetlist_title">Preset Lists</string>
-        <string name="presetlist_prefix_name">FM - </string>
-        <string name="dialog_presetlist_rename_title">Enter a name </string>
-        <string name="dialog_preset_rename_title">Enter a name </string>
-        <string name="presetlist_delete_name">Delete "<xliff:g id="presetlist_name">%1$s</xliff:g>" and its Stations?</string>
-        <string name="presetlist_autoselect_title">Confirm Auto-Select</string>
-        <string name="presetlist_autoselect_name">Auto-Select will delete all the Presets in the list  "<xliff:g id="presetlist_name">%1$s</xliff:g>", Continue?</string>
-        <string name="fmtx_autoselect_name">Auto-Select will delete all the Presets, Continue?</string>
-
-    <string name="enter_frequency">Tune to Station</string>
-    <string name="enter_new_frequency_title">Enter Frequency </string>
-
-    <string name="preset_now_playing">Now Playing </string>
-        <string name="preset_pref_title">"<xliff:g id="preset_name">%1$s</xliff:g>"
-        (<xliff:g id="preset_freq">%2$s</xliff:g>)</string>
-        <string name="preset_delete_title">Delete Preset</string>
-
-        <string name="preset_delete_name">Delete "<xliff:g id="preset_name">%1$s</xliff:g>"
-        from "<xliff:g id="presetlist_name">%2$s</xliff:g>"</string>
-
-        <string name="preset_confirm_delete_name">Delete "<xliff:g id="preset_name">%1$s</xliff:g>"
-        from "<xliff:g id="presetlist_name">%2$s</xliff:g>" ?</string>
-
-    <string name="preset_name_dialog_title">Enter a name </string>
-    <string name="preset_name_summary">"<xliff:g id="preset_name">%1$s</xliff:g>" </string>
-    <string name="preset_name_title">Rename</string>
-
-    <string name="preset_search_title">Search</string>
-    <string name="preset_search_name">Search for "<xliff:g id="preset_name">%1$s</xliff:g>"</string>
-
-    <string name="preset_preference_title">FM Stations in "<xliff:g id="preset_name">%1$s</xliff:g>" </string>
-
-    <string name="preset_empty_title">No Stations in the List</string>
-    <string name="preset_empty_add_summary">Add Stations</string>
-
-    <string name="preset_add">Add</string>
-    <string name="preset_replace">Replace</string>
-    <string name="preset_tune">Tune</string>
-    <string name="preset_rename">Rename</string>
-    <string name="preset_delete">Delete</string>
-    <string name="preset_search">Search for "<xliff:g id="preset_pi">%1$s</xliff:g>"
-        </string>
-
-    <string name="stat_notif_frequency">FM Radio Station "<xliff:g id="frequency">%1$s</xliff:g>"</string>
-    <string name="stat_notif_tx_frequency">FM Transmitting at: "<xliff:g id="frequency">%1$s</xliff:g>"</string>
-
-
-    <string name="sel_band_menu">Select Regional Band</string>
-    <string name="test_menu">Select Test</string>
-
-    <string name="settings_menu">Settings</string>
-    <string name="regional_band">Regional Band</string>
-
-    <string name="aud_output_mode">Audio Output Mode</string>
-    <string name="sel_audio_output">Select Audio Output</string>
-
-    <string name="record_dur">Record Duration</string>
-    <string name="sel_rec_dur">Select Record Duration</string>
-
-    <string name="auto_select_af">Alternate Frequency</string>
-    <string name="auto_select_af_enabled">Auto Select Enabled</string>
-    <string name="auto_select_af_disabled">Auto Select Disabled</string>
-
-    <string name="fac_defaults">Revert to Factory Defaults</string>
-    <string name="revert_to_fac">Revert to Factory Defaults</string>
-    <string name="settings_back">Back</string>
-
-    <string name="settings_revert_confirm_title">Confirm Reset Settings</string>
-    <string name="settings_revert_confirm_msg">This will delete all settings including Presets</string>
-
-    <string name="settings_back_summary">Return to previous view</string>
-    <string name="settings_revert_defaults_title">Revert to Factory Defaults</string>
-    <string name="settings_revert_defaults_summary">Reset all settings</string>
-
-    <string name="audio_type_stereo">Stereo</string>
-    <string name="audio_type_mono">Mono</string>
-
-    <string name="default_band">United States</string>
-    <string name="default_audio">Stereo</string>
-    <string name="default_record_duration">5 minutes</string>
-    <string name="factory_reset_dialog_title">Confirm Reset</string>
-    <string name="factory_reset_dialog_message">This will delete all settings including Presets</string>
-    <string name="station_move">Move</string>
-    <string name="station_edit">Edit</string>
-    <!-- alert to the user that USB storage must be available before using FM recording  [CHAR LIMIT=NONE] -->
-   <string name="no_storage">Mount SD card before start recording.</string>
-   <!-- alert to the user that the USB storage is being disk-checked [CHAR LIMIT=30] -->
-   <string name="preparing_sd">Preparing SD card</string>
-   <!-- alert to the user that the FM fails to read or write the USB storage. [CHAR LIMIT=NONE] -->
-   <string name="access_sd_fail">Couldn\'t access SD card.</string>
-   <!-- Low-memory dialog message [CHAR LIMT=NONE] -->
-   <string name="spaceIsLow_content">Your SD card storage is running out of space. Change the quality setting or delete some images or other files.</string>
-   <!-- The messsage shown when FM record reaches size limit. -->
-   <string name="FMRecording_reach_size_limit">Size limit reached.</string>
-
-    <string name="delete_station_title">Delete</string>
-    <string name="find_af_station">Find</string>
-    <string name="menu_add_list">Add List</string>
-    <string name="menu_rename_list">Rename List</string>
-    <string name="menu_reorder_list">Reorder List</string>
-    <string name="menu_scan_for_preset">Scan for Presets</string>
-    <string name="menu_delete_list">Delete List</string>
-    <string name="alert_dialog_ok">Ok</string>
-    <string name="alert_dialog_cancel">Cancel</string>
-
-    <string name="search_dialog_title">Scan Stations</string>
-
-    <string name="search_category_key">search_category_type</string>
-    <string name="search_category">Select Search Type</string>
-    <string name="search_category_title">Search Type</string>
-    <string name="default_search_category">Seek</string>
-    <string name="search_category_tune">Tune</string>
-
-    <string name="search_category_type_key">search_category_value_type</string>
-    <string name="search_category_type">Select Search by Program Type</string>
-    <string name="search_category_type_title">Search by Program Type</string>
-    <string name="default_search_category_type">All Stations</string>
-
-    <string name="presets_back">Back</string>
-    <string name="presets_back_summary">Return to previous view</string>
-
-    <string name="nav_mode_presets">Presets</string>
-    <string name="nav_mode_stations">Stations</string>
-
-    <string name="prog_service_string"></string>
-    <string name="radio_text_string">This is the long Radio Text String Message that needs to scroll</string>
-    <string name="eradio_text_string">Extended Radio Text Message</string>
-    <string name="pty_string"></string>
-    <string name="frequency_string"></string>
-    <string name="station_id_string"></string>
-
-
-        <string name="fm_command_timeout_title">Timeout</string>
-        <string name="fm_tune_timeout_msg">No response received to Tune FM
-            Station. If problem persists, please turn off FM and turn it back
-            on.</string>
-
-        <string name="fm_command_failed_title">FM Operation failed</string>
-        <string name="fm_cmd_failed_msg">FM operation failed. If problem
-            persists, please turn off FM and turn it back on.
-        </string>
-        <string name="fm_cmd_failed_msg_hdmi">FM operation failed. FM and HDMI concurrecny is not supported.
-        </string>
-        <string name="fm_cmd_failed_call_on">FM operation failed. FM audio is not allowed during call. </string>
-
-    <skip/>
-    <!-- Do not translate. Duration format. -->
-    <string name="durationformat"><xliff:g id="format">%2$d:%5$02d</xliff:g></string>
-
-    <string name="default_record"></string>
-    <string name="default_preset_list_name"> FM List </string>
-    <string name="default_station"> FM </string>
-    <string name="default_blank"> </string>
-    <string name="stop_scanning">Stop Scanning</string>
-    <string name="transmit_msg_string">Transmitting at:</string>
-    <!-- the name under which recordings will be visible in the media database is formatted like this -->
-    <string name="audio_db_title_format"><xliff:g id="format">yyyy-MM-dd HH:mm:ss</xliff:g></string>
-    <!-- all recordings will show up in the media database with this 'artist' name -->
-    <string name="audio_db_artist_name">My FM recordings</string>
-    <!-- all recordings will show up in the media database with this 'album' name -->
-    <string name="audio_db_album_name">FM recordings</string>
-    <!-- all recordings will show up in the media database in a playlist with this name -->
-    <string name="audio_db_playlist_name">FM recordings</string>
-    <string name="test_prompt">Choose a test</string>
-    <string name="test_run">Run Test</string>
-    <string name="set_rmmsi_delta">Configure RMSSI Delta</string>
-    <string name="set_sigth">Configure Signal Th</string>
-    <string name="type_rd"></string>
-    <string name="srch_params">Configure RMSSI Delta</string>
-    <string name="srch_params_1">Configure Signal Th </string>
-    <string name="enter_rssi">Enter RMSSI Delta</string>
-    <string name="enter_sigth">Enter Signal Th</string>
-    <string name="enter_SinrSmplsCnt">Enter SINR Samples Count</string>
-    <string name="set_SinrSmplsCnt">Configure SINR Samples</string>
-    <string name="enter_SinrTh">Enter SINR Threshold</string>
-    <string name="set_SinrTh">Configure SINR Threshold</string>
-    <string name="enter_IntfLowTh">Enter Intf Det Low Threshold</string>
-    <string name="set_IntfLowTh">Config Intf Det Low Threshold</string>
-    <string name="enter_IntfHighTh">Enter Intf Det High Threshold</string>
-    <string name="set_IntfHighTh">Config Intf Det High Threshold</string>
-    <string name="enter_SinrFirstStage">Enter Sinr First Stage</string>
-    <string name="set_SinrFirstStage">Config Sinr First Stage</string>
-    <string name="enter_RmssiFirstStage">Enter Rmssi First Stage</string>
-    <string name="set_RmssiFirstStage">Config Rmssi First Stage</string>
-    <string name="enter_CF0Th12">Enter CF0 Threshold</string>
-    <string name="set_CF0Th12">Config CF0 Threshold</string>
-    <string name="search_algo_mpx">MPX_DCC Algo</string>
-    <string name="search_algo_sinrint">SINR_INTF Algo</string>
-    <string name="enter_AfJmpRmssiTh">Enter Af Jump Rmssi Threshold</string>
-    <string name="set_AfJmpRmssiTh">Config Af Jump Rmssi Threshold</string>
-    <string name="enter_GdChRmssiTh">Enter Good Channel Rmssi Threshold</string>
-    <string name="set_GdChRmssiTh">Config Good Channel Rmssi Threshold</string>
-    <string name="enter_AfJmpRmssiSmplsCnt">Enter Af Jump Rmssi Samples count</string>
-    <string name="set_AfJmpRmssiSmplsCnt">Config Af Jump Rmssi Samples count</string>
-    <string name="rt_plus_tags">Tags</string>
-    <string name="enter_RxRePeatCount">Enter RxRePeat count</string>
-    <string name="set_RxRePeatCount">Config RxRePeat count</string>
-    <string name="save_record_file">FM Recorded file saved to "<xliff:g id="record_file">%1$s</xliff:g>"</string>
-
-    <string name="usr_def_band_min">Lower Freq Limit(In Mhz)</string>
-    <string name="usr_def_band_max">Higher Freq Limit(In Mhz)</string>
-    <string name="sel_chanl_spacing">Select Channel Spacing</string>
-    <string name="chanl_spacing">Channel Spacing</string>
-
-    <string name="band_method_prompt">Select Method</string>
-    <string name="enter_start_delay_time">Start Delay Time</string>
-    <string name="enter_dwell_time">Dwell Time</string>
-    <string name="band_sweep_setting">Sweep Setting</string>
-    <string name="band_sweep_setting_set">Set</string>
-    <string name="band_sweep_setting_cancel">Cancel</string>
-    <string name="band_sweep_choose">Choose Band Sweep Method</string>
-
-</resources>
diff --git a/fmapp/res/values/styles.xml b/fmapp/res/values/styles.xml
deleted file mode 100644
index 5119c09..0000000
--- a/fmapp/res/values/styles.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2009, 2012,2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<resources>
-    <style name="FMStationSeekBar">
-        <item name="android:indeterminateOnly">false</item>
-        <item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
-        <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item>
-        <item name="android:minHeight">20dp</item>
-        <item name="android:maxHeight">20dp</item>
-        <item name="android:thumbOffset">8dp</item>
-        <item name="android:focusable">true</item>
-    </style>
-</resources>
diff --git a/fmapp/src/com/codeaurora/fmradio/CommaSeparatedFreqFileReader.java b/fmapp/src/com/codeaurora/fmradio/CommaSeparatedFreqFileReader.java
deleted file mode 100644
index 0f4e1a2..0000000
--- a/fmapp/src/com/codeaurora/fmradio/CommaSeparatedFreqFileReader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.util.Log;
-
-import java.io.*;
-
-public class CommaSeparatedFreqFileReader implements GetNextFreqInterface {
-
-   private BufferedReader reader;
-   private String fileName;
-   private String [] freqList;
-   private int index;
-   private static final String LOGTAG = "COMMA_SEPARATED_FREQ_PARSER";
-   private boolean errorHasOcurred;
-
-   @Override
-   public int getNextFreq() {
-      int freq = Integer.MAX_VALUE;
-
-      Log.d(LOGTAG, "Inside function get freq");
-      if(!errorHasOcurred) {
-         if(index < freqList.length) {
-            try {
-                freq = (int)(Float.parseFloat(freqList[index]) * 1000);
-            }catch(NumberFormatException e) {
-                Log.d(LOGTAG, "Format exception");
-            }
-            index++;
-            if(index >= freqList.length) {
-               index = 0;
-               readLineAndParse();
-            }
-            return freq;
-         }else {
-            return Integer.MAX_VALUE;
-         }
-      }else {
-         return Integer.MAX_VALUE;
-      }
-   }
-
-   public CommaSeparatedFreqFileReader(String fileName) {
-      this.fileName = fileName;
-      try {
-           reader =  new BufferedReader(new FileReader(this.fileName));
-           readLineAndParse();
-      }catch(Exception e) {
-           errorHasOcurred = true;
-           Log.d(LOGTAG, "File not found");
-      }
-   }
-
-   private void readLineAndParse() {
-      String curLine;
-      if(reader != null) {
-         try {
-              if((curLine = reader.readLine()) != null) {
-                 freqList = curLine.split(",");
-              }else {
-                 reader.close();
-                 reader = null;
-                 errorHasOcurred = true;
-              }
-         }catch(Exception e) {
-              errorHasOcurred = true;
-         }
-      }else {
-         errorHasOcurred = true;
-      }
-   }
-
-   @Override
-   public void Stop() {
-      if(reader != null) {
-         try {
-             reader.close();
-             reader = null;
-         }catch(Exception e) {
-         }
-         errorHasOcurred = true;
-      }
-   }
-
-   @Override
-   public boolean errorOccured() {
-      return errorHasOcurred;
-   }
-}
-
diff --git a/fmapp/src/com/codeaurora/fmradio/FMAdapterApp.java b/fmapp/src/com/codeaurora/fmradio/FMAdapterApp.java
deleted file mode 100644
index 87b0aeb..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMAdapterApp.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- * Not a Contribution.
- *
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @hide
- */
-
-package com.codeaurora.fmradio;
-
-import android.app.Application;
-import android.util.Log;
-
-public class FMAdapterApp extends Application {
-    private static final String TAG = "FMAdapterApp";
-    private static final boolean DBG = true;
-    //For Debugging only
-    private static int sRefCount=0;
-
-    static {
-        if (DBG) Log.d(TAG,"Loading FM-JNI Library");
-        System.loadLibrary("qcomfm_jni");
-    }
-
-    public FMAdapterApp() {
-        super();
-        if (DBG) {
-            synchronized (FMAdapterApp.class) {
-                sRefCount++;
-                Log.d(TAG, "REFCOUNT: Constructed "+ this + " Instance Count = " + sRefCount);
-            }
-        }
-    }
-
-    @Override
-    public void onCreate() {
-        super.onCreate();
-    }
-
-    @Override
-    protected void finalize() {
-        if (DBG) {
-            synchronized (FMAdapterApp.class) {
-                sRefCount--;
-                Log.d(TAG, "REFCOUNT: Finalized: " + this +", Instance Count = " + sRefCount);
-            }
-        }
-    }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMMediaButtonIntentReceiver.java b/fmapp/src/com/codeaurora/fmradio/FMMediaButtonIntentReceiver.java
deleted file mode 100644
index ca7f102..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMMediaButtonIntentReceiver.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.app.IntentService;
-import android.content.BroadcastReceiver;
-import android.content.pm.PackageManager;
-import android.content.Context;
-import android.content.ComponentName;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.os.Bundle;
-import java.lang.Object;
-
-public class FMMediaButtonIntentReceiver extends BroadcastReceiver {
-
-private static final String TAG = "FMMediaButtonIntentReceiver";
-public static final String FM_MEDIA_BUTTON = "com.codeaurora.fmradio.action.MEDIA_BUTTON";
-public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
-       if ((action != null) && action.equals("android.intent.action.MEDIA_BUTTON")) {
-           KeyEvent event = (KeyEvent)
-                    intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
-
-           if (event == null) {
-               return;
-           }
-           int keycode = event.getKeyCode();
-           int key_action = event.getAction();
-           if (((KeyEvent.KEYCODE_HEADSETHOOK == keycode) &&
-               (key_action == KeyEvent.ACTION_DOWN)) ||
-               (KeyEvent.KEYCODE_MEDIA_PAUSE == keycode) ||
-               (KeyEvent.KEYCODE_MEDIA_PLAY == keycode)) {
-
-               Log.d(TAG, "ACTION_MEDIA_BUTTON intent received for ACTION_DOWN");
-               Intent i = new Intent(FM_MEDIA_BUTTON);
-               i.putExtra(Intent.EXTRA_KEY_EVENT, event);
-               context.sendBroadcast(i);
-           }
-       }
-   }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMRadio.java b/fmapp/src/com/codeaurora/fmradio/FMRadio.java
deleted file mode 100644
index f9b9e15..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMRadio.java
+++ /dev/null
@@ -1,3534 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothDevice;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnKeyListener;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-import android.media.AudioSystem;
-import android.media.AudioManager;
-import android.media.MediaRecorder;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.view.KeyEvent;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-import android.text.TextUtils;
-
-import java.util.*;
-import java.io.File;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.util.Formatter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.ArrayList;
-
-import com.codeaurora.utils.FrequencyPicker;
-import com.codeaurora.utils.FrequencyPickerDialog;
-import android.content.ServiceConnection;
-import android.media.MediaRecorder;
-
-import qcom.fmradio.FmConfig;
-import android.os.ServiceManager;
-
-
-public class FMRadio extends Activity
-{
-   public static final String LOGTAG = "FMRadio";
-
-   public static final boolean RECORDING_ENABLE = true;
-   MediaRecorder mRecorder = null;
-
-   /* menu Identifiers */
-   private static final int MENU_SCAN_START = Menu.FIRST + 2;
-   private static final int MENU_SCAN_STOP = Menu.FIRST + 3;
-   private static final int MENU_RECORD_START = Menu.FIRST + 4;
-   private static final int MENU_RECORD_STOP = Menu.FIRST + 5;
-   private static final int MENU_SLEEP = Menu.FIRST + 6;
-   private static final int MENU_SLEEP_CANCEL = Menu.FIRST + 7;
-   private static final int MENU_SETTINGS = Menu.FIRST + 8;
-   private static final int MENU_SPEAKER = Menu.FIRST + 9;
-   private static final int MENU_TAGS = Menu.FIRST + 10;
-   private static final int MENU_STAT_TEST = Menu.FIRST + 11;
-
-   /* Dialog Identifiers */
-   private static final int DIALOG_SEARCH = 1;
-   private static final int DIALOG_SLEEP = 2;
-   private static final int DIALOG_SELECT_PRESET_LIST = 3;
-   private static final int DIALOG_PRESETS_LIST = 4;
-   private static final int DIALOG_PRESET_LIST_RENAME = 5;
-   private static final int DIALOG_PRESET_LIST_DELETE = 6;
-   private static final int DIALOG_PRESET_LIST_AUTO_SET = 7;
-   private static final int DIALOG_PICK_FREQUENCY = 8;
-   private static final int DIALOG_PROGRESS_PROGRESS = 9;
-   private static final int DIALOG_PRESET_OPTIONS = 10;
-   private static final int DIALOG_PRESET_RENAME = 11;
-   private static final int DIALOG_CMD_TIMEOUT = 12;
-   private static final int DIALOG_CMD_FAILED = 13;
-   private static final int DIALOG_CMD_FAILED_HDMI_ON = 14;
-   private static final int DIALOG_CMD_FAILED_CALL_ON = 15;
-   private static final int DIALOG_TAGS = 16;
-
-   /* Activity Return ResultIdentifiers */
-   private static final int ACTIVITY_RESULT_SETTINGS = 1;
-
-   /* Activity Return ResultIdentifiers */
-   private static final int MAX_PRESETS_PER_PAGE = 5;
-
-
-   /* Station's Audio is Stereo */
-   private static final int FMRADIO_UI_STATION_AUDIO_STEREO = 1;
-   /* Station's Audio is Mono */
-   private static final int FMRADIO_UI_STATION_AUDIO_MONO = 2;
-
-   /* The duration during which the "Sleep: xx:xx" string will be toggling
-    */
-   private static final int SLEEP_TOGGLE_SECONDS = 60;
-
-   /* The number of Preset Stations to create.
-    * The hardware supports a maximum of 12.
-    */
-   private static final int NUM_AUTO_PRESETS_SEARCH= 12;
-   /*
-    * Command time out: For asynchonous operations, if no response
-    * is received with int this duration, a timeout msg will be displayed.
-    */
-   private static final int CMD_TIMEOUT_DELAY_MS = 5000;
-   private static final int MSG_CMD_TIMEOUT = 101;
-
-   private static final int CMD_NONE = 0;
-   private static final int CMD_TUNE = 1;
-   private static final int CMD_FMON = 2;
-   private static final int CMD_FMOFF = 3;
-   private static final int CMD_FMCONFIGURE = 4;
-   private static final int CMD_MUTE = 5;
-   private static final int CMD_SEEK = 6;
-   private static final int CMD_SCAN = 7;
-   private static final int CMD_SEEKPI = 8;
-   private static final int CMD_SEARCHLIST = 9;
-   private static final int CMD_CANCELSEARCH = 10;
-   private static final int CMD_SET_POWER_MODE = 11;
-   private static final int CMD_SET_AUDIO_MODE = 12;
-   private static final int CMD_SET_AUTOAF = 13;
-   private static final int CMD_GET_INTERNALANTENNA_MODE = 14;
-
-   private static final int PRESETS_OPTIONS_TUNE = 0;
-   private static final int PRESETS_OPTIONS_REPLACE = 1;
-   private static final int PRESETS_OPTIONS_RENAME = 2;
-   private static final int PRESETS_OPTIONS_DELETE = 3;
-   private static final int PRESETS_OPTIONS_SEARCHPI = 4;
-
-   private static IFMRadioService mService = null;
-   private static FmSharedPreferences mPrefs;
-
-   /* Button Resources */
-   private ImageButton mOnOffButton;
-   private ImageButton mMuteButton;
-   /* Button to navigate Preset pages */
-   private ImageButton mPresetPageButton;
-   /* 6 Preset Buttons */
-   private Button[] mPresetButtons = { null, null, null, null, null};
-   private Button mPresetListButton;
-   // private ImageButton mSearchButton;
-   private ImageView mForwardButton;
-   private ImageView mBackButton;
-
-   /* Top row in the station info layout */
-   private ImageView mRSSI;
-   private TextView mProgramServiceTV;
-   private TextView mStereoTV;
-
-   /* Middle row in the station info layout */
-   private TextView mTuneStationFrequencyTV;
-   private TextView mStationCallSignTV;
-   private TextView mProgramTypeTV;
-
-   /* Bottom row in the station info layout */
-   private TextView mRadioTextTV;
-   private TextView mERadioTextTV;
-
-   /* Sleep and Recording Messages */
-   private TextView mSleepMsgTV;
-   private TextView mRecordingMsgTV;
-
-   private double mOutputFreq;
-   private int mPresetPageNumber = 0;
-   private int mStereo = -1;
-
-   // default audio device - speaker
-   private static int mAudioRoute = FMRadioService.RADIO_AUDIO_DEVICE_WIRED_HEADSET;
-   private static boolean mFMStats = false;
-
-
-   /* Current Status Indicators */
-   private static boolean mRecording = false;
-   private static boolean mIsScaning = false;
-   private static boolean mIsSeeking = false;
-   private static boolean mIsSearching = false;
-   private static int mScanPty = 0;
-
-   private Animation mAnimation = null;
-   private ScrollerText mRadioTextScroller = null;
-
-   private static PresetStation mTunedStation = new PresetStation("", 102100);
-   private PresetStation mPresetButtonStation = null;
-
-   /* Radio Vars */
-   final Handler mHandler = new Handler();
-   /* Search Progress Dialog */
-   private ProgressDialog mProgressDialog=null;
-
-   /* Asynchronous command active */
-   private static int mCommandActive = 0;
-
-   /* Command that failed (Sycnhronous or Asynchronous) */
-   private static int mCommandFailed = 0;
-
-   private LoadedDataAndState SavedDataAndState = null;
-
-   /** Called when the activity is first created. */
-   @Override
-   public void onCreate(Bundle savedInstanceState) {
-      super.onCreate(savedInstanceState);
-      setVolumeControlStream(AudioManager.STREAM_MUSIC);
-      mPrefs = new FmSharedPreferences(this);
-      mCommandActive = CMD_NONE;
-      mCommandFailed = CMD_NONE;
-
-      Log.d(LOGTAG, "onCreate - Height : "+ getWindowManager().getDefaultDisplay().getHeight()
-            + " - Width  : "+ getWindowManager().getDefaultDisplay().getWidth());
-
-      setContentView(R.layout.fmradio);
-      SavedDataAndState = (LoadedDataAndState)getLastNonConfigurationInstance();
-      mAnimation = AnimationUtils.loadAnimation(this,
-                                                R.anim.preset_select);
-
-      mMuteButton = (ImageButton) findViewById(R.id.btn_silent);
-      if (mMuteButton != null)
-      {
-         mMuteButton.setOnClickListener(mMuteModeClickListener);
-      }
-
-      mOnOffButton = (ImageButton) findViewById(R.id.btn_onoff);
-      if (mOnOffButton != null)
-      {
-         mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
-      }
-
-      mForwardButton = (ImageView) findViewById(R.id.btn_forward);
-      if (mForwardButton != null)
-      {
-         mForwardButton.setOnClickListener(mForwardClickListener);
-         mForwardButton.setOnLongClickListener(mForwardLongClickListener);
-      }
-
-      mBackButton = (ImageView) findViewById(R.id.btn_back);
-      if (mBackButton != null)
-      {
-         mBackButton.setOnClickListener(mBackClickListener);
-         mBackButton.setOnLongClickListener(mBackLongClickListener);
-      }
-
-      mPresetPageButton = (ImageButton) findViewById(R.id.btn_preset_page);
-      if (mPresetPageButton != null)
-      {
-         mPresetPageButton.setOnClickListener(mPresetsPageClickListener);
-      }
-
-      mPresetListButton = (Button) findViewById(R.id.btn_presets_list);
-      if (mPresetListButton != null)
-      {
-         mPresetListButton.setOnClickListener(mPresetListClickListener);
-         mPresetListButton
-          .setOnLongClickListener(mPresetListButtonOnLongClickListener);
-      }
-
-      /* 6 Preset Buttons */
-      mPresetButtons[0] = (Button) findViewById(R.id.presets_button_1);
-      mPresetButtons[1] = (Button) findViewById(R.id.presets_button_2);
-      mPresetButtons[2] = (Button) findViewById(R.id.presets_button_3);
-      mPresetButtons[3] = (Button) findViewById(R.id.presets_button_4);
-      mPresetButtons[4] = (Button) findViewById(R.id.presets_button_5);
-      for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++)
-      {
-         if (mPresetButtons[nButton] != null)
-         {
-            mPresetButtons[nButton]
-            .setOnClickListener(mPresetButtonClickListener);
-            mPresetButtons[nButton]
-            .setOnLongClickListener(mPresetButtonOnLongClickListener);
-         }
-      }
-
-      mTuneStationFrequencyTV = (TextView) findViewById(R.id.prog_frequency_tv);
-      if (mTuneStationFrequencyTV != null)
-      {
-         mTuneStationFrequencyTV.setOnLongClickListener(mFrequencyViewClickListener);
-      }
-      mProgramServiceTV = (TextView) findViewById(R.id.prog_service_tv);
-      mStereoTV = (TextView) findViewById(R.id.stereo_text_tv);
-
-      mStationCallSignTV = (TextView) findViewById(R.id.call_sign_tv);
-      mProgramTypeTV = (TextView) findViewById(R.id.pty_tv);
-
-      mRadioTextTV = (TextView) findViewById(R.id.radio_text_tv);
-      mERadioTextTV = (TextView) findViewById(R.id.eradio_text_tv);
-      mSleepMsgTV = (TextView) findViewById(R.id.sleep_msg_tv);
-      mRecordingMsgTV = (TextView) findViewById(R.id.record_msg_tv);
-      /* Disable displaying RSSI */
-      mRSSI = (ImageView) findViewById(R.id.signal_level);
-      if (mRSSI != null)
-      {
-         mRSSI.setVisibility(View.INVISIBLE);
-      }
-
-      if ((mRadioTextScroller == null) && (mRadioTextTV != null))
-      {
-         mRadioTextScroller = new ScrollerText(mRadioTextTV);
-      }
-
-      enableRadioOnOffUI(false);
-      //HDMI and FM concurrecny is not supported.
-      if (isHdmiOn())
-      {
-         showDialog(DIALOG_CMD_FAILED_HDMI_ON);
-      }
-      else {
-         if (false == bindToService(this, osc))
-         {
-            Log.d(LOGTAG, "onCreate: Failed to Start Service");
-         } else
-         {
-            Log.d(LOGTAG, "onCreate: Start Service completed successfully");
-         }
-      }
-   }
-
-   @Override
-   public void onRestart() {
-      Log.d(LOGTAG, "FMRadio: onRestart");
-      try {
-         if (null != mService) {
-              mService.requestFocus();
-         }
-      } catch (Exception e) {
-         e.printStackTrace();
-      }
-      super.onRestart();
-   }
-
-   @Override
-   public void onStop() {
-      Log.d(LOGTAG, "FMRadio: onStop");
-      if(isSleepTimerActive() ) {
-          mSleepUpdateHandlerThread.interrupt();
-          long timeNow = ((SystemClock.elapsedRealtime()));
-          if (timeNow < mSleepAtPhoneTime)
-          {
-              try {
-                if (null != mService) {
-                    mService.delayedStop((mSleepAtPhoneTime - timeNow),FMRadioService.STOP_SERVICE);
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-          }
-      }
-      if(isRecording()) {
-          try {
-               if ( null != mRecordUpdateHandlerThread) {
-                    mRecordUpdateHandlerThread.interrupt();
-               }
-          } catch (NullPointerException e) {
-               e.printStackTrace();
-          }
-      }
-      super.onStop();
-   }
-
-   @Override
-   public void onStart() {
-      super.onStart();
-      Log.d(LOGTAG, "FMRadio: onStart");
-      try
-      {
-         if(mService != null)
-         {
-            mService.registerCallbacks(mServiceCallbacks);
-         }
-      }
-      catch (RemoteException e)
-      {
-         e.printStackTrace();
-      }
-      if(isSleepTimerActive()) {
-          Log.d(LOGTAG,"isSleepTimerActive is true");
-          try {
-            if (null != mService) {
-                mService.cancelDelayedStop(FMRadioService.STOP_SERVICE);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        initiateSleepThread();
-      }
-      if(isRecording()) {
-          Log.d(LOGTAG,"isRecordTimerActive is true");
-          try {
-            if (null != mService) {
-                mService.cancelDelayedStop(FMRadioService.STOP_RECORD);
-            }
-          } catch (Exception e) {
-              e.printStackTrace();
-          }
-          if(isRecording()) {
-             initiateRecordThread();
-          }
-      }
-
-   }
-
-   @Override
-   protected void onPause() {
-      Log.d(LOGTAG, "FMRadio: onPause");
-      super.onPause();
-      mRadioTextScroller.stopScroll();
-      FmSharedPreferences.setTunedFrequency(mTunedStation.getFrequency());
-      mPrefs.Save();
-   }
-
-   @Override
-   public void onResume() {
-      super.onResume();
-      Log.d(LOGTAG, "FMRadio: onResume");
-      mPrefs.Load();
-      PresetStation station = new PresetStation("", FmSharedPreferences.getTunedFrequency());
-      if (station != null) {
-          mTunedStation.Copy(station);
-      }
-      mHandler.post(mUpdateProgramService);
-      mHandler.post(mUpdateRadioText);
-      mHandler.post(mOnStereo);
-      updateStationInfoToUI();
-      enableRadioOnOffUI();
-   }
-   private class LoadedDataAndState {
-      public LoadedDataAndState(){};
-      public boolean onOrOff;
-   }
-   @Override
-   public Object onRetainNonConfigurationInstance() {
-      final LoadedDataAndState data = new LoadedDataAndState();
-      if(mService != null) {
-         try {
-              data.onOrOff = mService.isFmOn();
-         } catch(RemoteException e) {
-              data.onOrOff = false;
-              e.printStackTrace();
-         }
-      } else {
-         data.onOrOff = false;
-      }
-      return data;
-   }
-
-   @Override
-   public void onDestroy() {
-      Log.d(LOGTAG, "FMRadio: onDestroy");
-      cleanupTimeoutHandler();
-      if (mService != null) {
-          try {
-               if(!mService.isFmOn()) {
-                  endSleepTimer();
-               }
-          } catch (RemoteException e) {
-               e.printStackTrace();
-          }
-      }
-      unbindFromService(this);
-      mService = null;
-      Log.d(LOGTAG, "onDestroy: unbindFromService completed");
-      super.onDestroy();
-   }
-
-   @Override
-   public boolean onCreateOptionsMenu(Menu menu) {
-      super.onCreateOptionsMenu(menu);
-      MenuItem item;
-      boolean radioOn = isFmOn();
-      boolean recording = isRecording();
-      boolean mSpeakerPhoneOn = isSpeakerEnabled();
-      boolean sleepActive = isSleepTimerActive();
-      boolean searchActive = isScanActive() || isSeekActive();
-
-      item = menu.add(0, MENU_SCAN_START, 0, R.string.menu_scan_start).setIcon(
-                                                                              R.drawable.ic_btn_search);
-      if (item != null)
-      {
-         item.setVisible(!searchActive && radioOn);
-      }
-      item = menu.add(0, MENU_SCAN_STOP, 0, R.string.menu_scan_stop).setIcon(
-                                                                            R.drawable.ic_btn_search);
-      if (item != null)
-      {
-         item.setVisible(searchActive && radioOn);
-      }
-
-      if (RECORDING_ENABLE)
-      {
-         item = menu.add(0, MENU_RECORD_START, 0, R.string.menu_record_start)
-                .setIcon(R.drawable.ic_menu_record);
-         if (item != null)
-         {
-            item.setVisible(true);
-            item.setEnabled(!recording && radioOn);
-         }
-         item = menu.add(0, MENU_RECORD_STOP, 0, R.string.menu_record_stop)
-                .setIcon(R.drawable.ic_menu_record);
-         if (item != null)
-         {
-            item.setVisible(true);
-            item.setEnabled(recording && radioOn);
-         }
-      }
-      /* Settings can be active */
-      item = menu.add(0, MENU_SETTINGS, 0, R.string.menu_settings).setIcon(
-                                                                          android.R.drawable.ic_menu_preferences);
-
-      item = menu.add(0, MENU_SLEEP, 0, R.string.menu_sleep)
-             .setTitle(R.string.menu_sleep);
-      if (item != null)
-      {
-         item.setVisible(!sleepActive && radioOn);
-      }
-      item = menu.add(0, MENU_SLEEP_CANCEL, 0, R.string.menu_sleep_cancel)
-             .setTitle(R.string.menu_sleep_cancel);
-      if (item != null)
-      {
-         item.setVisible(sleepActive && radioOn);
-      }
-      mFMStats = SystemProperties.getBoolean("persist.fm.stats",false);
-      if(mFMStats) {
-          item = menu.add(0, MENU_STAT_TEST, 0,R.string.menu_stats).setIcon(
-                                                                            android.R.drawable.ic_menu_info_details);
-      }
-      if (!mSpeakerPhoneOn) {
-          item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_on);
-      }
-      else {
-          item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_off);
-      }
-      item = menu.add(0, MENU_TAGS, 0, R.string.menu_display_tags);
-      return true;
-   }
-
-   @Override
-   public boolean onPrepareOptionsMenu(Menu menu) {
-
-      super.onPrepareOptionsMenu(menu);
-
-      MenuItem item;
-      boolean radioOn = isFmOn();
-      boolean recording = isRecording();
-      boolean mSpeakerPhoneOn = isSpeakerEnabled();
-      boolean searchActive = isScanActive() || isSeekActive();
-
-      item = menu.findItem(MENU_SCAN_START);
-      if (item != null)
-      {
-         item.setVisible(!searchActive && radioOn);
-      }
-      item = menu.findItem(MENU_SCAN_STOP);
-      if (item != null)
-      {
-         item.setVisible(searchActive && radioOn);
-      }
-      if (RECORDING_ENABLE)
-      {
-         item = menu.findItem(MENU_RECORD_START);
-         if (item != null)
-         {
-          item.setVisible(true);
-          item.setEnabled(!recording && radioOn && !isAnalogModeEnabled());
-         }
-         item = menu.findItem(MENU_RECORD_STOP);
-         if (item != null)
-         {
-          item.setVisible(true);
-          item.setEnabled(recording && radioOn && !isAnalogModeEnabled());
-         }
-      }
-
-      boolean sleepActive = isSleepTimerActive();
-      item = menu.findItem(MENU_SLEEP);
-      if (item != null)
-      {
-         item.setVisible(!sleepActive && radioOn);
-      }
-      item = menu.findItem(MENU_SLEEP_CANCEL);
-      if (item != null)
-      {
-         item.setVisible(sleepActive && radioOn);
-      }
-
-      if (radioOn)
-      {
-          if (menu.findItem(MENU_SPEAKER) == null)
-          {
-              if (!mSpeakerPhoneOn) {
-                  item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_on);
-              }
-              else {
-                  item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_off);
-              }
-          }
-          else {
-              menu.removeItem(MENU_SPEAKER);
-              if (!mSpeakerPhoneOn) {
-                  item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_on);
-              }
-              else {
-                  item = menu.add(0, MENU_SPEAKER, 0, R.string.menu_speaker_off);
-              }
-          }
-      } else
-      {
-         menu.removeItem(MENU_SPEAKER);
-      }
-      return true;
-   }
-
-   @Override
-   public boolean onOptionsItemSelected(MenuItem item) {
-      switch (item.getItemId())
-      {
-      case MENU_SETTINGS:
-         Intent launchPreferencesIntent = new Intent().setClass(this,
-                                                                Settings.class);
-                  launchPreferencesIntent.putExtra(Settings.RX_MODE,true);
-         startActivityForResult(launchPreferencesIntent,
-                                ACTIVITY_RESULT_SETTINGS);
-         //startActivity(launchPreferencesIntent);
-         return true;
-      case MENU_STAT_TEST:
-          Intent launchFMStatIntent = new Intent().setClass(this,
-                                                            FMStats.class);
-          startActivity(launchFMStatIntent);
-          return true;
-
-      case MENU_SCAN_START:
-         showDialog(DIALOG_SEARCH);
-         return true;
-
-      case MENU_SCAN_STOP:
-         cancelSearch();
-         return true;
-
-      case MENU_RECORD_START:
-         startRecording();
-         return true;
-
-      case MENU_RECORD_STOP:
-         stopRecording();
-         return true;
-
-      case MENU_SLEEP:
-         showDialog(DIALOG_SLEEP);
-         return true;
-
-      case MENU_SLEEP_CANCEL:
-         DebugToasts("Sleep Cancelled", Toast.LENGTH_SHORT);
-         endSleepTimer();
-         return true;
-
-      case MENU_SPEAKER:
-         /* Call the mm interface to route the wired headset*/
-          enableSpeaker();
-          return true;
-      case MENU_TAGS:
-          Intent launchFMTagsIntent = new Intent().setClass(this,
-                                                            FmTags.class);
-          startActivity(launchFMTagsIntent);
-          return true;
-      default:
-         break;
-      }
-      return super.onOptionsItemSelected(item);
-   }
-
-   private boolean isHdmiOn() {
-     //HDMI and FM concurrecny is not supported.
-          try {
-              String hdmiUserOption = android.provider.Settings.System.getString(
-                                            getContentResolver(), "HDMI_USEROPTION");
-          }
-          catch (Exception ex){
-          }
-          return false;
-   }
-
-   private void enableSpeaker() {
-    //This method with toggle Speaker phone based on existing state .
-       boolean bSpeakerPhoneOn = isSpeakerEnabled();
-       if(mService != null)
-          {
-           try {
-               if(bSpeakerPhoneOn){  // as Speaker is already on turn it off.
-                   mService.enableSpeaker(false);
-                   Log.d(LOGTAG, "Speaker phone is  turned off");
-               }else{ // as Speaker is off turn it on.
-                   mService.enableSpeaker(true);
-                   Log.d(LOGTAG, "Speaker phone is turned on");
-               }
-           } catch (RemoteException e)
-           {
-                e.printStackTrace();
-           }
-       }
-   }
-
-   private static final int RECORDTIMER_EXPIRED = 0x1003;
-   private static final int RECORDTIMER_UPDATE = 0x1004;
-
-   private void updateExpiredRecordTime() {
-      int vis = View.VISIBLE;
-      if(isRecording())
-      {
-         long timeNow = ((SystemClock.elapsedRealtime()));
-         long seconds = (timeNow - getRecordingStartTime()) / 1000;
-         String Msg = makeTimeString(seconds);
-         mRecordingMsgTV.setText(Msg);
-         mRecordingMsgTV.setVisibility(vis);
-      }
-   }
-
-   /* Recorder Thread processing */
-   private Runnable doRecordProcessing = new Runnable() {
-      public void run() {
-         while (isRecording() &&
-                 (!Thread.currentThread().isInterrupted()))
-         {
-            try
-            {
-               Thread.sleep(500);
-               Message statusUpdate = new Message();
-               statusUpdate.what = RECORDTIMER_UPDATE;
-               mUIUpdateHandlerHandler.sendMessage(statusUpdate);
-            } catch (InterruptedException e)
-            {
-               Thread.currentThread().interrupt();
-            }
-            if(!isRecording()) {
-               Message finished = new Message();
-               finished.what = RECORDTIMER_EXPIRED;
-               mUIUpdateHandlerHandler.sendMessage(finished);
-            }
-         }
-      }
-   };
-
-   private Thread mRecordUpdateHandlerThread = null;
-
-   private long getRecordingStartTime() {
-
-      if(mService == null)
-         return 0;
-
-      try {
-           return mService.getRecordingStartTime();
-      }catch(RemoteException e) {
-           return 0;
-      }
-   }
-
-   private void initiateRecordDurationTimer(long mins ) {
-      Log.d(LOGTAG, "Stop Recording in mins : " + mins);
-      initiateRecordThread();
-    }
-    private void initiateRecordThread() {
-      if (mRecordUpdateHandlerThread == null)
-      {
-         mRecordUpdateHandlerThread = new Thread(null, doRecordProcessing,
-                                                "RecordUpdateThread");
-      }
-      /* Launch the dummy thread to simulate the transfer progress */
-      Log.d(LOGTAG, "Thread State: " + mRecordUpdateHandlerThread.getState());
-      if (mRecordUpdateHandlerThread.getState() == Thread.State.TERMINATED)
-      {
-         mRecordUpdateHandlerThread = new Thread(null, doRecordProcessing,
-                                                "RecordUpdateThread");
-      }
-      /* If the thread state is "new" then the thread has not yet started */
-      if (mRecordUpdateHandlerThread.getState() == Thread.State.NEW)
-      {
-         mRecordUpdateHandlerThread.start();
-      }
-   }
-
-
-
-   private void audioRoute (int audioDevice)
-   {
-      boolean bStatus;
-      if(mService != null)
-      {
-         try
-         {
-            bStatus = mService.routeAudio(audioDevice);
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-   }
-
-   @Override
-   protected Dialog onCreateDialog(int id) {
-      AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-      dlgBuilder.setOnKeyListener(new OnKeyListener() {
-         public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
-             Log.d(LOGTAG, "OnKeyListener event received"+keyCode);
-             switch (keyCode) {
-                 case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-                 case 126: //KeyEvent.KEYCODE_MEDIA_PLAY:
-                 case 127: //KeyEvent.KEYCODE_MEDIA_PAUSE:
-                 case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
-                 case KeyEvent.KEYCODE_MEDIA_NEXT:
-                 case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-                 case KeyEvent.KEYCODE_MEDIA_REWIND:
-                 case KeyEvent.KEYCODE_MEDIA_STOP:
-                     return true;
-             }
-             return false;
-         }
-      });
-      switch (id)
-      {
-      case DIALOG_SELECT_PRESET_LIST: {
-            return createSelectPresetListDlg(id, dlgBuilder);
-         }
-      case DIALOG_PRESETS_LIST: {
-            return createPresetListEditDlg(id, dlgBuilder);
-         }
-      case DIALOG_PRESET_LIST_RENAME: {
-            return createPresetListRenameDlg(id, dlgBuilder);
-         }
-      case DIALOG_PRESET_LIST_DELETE: {
-            return createPresetListDeleteDlg(id, dlgBuilder);
-         }
-      case DIALOG_PRESET_LIST_AUTO_SET: {
-            return createPresetListAutoSelectWarnDlg(id, dlgBuilder);
-         }
-      case DIALOG_SEARCH: {
-            return createSearchDlg(id, dlgBuilder);
-         }
-      case DIALOG_SLEEP: {
-            return createSleepDlg(id, dlgBuilder);
-         }
-      case DIALOG_PICK_FREQUENCY: {
-            FmConfig fmConfig = FmSharedPreferences.getFMConfiguration();
-            return new FrequencyPickerDialog(this, fmConfig, mTunedStation.getFrequency(), mFrequencyChangeListener);
-         }
-      case DIALOG_PROGRESS_PROGRESS: {
-         return createProgressDialog(id);
-        }
-      case DIALOG_PRESET_OPTIONS: {
-         return createPresetOptionsDlg(id, dlgBuilder);
-       }
-      case DIALOG_PRESET_RENAME: {
-         return createPresetRenameDlg(id, dlgBuilder);
-       }
-      case DIALOG_CMD_TIMEOUT:{
-         return createCmdTimeoutDlg(id, dlgBuilder);
-      }
-      case DIALOG_CMD_FAILED:{
-         return createCmdFailedDlg(id, dlgBuilder);
-      }
-      case DIALOG_CMD_FAILED_HDMI_ON:{
-         return createCmdFailedDlgHdmiOn(id);
-      }
-      case DIALOG_CMD_FAILED_CALL_ON:{
-          return createCmdFailedDlgCallOn(id);
-      }
-      default:
-         break;
-      }
-      return null;
-   }
-
-   @Override
-   protected void onPrepareDialog(int id, Dialog dialog) {
-      super.onPrepareDialog(id, dialog);
-      int curListIndex = FmSharedPreferences.getCurrentListIndex();
-      PresetList curList = FmSharedPreferences.getStationList(curListIndex);
-      switch (id)
-      {
-      case DIALOG_PRESET_LIST_RENAME: {
-            EditText et = (EditText) dialog.findViewById(R.id.list_edit);
-            if (et != null && curList != null)
-            {
-               et.setText(curList.getName());
-            }
-            break;
-         }
-      case DIALOG_PRESET_LIST_DELETE: {
-            AlertDialog alertDlg = ((AlertDialog) dialog);
-            if (alertDlg != null && curList != null)
-            {
-               alertDlg.setTitle(curList.getName());
-               alertDlg.setMessage(getString(R.string.presetlist_delete_name, curList.getName()));
-            }
-            break;
-         }
-
-      case DIALOG_PRESET_LIST_AUTO_SET: {
-            AlertDialog alertDlg = ((AlertDialog) dialog);
-            if (alertDlg != null && curList != null)
-            {
-               alertDlg.setTitle(curList.getName());
-               ((AlertDialog) dialog)
-               .setMessage(getString(R.string.presetlist_autoselect_name, curList.getName()));
-            }
-            break;
-         }
-      case DIALOG_SELECT_PRESET_LIST: {
-            AlertDialog alertDlg = ((AlertDialog) dialog);
-            ListView lv = (ListView) alertDlg.findViewById(R.id.list);
-            if (lv != null)
-            {
-               updateSelectPresetListDlg(lv);
-            }
-            break;
-         }
-      case DIALOG_PRESETS_LIST: {
-            AlertDialog alertDlg = ((AlertDialog) dialog);
-            if(alertDlg != null && curList != null)
-            {
-                alertDlg.setTitle(curList.getName());
-            }
-            break;
-         }
-      case DIALOG_PICK_FREQUENCY:
-         {
-            if (dialog != null && mTunedStation != null)
-            {
-               FmConfig fmConfig = FmSharedPreferences.getFMConfiguration();
-              ((FrequencyPickerDialog) dialog).updateSteps(fmConfig.getChSpacing());
-              ((FrequencyPickerDialog) dialog).updateMinFreq(fmConfig.getLowerLimit());
-              ((FrequencyPickerDialog) dialog).updateMaxFreq(fmConfig.getUpperLimit());
-              ((FrequencyPickerDialog) dialog).UpdateFrequency(mTunedStation.getFrequency());
-            }
-            break;
-         }
-      case DIALOG_PRESET_RENAME:
-         {
-            EditText et = (EditText) dialog.findViewById(R.id.list_edit);
-            if ((et != null) && (mPresetButtonStation != null))
-            {
-               et.setText(mPresetButtonStation.getName());
-            }
-            break;
-         }
-      case DIALOG_PRESET_OPTIONS: {
-         AlertDialog alertDlg = ((AlertDialog) dialog);
-         if ((alertDlg != null) && (mPresetButtonStation != null))
-         {
-            alertDlg.setTitle(mPresetButtonStation.getName());
-         }
-         break;
-       }
-
-      default:
-         break;
-      }
-   }
-
-   @Override
-   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-      super.onActivityResult(requestCode, resultCode, data);
-      Log.d(LOGTAG, "onActivityResult : requestCode -> "+ requestCode);
-      Log.d(LOGTAG, "onActivityResult : resultCode -> "+ resultCode);
-      if (requestCode ==ACTIVITY_RESULT_SETTINGS)
-      {
-         if (resultCode == RESULT_OK)
-         {
-            /* */
-            if (data != null)
-            {
-               String action = data.getAction();
-               if (action != null)
-               {
-                  if (action.equals(Settings.RESTORE_FACTORY_DEFAULT_ACTION))
-                  {
-                     RestoreDefaults();
-                     enableRadioOnOffUI();
-                  }
-               }
-            }
-         } //if ACTIVITY_RESULT_SETTINGS
-      }//if (resultCode == RESULT_OK)
-   }
-
-
-
-   /**
-    * @return true if a wired headset is connected.
-    */
-   boolean isWiredHeadsetAvailable() {
-      boolean bAvailable = false;
-      if(mService != null)
-      {
-         try
-         {
-            bAvailable = mService.isWiredHeadsetAvailable();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      Log.e(LOGTAG, "isWiredHeadsetAvailable: " + bAvailable);
-      return bAvailable;
-   }
-
-    /**
-     * @return true if a internal antenna is available.
-     *
-     */
-    boolean isAntennaAvailable() {
-       boolean bAvailable = false;
-       if(mService != null)
-       {
-          try
-          {
-             bAvailable = mService.isAntennaAvailable();
-          } catch (RemoteException e)
-          {
-             e.printStackTrace();
-          }
-       }
-       return bAvailable;
-
-    }
-    boolean isCallActive(){
-        boolean bCallActive = false;
-        if( mService != null)
-        {
-            try
-            {
-                bCallActive = mService.isCallActive();
-            } catch (RemoteException e)
-            {
-                e.printStackTrace();
-            }
-        }
-        return bCallActive;
-    }
-
-   private Dialog createSearchDlg(int id, AlertDialog.Builder dlgBuilder) {
-      String[] items;
-      dlgBuilder.setIcon(R.drawable.ic_btn_search);
-      dlgBuilder.setTitle(getString(R.string.search_dialog_title));
-      /* Pick RBDS or RDS */
-      if(FmSharedPreferences.isRBDSStd())
-      {
-         items = getResources().getStringArray(R.array.search_category_rbds_entries);
-      } else // if(FmSharedPreferences.isRDSStd())
-      {
-         items = getResources().getStringArray(R.array.search_category_rds_entries);
-      }
-
-      dlgBuilder.setItems(items, new DialogInterface.OnClickListener() {
-          public void onClick(DialogInterface dialog, int item) {
-             String[] items;
-             String[] values;
-
-             /* Pick RBDS or RDS */
-             if(FmSharedPreferences.isRBDSStd())
-             {
-                items = getResources().getStringArray(R.array.search_category_rbds_entries);
-                values = getResources().
-                              getStringArray(R.array.search_category_rbds_values);
-             } else // if(FmSharedPreferences.isRDSStd())
-             {
-                items = getResources().getStringArray(R.array.search_category_rds_entries);
-                values = getResources().
-                              getStringArray(R.array.search_category_rds_values);
-             }
-             if ((items != null) &&
-                 (values != null) &&
-                  (item >= 0))
-              {
-                 if ( (item>=0) && (item <= items.length) && (item <= items.length) )
-                 {
-                    DebugToasts("Search Stations for : " + items[item]
-                                +" ("+values[item]+")",
-                                Toast.LENGTH_SHORT);
-                    int pty = Integer.parseInt(values[item]);
-                    initiateSearch(pty);
-                 }
-              }
-             removeDialog (DIALOG_SEARCH);
-          }
-      });
-
-      return dlgBuilder.create();
-   }
-
-   private Dialog createPresetOptionsDlg(int id, AlertDialog.Builder dlgBuilder) {
-      if(mPresetButtonStation != null)
-      {
-         dlgBuilder.setTitle(mPresetButtonStation.getName());
-         ArrayList<String> arrayList = new ArrayList<String>();
-         //PRESETS_OPTIONS_TUNE=0
-         arrayList.add(getResources().getString(R.string.preset_tune));
-         //PRESETS_OPTIONS_REPLACE=1
-         arrayList.add(getResources().getString(R.string.preset_replace));
-         //PRESETS_OPTIONS_RENAME=2
-         arrayList.add(getResources().getString(R.string.preset_rename));
-         //PRESETS_OPTIONS_DELETE=3
-         arrayList.add(getResources().getString(R.string.preset_delete));
-         String piString = mPresetButtonStation.getPIString();
-         if (!TextUtils.isEmpty(piString))
-         {
-            //PRESETS_OPTIONS_SEARCHPI=4
-            arrayList.add(getResources().getString(R.string.preset_search, piString));
-         }
-
-         dlgBuilder.setCancelable(true);
-         dlgBuilder.setOnCancelListener (new DialogInterface.OnCancelListener() {
-            public void onCancel(DialogInterface dialog) {
-               mPresetButtonStation = null;
-               removeDialog(DIALOG_PRESET_OPTIONS);
-            }
-         });
-         String[] items = new String [arrayList.size ()];
-         arrayList.toArray(items);
-         dlgBuilder.setItems(items, new DialogInterface.OnClickListener() {
-             public void onClick(DialogInterface dialog, int item) {
-                if(mPresetButtonStation != null)
-                {
-                   switch(item)
-                   {
-                   case PRESETS_OPTIONS_TUNE:
-                      {
-                         // Tune to the station
-                         tuneRadio(mPresetButtonStation.getFrequency());
-                         mPresetButtonStation = null;
-                         break;
-                      }
-                   case PRESETS_OPTIONS_REPLACE:
-                      {
-                         // Replace preset Station with currently tuned station
-                         Log.d(LOGTAG, "station - " + mPresetButtonStation.getName() + " ("
-                               + mPresetButtonStation.getFrequency() + ")");
-                         mPresetButtonStation.Copy(mTunedStation);
-                         mPresetButtonStation = null;
-                         setupPresetLayout();
-                         mPrefs.Save();
-                         break;
-                      }
-                   case PRESETS_OPTIONS_RENAME:
-                      {
-                         // Rename
-                         showDialog(DIALOG_PRESET_RENAME);
-                         break;
-                      }
-                   case PRESETS_OPTIONS_DELETE:
-                      {
-                         // Delete
-                         int curListIndex = FmSharedPreferences.getCurrentListIndex();
-                         FmSharedPreferences.removeStation(curListIndex, mPresetButtonStation);
-                         mPresetButtonStation = null;
-                         setupPresetLayout();
-                         mPrefs.Save();
-                         break;
-                      }
-                   case PRESETS_OPTIONS_SEARCHPI:
-                      {
-                         // SearchPI
-                         String piString = mPresetButtonStation.getPIString();
-                         int pi = mPresetButtonStation.getPI();
-                         if ((!TextUtils.isEmpty(piString)) &&  (pi>0))
-                         {
-                            initiatePISearch(pi);
-                         }
-                         mPresetButtonStation = null;
-                         break;
-                      }
-                   default:
-                      {
-                         // Should not happen
-                         mPresetButtonStation = null;
-                         break;
-                      }
-                   }//switch item
-                }//if(mPresetButtonStation != null)
-                removeDialog (DIALOG_PRESET_OPTIONS);
-             }//onClick
-         });
-         return dlgBuilder.create();
-      }
-      return null;
-   }
-
-   private Dialog createSleepDlg(int id, AlertDialog.Builder dlgBuilder) {
-      dlgBuilder.setTitle(R.string.dialog_sleep_title);
-      String[] items = getResources().getStringArray(R.array.sleep_duration_values);
-
-      dlgBuilder.setItems(items, new DialogInterface.OnClickListener() {
-          public void onClick(DialogInterface dialog, int item) {
-              String[] items = getResources().getStringArray(R.array.sleep_duration_values);
-              Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
-              if ((item>=0) && (item <= items.length))
-              {
-                 long seconds = (long) (900 * (item + 1));
-                 initiateSleepTimer(seconds);
-              }
-              removeDialog (DIALOG_SLEEP);
-          }
-      });
-
-      return dlgBuilder.create();
-   }
-
-
-   private Dialog createProgressDialog(int id) {
-      String msgStr="";
-      String titleStr="";
-      double frequency = mTunedStation.getFrequency() / 1000.0;
-      boolean bSearchActive = false;
-
-      if(isSeekActive())
-      {
-         msgStr = getString(R.string.msg_seeking);
-         bSearchActive=true;
-      }
-      else if(isScanActive())
-      {
-         String ptyStr = PresetStation.parsePTY(mScanPty);
-         if (!TextUtils.isEmpty(ptyStr))
-         {
-            msgStr = getString(R.string.msg_scanning_pty, ptyStr);
-         }
-         else
-         {
-            msgStr = getString(R.string.msg_scanning);
-         }
-         titleStr = getString(R.string.msg_search_title, ("" + frequency));
-         bSearchActive=true;
-      }
-      else if(isSearchActive())
-      {
-         msgStr = getString(R.string.msg_searching);
-         titleStr = getString(R.string.msg_searching_title);
-         bSearchActive=true;
-      }
-
-      if(bSearchActive) {
-         mProgressDialog = new ProgressDialog(FMRadio.this);
-         if (mProgressDialog != null) {
-            mProgressDialog.setTitle(titleStr);
-            mProgressDialog.setMessage(msgStr);
-            mProgressDialog.setIcon(R.drawable.ic_launcher_fmradio);
-            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
-            mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE,
-                                   getText(R.string.button_text_stop),
-               new DialogInterface.OnClickListener() {
-               public void onClick(DialogInterface dialog, int whichButton) {
-                  cancelSearch();
-               }
-            }
-            );
-            mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
-                public void onCancel(DialogInterface dialog) {
-                   cancelSearch();
-                }
-            }
-            );
-            mProgressDialog.setOnKeyListener(new OnKeyListener() {
-                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
-                    Log.d(LOGTAG, "OnKeyListener event received in ProgressDialog"+keyCode);
-                    switch (keyCode) {
-                        case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-                        case 126: //KeyEvent.KEYCODE_MEDIA_PLAY:
-                        case 127: //KeyEvent.KEYCODE_MEDIA_PAUSE:
-                        case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
-                        case KeyEvent.KEYCODE_MEDIA_NEXT:
-                        case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-                        case KeyEvent.KEYCODE_MEDIA_REWIND:
-                        case KeyEvent.KEYCODE_MEDIA_STOP:
-                            return true;
-                    }
-                    return false;
-                }
-            }
-            );
-         }
-
-         Message msg = new Message();
-         msg.what = TIMEOUT_PROGRESS_DLG;
-         mSearchProgressHandler.sendMessageDelayed(msg, SHOWBUSY_TIMEOUT);
-      }
-      return mProgressDialog;
-   }
-
-   private void updateSelectPresetListDlg(ListView lv) {
-      if (lv != null)
-      {
-         List<PresetList> presetLists = FmSharedPreferences.getPresetLists();
-         ListIterator<PresetList> presetIter;
-         presetIter = presetLists.listIterator();
-         int numLists = presetLists.size();
-         int curIndex = FmSharedPreferences.getCurrentListIndex();
-         ArrayAdapter<String> typeAdapter = new ArrayAdapter<String>(this,
-                                                                     android.R.layout.simple_list_item_single_choice);
-         for (int stationIter = 0; stationIter < numLists; stationIter++)
-         {
-            PresetList temp = presetIter.next();
-            if (temp != null)
-            {
-               typeAdapter.add(getString(R.string.presetlist_select_name, temp.getName()));
-            }
-         }
-         typeAdapter.add(getString(R.string.presetlist_add_new));
-         lv.setAdapter(typeAdapter);
-         lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
-         lv.clearChoices();
-         if (curIndex >= numLists)
-         {
-            curIndex = 0;
-         }
-         if (lv.getCount() >= curIndex)
-         {
-            lv.setItemChecked(curIndex, true);
-            lv.setSelection(curIndex);
-         } else
-         {
-            lv.setItemChecked(0, true);
-            lv.setSelection(0);
-         }
-      }
-   }
-
-
-   private Dialog createPresetListEditDlg(int id, AlertDialog.Builder dlgBuilder) {
-      String[] items = getResources().getStringArray(R.array.presetlist_edit_category);
-
-      int currentList = FmSharedPreferences.getCurrentListIndex();
-      PresetList curList = FmSharedPreferences.getStationList(currentList);
-
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon);
-      dlgBuilder.setTitle("\"" + ((curList == null)?"":curList.getName()) + "\"");
-      dlgBuilder.setItems(items, new DialogInterface.OnClickListener() {
-          public void onClick(DialogInterface dialog, int item) {
-              switch(item)
-              {
-              case 0:
-                 {
-                    // Rename
-                    showDialog(DIALOG_PRESET_LIST_RENAME);
-                    break;
-                 }
-              case 1:
-                 {
-                    // Auto-Select - Build Preset List
-                    int currentList =
-                       FmSharedPreferences.getCurrentListIndex();
-                    PresetList curList =
-                       FmSharedPreferences.getStationList(currentList);
-                    if (curList != null && curList.getStationCount() > 0)
-                    {
-                       /* Show a autoselect- deletes presets warning */
-                       showDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                    }
-                    else
-                    {
-                       if (curList != null) {
-                          curList.clear();
-                       }
-                       /* Since the presets will be changed,
-                        * reset the page number
-                        */
-                       mPresetPageNumber = 0;
-                       initiateSearchList();
-                       //curList.addDummyStations();
-                       setupPresetLayout();
-                       mPrefs.Save();
-                    }
-
-                    break;
-                 }
-              case 2:
-                 {
-                    // Delete
-                    showDialog(DIALOG_PRESET_LIST_DELETE);
-                    break;
-                 }
-              }//switch item
-              removeDialog(DIALOG_PRESETS_LIST);
-          }//onClick
-      });
-      return dlgBuilder.create();
-   }
-
-   private Dialog createSelectPresetListDlg(int id, AlertDialog.Builder dlgBuilder) {
-      LayoutInflater factory = LayoutInflater.from(this);
-      final View listView = factory.inflate(R.layout.alert_dialog_list, null);
-      ListView lv = (ListView) listView.findViewById(R.id.list);
-
-      if (lv != null)
-      {
-         updateSelectPresetListDlg(lv);
-      } else
-      {
-         return null;
-      }
-      dlgBuilder.setView(listView);
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon);
-      dlgBuilder.setTitle(R.string.dialog_presetlist_title);
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         ListView lv = (ListView) listView
-                                         .findViewById(R.id.list);
-                                         int selectedPos = -1;
-                                         if (lv != null)
-                                         {
-                                            selectedPos = lv.getCheckedItemPosition();
-                                         }
-                                         if (selectedPos >= 0)
-                                         {
-                                            if (selectedPos < FmSharedPreferences.getNumList())
-                                            {
-                                               /* If the preset List was changed, reset the page number */
-                                               if(selectedPos != FmSharedPreferences.getCurrentListIndex())
-                                               {
-                                                  mPresetPageNumber = 0;
-                                               }
-                                               FmSharedPreferences.setListIndex(selectedPos);
-                                               mPrefs.Save();
-                                            }
-                                            else
-                                            {
-                                               String presetListName = getString(R.string.presetlist_prefix_name)
-                                               + (FmSharedPreferences.getNumList() + 1);
-                                               int newIndex = FmSharedPreferences
-                                               .createPresetList(presetListName);
-                                               FmSharedPreferences.setListIndex(newIndex);
-                                               showDialog(DIALOG_PRESET_LIST_RENAME);
-                                            }
-                                         }
-                                         setupPresetLayout();
-                                         removeDialog(DIALOG_SELECT_PRESET_LIST);
-                                      }
-                                   });
-      dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         removeDialog(DIALOG_SELECT_PRESET_LIST);
-                                      }
-                                   });
-      return dlgBuilder.create();
-   }
-
-   private Dialog createPresetRenameDlg(int id, AlertDialog.Builder dlgBuilder) {
-      if(mPresetButtonStation == null)
-      {
-         return null;
-      }
-      LayoutInflater factory = LayoutInflater.from(this);
-      final View textEntryView = factory.inflate(
-                                                R.layout.alert_dialog_text_entry, null);
-      dlgBuilder.setTitle(R.string.dialog_presetlist_rename_title);
-      dlgBuilder.setView(textEntryView);
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         //int curList = FmSharedPreferences.getCurrentListIndex();
-
-                                         EditText mTV = (EditText) textEntryView
-                                         .findViewById(R.id.list_edit);
-                                         CharSequence newName = null;
-                                         if (mTV != null) {
-                                            newName = mTV.getEditableText();
-                                         }
-                                         String nName = String.valueOf(newName);
-                                         mPresetButtonStation.setName(nName);
-                                         mPresetButtonStation=null;
-                                         setupPresetLayout();
-                                         mPrefs.Save();
-                                         removeDialog(DIALOG_PRESET_RENAME);
-                                      }
-                                   });
-      dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         removeDialog(DIALOG_PRESET_RENAME);
-                                      }
-                                   });
-      return(dlgBuilder.create());
-   }
-
-   private Dialog createPresetListRenameDlg(int id, AlertDialog.Builder dlgBuilder) {
-      LayoutInflater factory = LayoutInflater.from(this);
-      final View textEntryView = factory.inflate(
-                                                R.layout.alert_dialog_text_entry, null);
-      dlgBuilder.setTitle(R.string.dialog_presetlist_rename_title);
-      dlgBuilder.setView(textEntryView);
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         int curList = FmSharedPreferences.getCurrentListIndex();
-
-                                         EditText mTV = (EditText) textEntryView
-                                         .findViewById(R.id.list_edit);
-                                         CharSequence newName = null;
-                                         if (mTV != null) {
-                                            newName = mTV.getEditableText();
-                                         }
-                                         String nName = String.valueOf(newName);
-                                         FmSharedPreferences.renamePresetList(nName, curList);
-                                         setupPresetLayout();
-                                         mPrefs.Save();
-                                         removeDialog(DIALOG_PRESET_LIST_RENAME);
-                                      }
-                                   });
-      dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         removeDialog(DIALOG_PRESET_LIST_RENAME);
-                                      }
-                                   });
-      return(dlgBuilder.create());
-   }
-
-   private Dialog createPresetListDeleteDlg(int id, AlertDialog.Builder dlgBuilder) {
-      int currentList = FmSharedPreferences.getCurrentListIndex();
-      PresetList curList = FmSharedPreferences.getStationList(currentList);
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon).setTitle(
-                                       (curList == null)?"":curList.getName());
-      dlgBuilder.setMessage(getString(R.string.presetlist_delete_name,
-                                       (curList == null)?"":curList.getName()));
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         int currentList = FmSharedPreferences.getCurrentListIndex();
-                                         FmSharedPreferences.removeStationList(currentList);
-                                         /* Since the presets will be changed,
-                                          * reset the page number
-                                          */
-                                         mPresetPageNumber = 0;
-                                         setupPresetLayout();
-                                         mPrefs.Save();
-                                         removeDialog(DIALOG_PRESET_LIST_DELETE);
-                                      }
-                                   });
-      dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         removeDialog(DIALOG_PRESET_LIST_DELETE);
-                                      }
-                                   });
-      return(dlgBuilder.create());
-   }
-
-   private Dialog createPresetListAutoSelectWarnDlg(int id, AlertDialog.Builder dlgBuilder) {
-      int currentList = FmSharedPreferences.getCurrentListIndex();
-      PresetList curList = FmSharedPreferences.getStationList(currentList);
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon)
-                .setTitle(R.string.presetlist_autoselect_title);
-      dlgBuilder.setMessage(getString(R.string.presetlist_autoselect_name,
-                                      (curList == null)?"":curList.getName()));
-
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog,
-                                                          int whichButton) {
-                                         int currentList =
-                                            FmSharedPreferences.getCurrentListIndex();
-                                         PresetList curList =
-                                            FmSharedPreferences.getStationList(currentList);
-                                         initiateSearchList();
-                                         //curList.addDummyStations();
-                                         setupPresetLayout();
-                                         mPrefs.Save();
-                                         removeDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                                      }
-                                   });
-
-      dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog, int whichButton) {
-                                         removeDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                                      }
-                                   });
-      return(dlgBuilder.create());
-   }
-
-
-   private Dialog createCmdTimeoutDlg(int id, AlertDialog.Builder dlgBuilder) {
-      if(mCommandActive > 0)
-      {
-         dlgBuilder.setIcon(R.drawable.alert_dialog_icon)
-                   .setTitle(R.string.fm_command_timeout_title);
-         dlgBuilder.setMessage(R.string.fm_tune_timeout_msg);
-
-         dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                      new DialogInterface.OnClickListener() {
-                                         public void onClick(DialogInterface dialog,
-                                                             int whichButton) {
-                                            cleanupTimeoutHandler();
-                                            removeDialog(DIALOG_CMD_TIMEOUT);
-                                         }
-                                      });
-
-         return(dlgBuilder.create());
-      }
-      else
-      {
-         return (null);
-      }
-   }
-
-   private Dialog createCmdFailedDlg(int id, AlertDialog.Builder dlgBuilder) {
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon)
-                .setTitle(R.string.fm_command_failed_title);
-      dlgBuilder.setMessage(R.string.fm_cmd_failed_msg);
-
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog,
-                                                          int whichButton) {
-                                         removeDialog(DIALOG_CMD_TIMEOUT);
-                                         mCommandFailed = CMD_NONE;
-                                      }
-                                   });
-
-      return(dlgBuilder.create());
-   }
-
-   private Dialog createCmdFailedDlgHdmiOn(int id) {
-      AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-      dlgBuilder.setIcon(R.drawable.alert_dialog_icon)
-                .setTitle(R.string.fm_command_failed_title);
-      dlgBuilder.setMessage(R.string.fm_cmd_failed_msg_hdmi);
-
-      dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                   new DialogInterface.OnClickListener() {
-                                      public void onClick(DialogInterface dialog,
-                                                          int whichButton) {
-                                         removeDialog(DIALOG_CMD_TIMEOUT);
-                                         mCommandFailed = CMD_NONE;
-                                      }
-                                   });
-
-      return(dlgBuilder.create());
-   }
-
-   private Dialog createCmdFailedDlgCallOn(int id) {
-       AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-       dlgBuilder.setIcon(R.drawable.alert_dialog_icon)
-                 .setTitle(R.string.fm_command_failed_title);
-       dlgBuilder.setMessage(R.string.fm_cmd_failed_call_on);
-
-       dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                    new DialogInterface.OnClickListener() {
-                                       public void onClick(DialogInterface dialog,
-                                                           int whichButton) {
-                                          removeDialog(DIALOG_CMD_TIMEOUT);
-                                          mCommandFailed = CMD_NONE;
-                                       }
-                                    });
-
-       return(dlgBuilder.create());
-    }
-   private void RestoreDefaults() {
-      FmSharedPreferences.SetDefaults();
-      mPrefs.Save();
-   }
-
-   private View.OnLongClickListener mFrequencyViewClickListener = new View.OnLongClickListener() {
-      public boolean onLongClick(View v) {
-         showDialog(DIALOG_PICK_FREQUENCY);
-         return true;
-      }
-   };
-
-   private View.OnClickListener mForwardClickListener
-   = new View.OnClickListener() {
-      public void onClick(View v) {
-         int frequency = FmSharedPreferences.getNextTuneFrequency();
-         Log.d(LOGTAG, "Tune Up: to " + frequency);
-         tuneRadio(frequency);
-      }
-   };
-
-   private View.OnClickListener mBackClickListener
-   = new View.OnClickListener() {
-      public void onClick(View v) {
-         int frequency = FmSharedPreferences.getPrevTuneFrequency();
-         Log.d(LOGTAG, "Tune Down: to " + frequency);
-         tuneRadio(frequency);
-      }
-   };
-
-   private View.OnLongClickListener mForwardLongClickListener
-      = new View.OnLongClickListener() {
-      public boolean onLongClick(View view) {
-         //mForwardButton.startAnimation(mAnimation);
-         SeekNextStation();
-         //enableScanningOnOffUI();
-         return true;
-      }
-   };
-
-   private View.OnLongClickListener mBackLongClickListener = new View.OnLongClickListener() {
-      public boolean onLongClick(View view) {
-         //mBackButton.startAnimation(mAnimation);
-         SeekPreviousStation();
-         //enableScanningOnOffUI();
-         return true;
-      }
-   };
-
-   private View.OnClickListener mPresetListClickListener = new View.OnClickListener() {
-      public void onClick(View v) {
-         showDialog(DIALOG_SELECT_PRESET_LIST);
-      }
-   };
-   private View.OnLongClickListener mPresetListButtonOnLongClickListener = new View.OnLongClickListener() {
-      public boolean onLongClick(View view) {
-         showDialog(DIALOG_PRESETS_LIST);
-         return true;
-      }
-   };
-
-   private View.OnClickListener mPresetsPageClickListener = new View.OnClickListener() {
-      public void onClick(View v) {
-         mPresetPageNumber++;
-         setupPresetLayout();
-      }
-   };
-
-   private View.OnClickListener mPresetButtonClickListener = new View.OnClickListener() {
-      public void onClick(View view) {
-         PresetStation station = (PresetStation) view.getTag();
-         if (station != null)
-         {
-            Log.d(LOGTAG, "station - " + station.getName() + " ("
-                  + station.getFrequency() + ")");
-            //mTunedStation.Copy(station);
-            tuneRadio(station.getFrequency());
-            view.startAnimation(mAnimation);
-         }
-      }
-   };
-
-   private View.OnLongClickListener mPresetButtonOnLongClickListener = new View.OnLongClickListener() {
-      public boolean onLongClick(View view) {
-         PresetStation station = (PresetStation) view.getTag();
-         mPresetButtonStation = station;
-         if (station != null)
-         {
-            showDialog(DIALOG_PRESET_OPTIONS);
-         } else
-         {
-            addToPresets();
-            view.startAnimation(mAnimation);
-         }
-         return true;
-      }
-   };
-
-   final FrequencyPickerDialog.OnFrequencySetListener mFrequencyChangeListener
-   = new FrequencyPickerDialog.OnFrequencySetListener() {
-      public void onFrequencySet(FrequencyPicker view, int frequency) {
-         Log.d(LOGTAG, "mFrequencyChangeListener: onFrequencyChanged to : "+frequency);
-         tuneRadio(frequency);
-      }
-   };
-
-   private View.OnClickListener mMuteModeClickListener
-   = new View.OnClickListener() {
-      public void onClick(View v) {
-         boolean bStatus = false;
-         if(mService != null)
-         {
-            try
-            {
-               if (true == isMuted())
-               {
-                  bStatus = mService.unMute();
-               } else
-               {
-                  bStatus = mService.mute();
-               }
-
-               if(bStatus)
-               {
-                  setMuteModeButtonImage(true);
-                  v.startAnimation(mAnimation);
-               }
-               else
-               {
-                  mCommandFailed = CMD_MUTE;
-                  if( isCallActive() ) {
-                      showDialog(DIALOG_CMD_FAILED_CALL_ON);
-                  } else {
-                      showDialog(DIALOG_CMD_FAILED);
-                  }
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   };
-
-   private Handler mEnableRadioHandler = new Handler();
-   private Handler mDisableRadioHandler = new Handler();
-   private Runnable mEnableRadioTask = new Runnable() {
-    public void run() {
-       enableRadio();
-       mOnOffButton.setEnabled(true);
-       mOnOffButton.setClickable(true);
-       mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
-    }
-  };
-  private Runnable mDisableRadioTask = new Runnable() {
-    public void run() {
-       disableRadio();
-       mOnOffButton.setEnabled(true);
-       mOnOffButton.setClickable(true);
-       mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
-    }
-  };
-   private View.OnClickListener mTurnOnOffClickListener
-   = new View.OnClickListener() {
-      public void onClick(View v) {
-         mOnOffButton.setEnabled(false);
-         mOnOffButton.setClickable(false);
-         mOnOffButton.setOnClickListener(null);
-         if (isFmOn())
-         {
-            mEnableRadioHandler.removeCallbacks(mEnableRadioTask);
-            mDisableRadioHandler.removeCallbacks(mDisableRadioTask);
-            mDisableRadioHandler.postDelayed(mDisableRadioTask, 0);
-
-         } else
-         {
-            mDisableRadioHandler.removeCallbacks(mDisableRadioTask);
-            mEnableRadioHandler.removeCallbacks(mEnableRadioTask);
-            mEnableRadioHandler.postDelayed(mEnableRadioTask, 0);
-         }
-         cleanupTimeoutHandler();
-      }
-   };
-   private void setTurnOnOffButtonImage() {
-      if (isFmOn() == true)
-      {
-         mOnOffButton.setImageResource(R.drawable.ic_btn_onoff);
-      } else
-      {
-         /* Find a icon to indicate off */
-         mOnOffButton.setImageResource(R.drawable.ic_btn_onoff);
-      }
-   }
-
-
-   private void setMuteModeButtonImage(boolean notify) {
-      String fmMutedString;
-      if (isMuted() == true)
-      {
-         mMuteButton.setImageResource(R.drawable.ic_silent_mode);
-         fmMutedString = "FM Radio Muted";
-      } else
-      {
-         /* Find a icon for Stations */
-         mMuteButton.setImageResource(R.drawable.ic_silent_mode_off);
-         fmMutedString = "FM Radio Playing";
-      }
-      if (notify)
-      {
-         //Toast.makeText(this, fmMutedString, Toast.LENGTH_SHORT).show();
-         Log.d(LOGTAG, fmMutedString);
-      }
-   }
-
-   private void enableRadio() {
-      mIsScaning = false;
-      mIsSeeking = false;
-      mIsSearching=false;
-      boolean bStatus = false;
-      if (isHdmiOn())
-      {
-          showDialog(DIALOG_CMD_FAILED_HDMI_ON);
-      } else
-      {
-          if(mService != null)
-          {
-             try
-             {
-                if( false == mService.isFmOn() && isAntennaAvailable()) {
-                    bStatus = mService.fmOn();
-                    if(bStatus)
-                    {
-                          tuneRadio(FmSharedPreferences.getTunedFrequency());
-                          enableRadioOnOffUI();
-                    }
-                    else
-                    {
-                       Log.e(LOGTAG, " mService.fmOn failed");
-                       mCommandFailed = CMD_FMON;
-                       if( isCallActive() ) {
-                          enableRadioOnOffUI();
-                          showDialog(DIALOG_CMD_FAILED_CALL_ON);
-                       } else {
-                          showDialog(DIALOG_CMD_FAILED);
-                       }
-                    }
-                } else {
-                      enableRadioOnOffUI();
-                }
-             } catch (RemoteException e)
-             {
-                e.printStackTrace();
-             }
-          }
-      }
-   }
-
-   private void disableRadio() {
-      boolean bStatus = false;
-      boolean bSpeakerPhoneOn = isSpeakerEnabled();
-      cancelSearch();
-      endSleepTimer();
-      if( mRecording )
-      {
-         //Stop if there is an ongoing Record
-         stopRecording();
-      }
-      if(mService != null)
-      {
-         try
-         {
-            if( bSpeakerPhoneOn )
-            {
-                mService.enableSpeaker(false);
-            }
-            bStatus = mService.fmOff();
-            enableRadioOnOffUI();
-            if(bStatus == false)
-            {
-               mCommandFailed = CMD_FMOFF;
-               Log.e(LOGTAG, " mService.fmOff failed");
-               //showDialog(DIALOG_CMD_FAILED);
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   }
-
-   private void resetRadio() {
-      boolean bSpeakerPhoneOn = isSpeakerEnabled();
-      resetSearch();
-      endSleepTimer();
-      if(mRecording)
-      {
-         //Stop if there is an ongoing Record
-         stopRecording();
-      }
-      if(mService != null)
-      {
-         try
-         {
-            if(bSpeakerPhoneOn)
-            {
-                mService.enableSpeaker(false);
-            }
-            mService.fmRadioReset();
-            enableRadioOnOffUI(false);
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   }
-
-   public static boolean fmConfigure() {
-      boolean bStatus = true;
-      if(mService != null)
-      {
-         try
-         {
-            bStatus = mService.fmReconfigure();
-            if(bStatus == false)
-            {
-               mCommandFailed = CMD_FMCONFIGURE;
-               Log.e(LOGTAG, " mService.fmReconfigure failed");
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      return bStatus;
-   }
-  public static void fmAutoAFSwitch() {
-      boolean bStatus = false;
-      if(mService != null)
-      {
-         try
-         {
-            bStatus = mService.enableAutoAF(FmSharedPreferences.getAutoAFSwitch());
-            if(bStatus == false)
-            {
-               mCommandFailed = CMD_SET_AUTOAF;
-               Log.e(LOGTAG, " mService.enableAutoAF failed");
-               //showDialog(DIALOG_CMD_FAILED);
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   }
-   public static void fmAudioOutputMode() {
-      boolean bStatus = false;
-      if(mService != null)
-      {
-         try
-         {
-            bStatus = mService.enableStereo(FmSharedPreferences.getAudioOutputMode());
-            if(bStatus == false)
-            {
-               mCommandFailed = CMD_SET_AUDIO_MODE;
-               Log.e(LOGTAG, " mService.enableStereo failed");
-               //showDialog(DIALOG_CMD_FAILED);
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   }
-
-   private void startRecording() {
-      if(mService != null)
-      {
-         try
-         {
-           mService.startRecording();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   }
-
-   private void startRecordingTimer() {
-      mRecording = true;
-      int durationInMins = FmSharedPreferences.getRecordDuration();
-      Log.e(LOGTAG, " Fected duration:" + durationInMins );
-      initiateRecordDurationTimer( durationInMins );
-      invalidateOptionsMenu();
-   }
-   private void stopRecording() {
-       mRecording = false;
-       DebugToasts("Stopped Recording", Toast.LENGTH_SHORT);
-       if( null != mRecordUpdateHandlerThread) {
-           mRecordUpdateHandlerThread.interrupt();
-       }
-       if( null != mRecordingMsgTV ) {
-           mRecordingMsgTV.setVisibility(View.INVISIBLE);
-       }
-       if(mService != null) {
-           try
-           {
-              mService.stopRecording();
-           } catch (RemoteException e)
-           {
-              e.printStackTrace();
-           }
-        }
-        invalidateOptionsMenu();
-   }
-
-   private boolean isRecording() {
-      mRecording = false;
-      if(mService != null)
-      {
-         try
-         {
-             mRecording = mService.isFmRecordingOn();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      return(mRecording);
-   }
-
-   private boolean isSpeakerEnabled() {
-      boolean speakerEnabled = false;
-      if(mService != null)
-      {
-         try
-         {
-             speakerEnabled = mService.isSpeakerEnabled();
-         } catch (RemoteException e)
-         {
-             e.printStackTrace();
-         }
-      }
-      return(speakerEnabled);
-   }
-
-   private void addToPresets() {
-      int currentList = FmSharedPreferences.getCurrentListIndex();
-      PresetStation selectedStation = getCurrentTunedStation();
-      FmSharedPreferences.addStation(selectedStation.getName(), selectedStation
-                        .getFrequency(), currentList);
-      setupPresetLayout();
-   }
-
-   private void enableRadioOnOffUI() {
-      boolean bEnable = isFmOn();
-      /* Disable if no antenna/headset is available */
-      if(!isAntennaAvailable() )
-      {
-         bEnable = false;
-      }
-      enableRadioOnOffUI(bEnable);
-   }
-
-   private void enableRadioOnOffUI(boolean bEnable) {
-
-      if (mMuteButton != null) {
-         mMuteButton.setEnabled(bEnable);
-         setMuteModeButtonImage(false);
-      }
-      if (bEnable)
-      {
-         if (mTuneStationFrequencyTV != null) {
-            mTuneStationFrequencyTV.setOnLongClickListener(mFrequencyViewClickListener);
-         }
-         if (mRadioTextScroller != null) {
-            mRadioTextScroller.startScroll();
-         }
-         if (mSleepMsgTV != null && !isSleepTimerActive())
-         {
-            mSleepMsgTV.setText("");
-         }
-         if (mRecordingMsgTV != null && !isRecording())
-         {
-            mRecordingMsgTV.setText("");
-         }
-      } else
-      {
-         if (mTuneStationFrequencyTV != null) {
-            mTuneStationFrequencyTV.setOnLongClickListener(null);
-         }
-         if (mRadioTextScroller != null) {
-            mRadioTextScroller.stopScroll();
-         }
-      }
-
-      if (mForwardButton != null) {
-         mForwardButton.setVisibility(((bEnable == true) ? View.VISIBLE
-                                    : View.INVISIBLE));
-      }
-      if (mBackButton != null) {
-         mBackButton.setVisibility(((bEnable == true) ? View.VISIBLE
-                                 : View.INVISIBLE));
-      }
-      if (mTuneStationFrequencyTV != null) {
-         mTuneStationFrequencyTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                             : View.INVISIBLE));
-      }
-      if (mStationCallSignTV != null) {
-         mStationCallSignTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                        : View.INVISIBLE));
-      }
-      if (mProgramTypeTV != null) {
-         mProgramTypeTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                    : View.INVISIBLE));
-      }
-      if (mSleepMsgTV != null) {
-         mSleepMsgTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                 : View.INVISIBLE));
-      }
-      if (mRecordingMsgTV != null) {
-         mRecordingMsgTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                     : View.INVISIBLE));
-      }
-      if (mRadioTextTV != null) {
-         mRadioTextTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                  : View.INVISIBLE));
-      }
-      if(mERadioTextTV != null) {
-         mERadioTextTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                  : View.INVISIBLE));
-      }
-      if (mProgramServiceTV != null) {
-         mProgramServiceTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                  : View.INVISIBLE));
-      }
-
-      if (!isAntennaAvailable())
-      {
-         if (mRadioTextTV != null) {
-            mRadioTextTV.setVisibility(View.VISIBLE);
-            mRadioTextTV.setText(getString(R.string.msg_noantenna));
-            mRadioTextScroller.mOriginalString = getString(R.string.msg_noantenna);
-         }
-         if (mOnOffButton != null) {
-            mOnOffButton.setEnabled(false);
-         }
-      }
-      else if (isCallActive())
-      {
-         if (mRadioTextTV != null) {
-            mRadioTextTV.setText("");
-            mRadioTextScroller.mOriginalString = "";
-         }
-         if (mERadioTextTV != null)
-             mERadioTextTV.setText("");
-         if (mOnOffButton != null) {
-            mOnOffButton.setEnabled(false);
-         }
-      }
-      else
-      {
-         if (mRadioTextTV != null) {
-            mRadioTextTV.setText("");
-            mRadioTextScroller.mOriginalString = "";
-         }
-         if (mERadioTextTV != null)
-             mERadioTextTV.setText("");
-         if (mOnOffButton != null) {
-            mOnOffButton.setEnabled(true);
-         }
-      }
-
-      /* Disable displaying RSSI */
-      //mRSSI.setVisibility(((bEnable == true) ? View.VISIBLE
-      //                : View.INVISIBLE));
-      if (mStereoTV != null) {
-         mStereoTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                               : View.INVISIBLE));
-      }
-      for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++)
-      {
-         if (mPresetButtons[nButton] != null) {
-            mPresetButtons[nButton].setEnabled(bEnable);
-         }
-      }
-      if (mPresetListButton != null) {
-         mPresetListButton.setEnabled(bEnable);
-      }
-      if (mPresetPageButton != null) {
-         mPresetPageButton.setEnabled(bEnable &&
-                                   (FmSharedPreferences.getListStationCount() >= MAX_PRESETS_PER_PAGE));
-      }
-   }
-
-   private void resetSearchProgress() {
-      Message msg = new Message();
-      msg.what = END_PROGRESS_DLG;
-      mSearchProgressHandler.sendMessage(msg);
-   }
-
-   private void updateSearchProgress() {
-      boolean searchActive = isScanActive() || isSeekActive() || isSearchActive();
-      if(searchActive)
-      {
-         synchronized (this)
-         {
-            if(mProgressDialog == null)
-            {
-               showDialog(DIALOG_PROGRESS_PROGRESS);
-            }
-            else
-            {
-               Message msg = new Message();
-               msg.what = UPDATE_PROGRESS_DLG;
-               mSearchProgressHandler.sendMessage(msg);
-            }
-         }
-      }
-      else
-      {
-         Message msg = new Message();
-         msg.what = END_PROGRESS_DLG;
-         mSearchProgressHandler.sendMessage(msg);
-      }
-   }
-
-   private void setupPresetLayout() {
-      int numStations = FmSharedPreferences.getListStationCount();
-      int addedStations = 0;
-
-      /*
-       * Validate mPresetPageNumber (Preset Page Number)
-       */
-      if (mPresetPageNumber > ((numStations) / MAX_PRESETS_PER_PAGE))
-      {
-         mPresetPageNumber = 0;
-      }
-
-      /*
-       * For every station, save the station as a tag and update the display
-       * on the preset Button.
-       */
-      for (int buttonIndex = 0; (buttonIndex < MAX_PRESETS_PER_PAGE); buttonIndex++)
-      {
-         if (mPresetButtons[buttonIndex] != null)
-         {
-            int stationIdex = (mPresetPageNumber * MAX_PRESETS_PER_PAGE)
-                              + buttonIndex;
-            PresetStation station = FmSharedPreferences.getStationInList(stationIdex);
-            String display = "";
-            if (station != null)
-            {
-               display = station.getName();
-               mPresetButtons[buttonIndex].setText(display);
-               mPresetButtons[buttonIndex].setTag(station);
-               addedStations++;
-            } else
-            {
-               mPresetButtons[buttonIndex].setText(display);
-               mPresetButtons[buttonIndex].setTag(station);
-            }
-         }
-      }
-      /*
-       * Enable "Next" Page: Only if more than 4 presets are added,
-       * else there is nothing more
-       */
-      mPresetPageButton.setEnabled(isFmOn() && (numStations >= MAX_PRESETS_PER_PAGE));
-      mPresetListButton.setText(FmSharedPreferences.getListName(FmSharedPreferences
-                                                   .getCurrentListIndex()));
-   }
-
-   private void updateStationInfoToUI() {
-      double frequency = mTunedStation.getFrequency() / 1000.0;
-      mTuneStationFrequencyTV.setText("" + frequency);
-      mStationCallSignTV.setText(mTunedStation.getPIString());
-      mProgramTypeTV.setText(mTunedStation.getPtyString());
-      mRadioTextTV.setText("");
-      mERadioTextTV.setText("");
-      mRadioTextScroller.mOriginalString = "";
-      mRadioTextScroller.mStringlength = 0;
-      mRadioTextScroller.mIteration = 0;
-      mProgramServiceTV.setText("");
-      mStereoTV.setText("");
-      setupPresetLayout();
-   }
-
-
-   private boolean isFmOn() {
-      boolean bOn = false;
-      if(mService != null)
-      {
-         try
-         {
-            bOn = mService.isFmOn();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      return(bOn);
-   }
-
-   private boolean isAnalogModeEnabled() {
-      boolean aEnabled = false;
-      if (mService != null)
-      {
-          try
-          {
-             aEnabled = mService.isAnalogModeEnabled();
-          } catch (RemoteException e)
-          {
-             e.printStackTrace();
-          }
-      }
-      return (aEnabled);
-   }
-
-   private boolean isMuted() {
-      boolean bMuted = false;
-      if(mService != null)
-      {
-         try
-         {
-            bMuted = mService.isMuted();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      return(bMuted);
-   }
-
-   private boolean isScanActive() {
-      return(mIsScaning);
-   }
-
-   private boolean isSeekActive() {
-      return(mIsSeeking);
-   }
-   private boolean isSearchActive() {
-      return(mIsSearching);
-   }
-
-   public static PresetStation getCurrentTunedStation() {
-      return mTunedStation;
-   }
-
-   private void SeekPreviousStation() {
-      Log.d(LOGTAG, "SeekPreviousStation");
-      if(mService != null)
-      {
-         try
-         {
-            if(!isSeekActive())
-            {
-               mIsSeeking = mService.seek(false);
-               if(mIsSeeking == false)
-               {
-                  mCommandFailed = CMD_SEEK;
-                  Log.e(LOGTAG, " mService.seek failed");
-                  showDialog(DIALOG_CMD_FAILED);
-               }
-
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      updateSearchProgress();
-   }
-
-   private void SeekNextStation() {
-      Log.d(LOGTAG, "SeekNextStation");
-      if(mService != null)
-      {
-         try
-         {
-            if(!isSeekActive())
-            {
-               mIsSeeking = mService.seek(true);
-               if(mIsSeeking == false)
-               {
-                  mCommandFailed = CMD_SEEK;
-                  Log.e(LOGTAG, " mService.seek failed");
-                  showDialog(DIALOG_CMD_FAILED);
-               }
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      updateSearchProgress();
-   }
-
-   /** Scan related */
-   private void initiateSearch(int pty) {
-      synchronized (this)
-      {
-         mIsScaning = true;
-         if(mService != null)
-         {
-            try
-            {
-               mIsScaning = mService.scan(pty);
-               if(mIsScaning == false)
-               {
-                  mCommandFailed = CMD_SCAN;
-                  Log.e(LOGTAG, " mService.scan failed");
-                  showDialog(DIALOG_CMD_FAILED);
-               }
-               else
-               {
-                  mScanPty = pty;
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-            updateSearchProgress();
-         }
-      }
-   }
-
-   /** SEEK Station with the matching PI */
-   private void initiatePISearch(int pi) {
-      Log.d(LOGTAG, "initiatePISearch");
-      if(mService != null)
-      {
-         try
-         {
-            if(!isSeekActive())
-            {
-               mIsSeeking = mService.seekPI(pi);
-               if(mIsSeeking == false)
-               {
-                  mCommandFailed = CMD_SEEKPI;
-                  Log.e(LOGTAG, " mService.seekPI failed");
-                  showDialog(DIALOG_CMD_FAILED);
-               }
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      updateSearchProgress();
-   }
-
-   private void resetSearch() {
-      mIsScaning = false;
-      mIsSeeking = false;
-      mIsSearching = false;
-      resetSearchProgress();
-   }
-
-   private void cancelSearch() {
-      synchronized (this)
-      {
-         if(mService != null)
-         {
-            try
-            {
-               if( (mIsScaning == true)
-                  || (mIsSeeking == true)
-                  || (mIsSearching == true))
-               {
-                  mService.cancelSearch();
-                  mIsScaning = false;
-                  mIsSeeking = false;
-                  mIsSearching=false;
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-      updateSearchProgress();
-   }
-
-   /** get Strongest Stations */
-   private void initiateSearchList() {
-      synchronized (this)
-      {
-         mIsSearching = false;
-         if(mService != null)
-         {
-            try
-            {
-               mIsSearching = mService.searchStrongStationList(NUM_AUTO_PRESETS_SEARCH);
-               if(mIsSearching == false)
-               {
-                  mCommandFailed = CMD_SEARCHLIST;
-                  Log.e(LOGTAG, " mService.searchStrongStationList failed");
-                  showDialog(DIALOG_CMD_FAILED);
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-            updateSearchProgress();
-         }
-      }
-   }
-
-   private static final int UPDATE_PROGRESS_DLG = 1;
-   private static final int END_PROGRESS_DLG = 2;
-   private static final int TIMEOUT_PROGRESS_DLG = 3;
-   private static final int SHOWBUSY_TIMEOUT = 300000;
-   private Handler mSearchProgressHandler = new Handler() {
-       public void handleMessage(Message msg) {
-           if (msg.what == UPDATE_PROGRESS_DLG) {
-              //Log.d(LOGTAG, "mTimeoutHandler: UPDATE_PROGRESS_DLG");
-              if(mProgressDialog != null)
-              {
-                 double frequency = mTunedStation.getFrequency() / 1000.0;
-                 String titleStr = getString(R.string.msg_search_title, ("" + frequency));
-
-                 mProgressDialog.setTitle(titleStr);
-              }
-           }
-           else if (msg.what == END_PROGRESS_DLG) {
-              //Log.d(LOGTAG, "mTimeoutHandler: END_PROGRESS_DLG");
-              mSearchProgressHandler.removeMessages(END_PROGRESS_DLG);
-              mSearchProgressHandler.removeMessages(UPDATE_PROGRESS_DLG);
-              mSearchProgressHandler.removeMessages(TIMEOUT_PROGRESS_DLG);
-              removeDialog(DIALOG_PROGRESS_PROGRESS);
-              mProgressDialog=null;
-           }
-           else if(msg.what == TIMEOUT_PROGRESS_DLG) {
-              cancelSearch();
-           }
-       }
-   };
-
-   /** Sleep Handling: After the timer expires, the app needs to shut down */
-   private static final int SLEEPTIMER_EXPIRED = 0x1001;
-   private static final int SLEEPTIMER_UPDATE = 0x1002;
-   private Thread mSleepUpdateHandlerThread = null;
-   /*
-    * Phone time when the App has to be shut down, calculated based on what the
-    * user configured
-    */
-   private static long mSleepAtPhoneTime = 0;
-
-   private void initiateSleepTimer(long seconds) {
-      mSleepAtPhoneTime = (SystemClock.elapsedRealtime()) + (seconds * 1000);
-      Log.d(LOGTAG, "Sleep in seconds : " + seconds);
-      initiateSleepThread();
-   }
-   private void initiateSleepThread() {
-      if (mSleepUpdateHandlerThread == null)
-      {
-         mSleepUpdateHandlerThread = new Thread(null, doSleepProcessing,
-                                                "SleepUpdateThread");
-      }
-      /* Launch he dummy thread to simulate the transfer progress */
-      Log.d(LOGTAG, "Thread State: " + mSleepUpdateHandlerThread.getState());
-      if (mSleepUpdateHandlerThread.getState() == Thread.State.TERMINATED)
-      {
-         mSleepUpdateHandlerThread = new Thread(null, doSleepProcessing,
-                                                "SleepUpdateThread");
-      }
-      /* If the thread state is "new" then the thread has not yet started */
-      if (mSleepUpdateHandlerThread.getState() == Thread.State.NEW)
-      {
-         mSleepUpdateHandlerThread.start();
-      }
-   }
-
-   private void endSleepTimer() {
-      mSleepAtPhoneTime = 0;
-      if( null != mSleepUpdateHandlerThread) {
-          mSleepUpdateHandlerThread.interrupt();
-      }
-      if( null != mSleepMsgTV ) {
-          mSleepMsgTV.setVisibility(View.INVISIBLE);
-      }
-      // Log.d(LOGTAG, "endSleepTimer");
-   }
-
-   private boolean hasSleepTimerExpired() {
-      boolean expired = true;
-      if (isSleepTimerActive())
-      {
-         long timeNow = ((SystemClock.elapsedRealtime()));
-         //Log.d(LOGTAG, "hasSleepTimerExpired - " + mSleepAtPhoneTime + " now: "+ timeNow);
-         if (timeNow < mSleepAtPhoneTime)
-         {
-            expired = false;
-         }
-      }
-      return expired;
-   }
-
-   private boolean isSleepTimerActive() {
-      boolean active = false;
-      if (mSleepAtPhoneTime > 0)
-      {
-         active = true;
-      }
-      return active;
-   }
-
-   private void updateExpiredSleepTime() {
-      int vis = View.INVISIBLE;
-      if (isSleepTimerActive())
-      {
-         long timeNow = ((SystemClock.elapsedRealtime()));
-         if (mSleepAtPhoneTime >= timeNow)
-         {
-            long seconds = (mSleepAtPhoneTime - timeNow) / 1000;
-            String sleepMsg = makeTimeString(seconds);
-            //Log.d(LOGTAG, "updateExpiredSleepTime: " + sleepMsg);
-            mSleepMsgTV.setText(sleepMsg);
-            if (seconds < SLEEP_TOGGLE_SECONDS)
-            {
-               int nowVis = mSleepMsgTV.getVisibility();
-               vis = (nowVis == View.INVISIBLE) ? View.VISIBLE
-                     : View.INVISIBLE;
-            } else
-            {
-               vis = View.VISIBLE;
-            }
-         } else
-         {
-            /* Clean up timer */
-            mSleepAtPhoneTime = 0;
-         }
-      }
-      mSleepMsgTV.setVisibility(vis);
-   }
-
-   private Handler mUIUpdateHandlerHandler = new Handler() {
-      public void handleMessage(Message msg) {
-         switch (msg.what)
-         {
-         case SLEEPTIMER_EXPIRED: {
-               mSleepAtPhoneTime = 0;
-               //Log.d(LOGTAG, "mUIUpdateHandlerHandler - SLEEPTIMER_EXPIRED");
-               DebugToasts("Turning Off FM Radio", Toast.LENGTH_SHORT);
-               disableRadio();
-               return;
-            }
-         case SLEEPTIMER_UPDATE: {
-               //Log.d(LOGTAG, "mUIUpdateHandlerHandler - SLEEPTIMER_UPDATE");
-               updateExpiredSleepTime();
-               break;
-            }
-         case RECORDTIMER_EXPIRED: {
-               Log.d(LOGTAG, "mUIUpdateHandlerHandler - RECORDTIMER_EXPIRED");
-               //Clear the Recorder text
-               mRecordingMsgTV.setText("");
-               if (mRecording != false)
-               {
-                  DebugToasts("Stop Recording", Toast.LENGTH_SHORT);
-                  stopRecording();
-               }
-              return;
-            }
-         case RECORDTIMER_UPDATE: {
-               Log.d(LOGTAG, "mUIUpdateHandlerHandler - RECORDTIMER_UPDATE");
-               updateExpiredRecordTime();
-               break;
-            }
-         default:
-            break;
-         }
-         super.handleMessage(msg);
-      }
-   };
-
-   /* Thread processing */
-   private Runnable doSleepProcessing = new Runnable() {
-      public void run() {
-         boolean sleepTimerExpired = hasSleepTimerExpired();
-         while ((sleepTimerExpired == false)&& (!Thread.currentThread().isInterrupted()) )
-         {
-            try
-            {
-               Thread.sleep(500);
-               Message statusUpdate = new Message();
-               statusUpdate.what = SLEEPTIMER_UPDATE;
-               mUIUpdateHandlerHandler.sendMessage(statusUpdate);
-               sleepTimerExpired = hasSleepTimerExpired();
-            }catch ( Exception ex ) {
-                Log.d( LOGTAG,  "RunningThread InterruptedException");
-                Thread.currentThread().interrupt();
-            }//try
-         }
-         if( true == sleepTimerExpired) {
-             Message finished = new Message();
-             finished.what = SLEEPTIMER_EXPIRED;
-             mUIUpdateHandlerHandler.sendMessage(finished);
-         }
-      }
-   };
-
-   private static StringBuilder sFormatBuilder = new StringBuilder();
-   private static Formatter sFormatter = new Formatter(sFormatBuilder, Locale
-                                                       .getDefault());
-   private static final Object[] sTimeArgs = new Object[5];
-
-   private String makeTimeString(long secs) {
-      String durationformat = getString(R.string.durationformat);
-
-      /*
-       * Provide multiple arguments so the format can be changed easily by
-       * modifying the xml.
-       */
-      sFormatBuilder.setLength(0);
-
-      final Object[] timeArgs = sTimeArgs;
-      timeArgs[0] = secs / 3600;
-      timeArgs[1] = secs / 60;
-      timeArgs[2] = (secs / 60) % 60;
-      timeArgs[3] = secs;
-      timeArgs[4] = secs % 60;
-
-      return sFormatter.format(durationformat, timeArgs).toString();
-   }
-
-   private void tuneRadio(int frequency){
-      /* Issue the tune command only if tuneCommand is already not active */
-      if( (mService != null) && (mCommandActive != CMD_TUNE) &&  isFmOn() )
-      {
-         boolean bStatus = false;
-         try
-         {
-
-            bStatus = mService.tune(frequency);
-            if(bStatus)
-            {
-               postTimeoutHandler(CMD_TUNE);
-            }
-            else
-            {
-               if(isFmOn())
-               {
-                 mCommandFailed = CMD_TUNE;
-                 Log.e(LOGTAG, " mService.tune failed");
-                 showDialog(DIALOG_CMD_FAILED);
-               }
-            }
-            mTunedStation.setName("");
-            mTunedStation.setPI(0);
-            mTunedStation.setPty(0);
-            updateStationInfoToUI();
-         }
-         catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      else
-      {
-          Log.e(LOGTAG, "Delayed Tune handler stopped");
-      }
-   }
-
-   /* Start a Command timeout
-   */
-   private synchronized void postTimeoutHandler(int cmd){
-
-      mCommandActive = cmd;
-      mCommandTimeoutHandler.sendEmptyMessageDelayed (MSG_CMD_TIMEOUT, CMD_TIMEOUT_DELAY_MS);
-   }
-
-   /* Stop the Command timeout
-   */
-   private synchronized void cleanupTimeoutHandler(){
-      mCommandActive = CMD_NONE;
-      mCommandTimeoutHandler.removeMessages(MSG_CMD_TIMEOUT);
-   }
-   /* Command timeout Handler
-      Routine to handle the Command timeouts for FM operations
-      that return asynchronous event callbacks
-   */
-   private Handler mCommandTimeoutHandler = new Handler() {
-      @Override
-      public void handleMessage(Message msg) {
-         switch (msg.what)
-         {
-         case MSG_CMD_TIMEOUT:
-            {
-               if (mCommandActive>0)
-               {
-                  Log.d(LOGTAG, "mCommandTimeoutHandler: Cmd failed : "+mCommandActive);
-                  mCommandTimeoutHandler.removeMessages(MSG_CMD_TIMEOUT);
-                  showDialog(DIALOG_CMD_TIMEOUT);
-                  return;
-               }
-               break;
-            }//case MSG_CMD_TIMEOUT
-         }//switch
-      }//handleMessage
-   };
-
-   @Override
-   public boolean onKeyDown(int keyCode, KeyEvent event) {
-        Log.d(LOGTAG, "KEY event received"+keyCode);
-       switch (keyCode) {
-           case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-           case 126: //KeyEvent.KEYCODE_MEDIA_PLAY:
-           case 127: //KeyEvent.KEYCODE_MEDIA_PAUSE:
-           case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
-           case KeyEvent.KEYCODE_MEDIA_NEXT:
-           case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-           case KeyEvent.KEYCODE_MEDIA_REWIND:
-           case KeyEvent.KEYCODE_MEDIA_STOP:
-               return true;
-       }
-       return super.onKeyDown(keyCode, event);
-   }
-   private void resetFMStationInfoUI()
-   {
-      mTunedStation.setFrequency(FmSharedPreferences.getTunedFrequency());
-      mTunedStation.setName("");
-      mTunedStation.setPI(0);
-      mTunedStation.setRDSSupported(false);
-      //mTunedStation.setPI(20942);
-      mTunedStation.setPty(0);
-      mRadioTextTV.setText("");
-      mERadioTextTV.setText("");
-      mRadioTextScroller.mOriginalString = "";
-      mProgramServiceTV.setText("");
-      mRadioTextScroller.stopScroll();
-      updateStationInfoToUI();
-   }
-
-   final Runnable mRadioEnabled = new Runnable() {
-      public void run() {
-         /* Update UI to FM On State */
-         enableRadioOnOffUI(true);
-         /* Tune to the last tuned frequency */
-         tuneRadio(FmSharedPreferences.getTunedFrequency());
-      }
-   };
-
-   final Runnable mRadioDisabled = new Runnable() {
-      public void run() {
-         /* Update UI to FM Off State */
-         cleanupTimeoutHandler();
-         endSleepTimer();
-         stopRecording();
-         cancelSearch();
-         enableRadioOnOffUI(false);
-      }
-   };
-   final Runnable mRadioReset = new Runnable() {
-      public void run() {
-         /* Update UI to FM Reset (Off) State */
-         resetRadio();
-      }
-   };
-
-   final Runnable mUpdateStationInfo = new Runnable() {
-      public void run() {
-         cleanupTimeoutHandler();
-         PresetStation station = new PresetStation("", FmSharedPreferences.getTunedFrequency());
-         if (station != null) {
-             mTunedStation.Copy(station);
-         }
-         updateSearchProgress();
-         resetFMStationInfoUI();
-      }
-   };
-
-   final Runnable mSearchComplete = new Runnable() {
-      public void run() {
-         Log.d(LOGTAG, "mSearchComplete: ");
-         mScanPty=0;
-         mIsScaning = false;
-         mIsSeeking = false;
-         mIsSearching = false;
-         updateSearchProgress();
-         resetFMStationInfoUI();
-      }
-   };
-
-   final Runnable mSearchListComplete = new Runnable() {
-      public void run() {
-         Log.d(LOGTAG, "mSearchListComplete: ");
-         mIsSearching = false;
-
-         /* Now get the list*/
-         if(mService != null)
-         {
-            try
-            {
-               int[] searchList = mService.getSearchList();
-               if (searchList != null)
-               {
-                  /* Add the stations into the preset list */
-                  int currentList = FmSharedPreferences.getCurrentListIndex();
-                  PresetList curList =
-                       FmSharedPreferences.getStationList(currentList);
-                  if (curList != null) {
-                     curList.clear();
-                  }
-                  mPresetPageNumber = 0;
-
-                  for( int station=0;
-                       (station < searchList.length) && (station < NUM_AUTO_PRESETS_SEARCH);
-                       station++)
-                  {
-                     int frequency = searchList[station];
-                     Log.d(LOGTAG, "mSearchListComplete: [" + station + "] = " +  frequency);
-                     if( (frequency <= FmSharedPreferences.getUpperLimit())
-                        && (frequency >= FmSharedPreferences.getLowerLimit()))
-                     {
-                        FmSharedPreferences.addStation("", searchList[station],currentList);
-                     }
-
-                     if(frequency == 0)
-                     {
-                        break;
-                     }
-                  }
-                  mPrefs.Save();
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-         updateSearchProgress();
-         resetFMStationInfoUI();
-         setupPresetLayout();
-      }
-   };
-
-   final Runnable mOnMute = new Runnable() {
-      public void run() {
-         setMuteModeButtonImage(true);
-      }
-   };
-
-   final Runnable mOnStereo = new Runnable() {
-      public void run() {
-         if(FMRADIO_UI_STATION_AUDIO_STEREO == mStereo)
-         {
-            mStereoTV.setText(R.string.audio_type_stereo);
-         }
-         else if(FMRADIO_UI_STATION_AUDIO_MONO == mStereo)
-         {
-            mStereoTV.setText(R.string.audio_type_mono);
-         }
-         else
-         {
-            mStereoTV.setText("");
-         }
-      }
-   };
-
-   final Runnable mUpdateRadioText = new Runnable() {
-      public void run() {
-         String str = "";
-         if(mService != null && isFmOn())
-         {
-            try
-            {
-               /* Get Radio Text and update the display */
-               str = mService.getRadioText();
-
-               /* Update only if all the characters are printable */
-               if (TextUtils.isPrintableAsciiOnly(str))
-               {
-                  Log.d(LOGTAG, "mUpdateRadioText: Updatable string: [" + str + "]");
-                  mRadioTextTV.setText(str);
-                  mRadioTextScroller.mOriginalString = str;
-               }
-               /* Rest the string to empty*/
-               else if (TextUtils.isEmpty(str))
-               {
-                  mRadioTextTV.setText("");
-                  mRadioTextScroller.mOriginalString = "";
-               } else
-               {
-                  //Log.d(LOGTAG, "mUpdateRadioText: Leaving old string " + mRadioTextTV.getText());
-               }
-
-               /* Get PTY and PI and update the display */
-               int tempInt =mService.getProgramType();
-               /* Save PTY */
-               mTunedStation.setPty(tempInt);
-               mProgramTypeTV.setText(PresetStation.parsePTY(tempInt));
-               tempInt =mService.getProgramID();
-               mStationCallSignTV.setText(PresetStation.parsePI(tempInt));
-               if(tempInt != 0)
-               {
-                  mTunedStation.setPI(tempInt);
-               }
-               /* For non-Empty, non-Printable string, just leave the
-                  existing old string
-               */
-               mRadioTextScroller.startScroll();
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   };
-
-   final Runnable mUpdateExtenRadioText = new Runnable() {
-      public void run() {
-         String str = "";
-         if(mService != null && isFmOn())
-         {
-            try
-            {
-               /* Get Extended Radio Text and update the display */
-               str = mService.getExtenRadioText();
-               if (TextUtils.isEmpty(str))
-                   mERadioTextTV.setText("");
-               else
-                   mERadioTextTV.setText(str);
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   };
-
-   /* Create runnable for posting */
-   final Runnable mUpdateProgramService = new Runnable() {
-      public void run() {
-         String str = "";
-         if(mService != null)
-         {
-            try
-            {
-               /* Get the Station PS and update the display */
-               str = mService.getProgramService();
-               /* Update only if all the characters are printable */
-               //if(isStringPrintable(str))
-               if (TextUtils.isPrintableAsciiOnly(str))
-               {
-                  Log.d(LOGTAG, "mUpdateProgramService: Updatable string: [" + str + "]");
-                  mProgramServiceTV.setText(str);
-               }
-               /* Rest the string to empty*/
-               else if (TextUtils.isEmpty(str))
-               {
-                  mProgramServiceTV.setText("");
-               } else
-               {
-                  /* For non-Empty, non-Printable string, just leave the
-                     existing old string
-                  */
-                  //Log.d(LOGTAG, "mUpdateProgramService: Leaving old string " + mProgramServiceTV.getText());
-               }
-               /* Get PTY and PI and update the display */
-               int tempInt =mService.getProgramType();
-               /* Save PTY */
-               mTunedStation.setPty(tempInt);
-
-               mProgramTypeTV.setText(PresetStation.parsePTY(tempInt));
-               tempInt =mService.getProgramID();
-               /* Save the program ID */
-               if(tempInt != 0)
-               {
-                  mTunedStation.setPI(tempInt);
-               }
-               mStationCallSignTV.setText(PresetStation.parsePI(tempInt));
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   };
-
-   private void DebugToasts(String str, int duration) {
-      //Toast.makeText(this, str, duration).show();
-      Log.d(LOGTAG, "Debug:" + str);
-   }
-
-   /**
-    * This Handler will scroll the text view.
-    * On startScroll, the scrolling starts after SCROLLER_START_DELAY_MS
-    * The Text View is scrolled left one character after every
-    * SCROLLER_UPDATE_DELAY_MS
-    * When the entire text is scrolled, the scrolling will restart
-    * after SCROLLER_RESTART_DELAY_MS
-    */
-   private static final class ScrollerText extends Handler
-   {
-
-      private static final byte SCROLLER_STOPPED = 0x51;
-      private static final byte SCROLLER_STARTING = 0x52;
-      private static final byte SCROLLER_RUNNING = 0x53;
-
-      private static final int SCROLLER_MSG_START   = 0xF1;
-      private static final int SCROLLER_MSG_TICK    = 0xF2;
-      private static final int SCROLLER_MSG_RESTART = 0xF3;
-
-      private static final int SCROLLER_START_DELAY_MS = 1000;
-      private static final int SCROLLER_RESTART_DELAY_MS = 3000;
-      private static final int SCROLLER_UPDATE_DELAY_MS = 200;
-
-      private final WeakReference<TextView> mView;
-
-      private byte mStatus = SCROLLER_STOPPED;
-      String mOriginalString;
-      int    mStringlength=0;
-      int    mIteration=0;
-
-      ScrollerText(TextView v) {
-         mView = new WeakReference<TextView>(v);
-      }
-
-      /**
-       * Scrolling Message Handler
-       */
-      @Override
-      public void handleMessage(Message msg) {
-         switch (msg.what)
-         {
-         case SCROLLER_MSG_START:
-            mStatus = SCROLLER_RUNNING;
-            updateText();
-            break;
-         case SCROLLER_MSG_TICK:
-            updateText();
-            break;
-         case SCROLLER_MSG_RESTART:
-            if (mStatus == SCROLLER_RUNNING)
-            {
-               startScroll();
-            }
-            break;
-         }
-      }
-
-      /**
-       * Moves the text left by one character and posts a
-       * delayed message for next update after SCROLLER_UPDATE_DELAY_MS.
-       * If the entire string is scrolled, then it displays the entire string
-       * and waits for SCROLLER_RESTART_DELAY_MS for scrolling restart
-       */
-      void updateText() {
-         if (mStatus != SCROLLER_RUNNING)
-         {
-            return;
-         }
-
-         removeMessages(SCROLLER_MSG_TICK);
-
-         final TextView textView = mView.get();
-         if (textView != null)
-         {
-            String szStr2 = "";
-            if (mStringlength > 0)
-            {
-               mIteration++;
-               if (mIteration >= mStringlength)
-               {
-                  mIteration = 0;
-                  sendEmptyMessageDelayed(SCROLLER_MSG_RESTART, SCROLLER_RESTART_DELAY_MS);
-               } else
-               {
-                  sendEmptyMessageDelayed(SCROLLER_MSG_TICK, SCROLLER_UPDATE_DELAY_MS);
-               }
-               //String szStr1 = mOriginalString.substring(0, mTick);
-               if ((mOriginalString !=null) && (mOriginalString.length() >= mIteration))
-                  szStr2 = mOriginalString.substring(mIteration);
-            }
-            //textView.setText(szStr2+"     "+szStr1);
-            textView.setText(szStr2);
-         }
-      }
-
-      /**
-       * Stops the scrolling
-       * The textView will be set to the original string.
-       */
-      void stopScroll() {
-         mStatus = SCROLLER_STOPPED;
-         removeMessages(SCROLLER_MSG_TICK);
-         removeMessages(SCROLLER_MSG_RESTART);
-         removeMessages(SCROLLER_MSG_START);
-         resetScroll();
-      }
-
-      /**
-       * Resets the scroll to display the original string.
-       */
-      private void resetScroll() {
-         mIteration = 0;
-         final TextView textView = mView.get();
-         if (textView != null)
-         {
-            textView.setText(mOriginalString);
-         }
-      }
-
-      /** Starts the Scrolling of the TextView after a
-       * delay of SCROLLER_START_DELAY_MS
-       * Starts only if Length > 0
-       */
-      void startScroll() {
-         final TextView textView = mView.get();
-         if (textView != null)
-         {
-            mOriginalString = (String) textView.getText();
-            mStringlength = mOriginalString.length();
-            if (mStringlength > 0)
-            {
-               mStatus = SCROLLER_STARTING;
-               sendEmptyMessageDelayed(SCROLLER_MSG_START, SCROLLER_START_DELAY_MS);
-            }
-         }
-      }
-   }
-
-
-   public static IFMRadioService sService = null;
-   private static HashMap<Context, ServiceBinder> sConnectionMap = new HashMap<Context, ServiceBinder>();
-
-   public static boolean bindToService(Context context) {
-      Log.e(LOGTAG, "bindToService: Context");
-      return bindToService(context, null);
-   }
-
-   public static boolean bindToService(Context context, ServiceConnection callback) {
-      Log.e(LOGTAG, "bindToService: Context with serviceconnection callback");
-      context.startService(new Intent(context, FMRadioService.class));
-      ServiceBinder sb = new ServiceBinder(callback);
-      sConnectionMap.put(context, sb);
-      return context.bindService((new Intent()).setClass(context,
-                                                         FMRadioService.class), sb, 0);
-   }
-
-   public static void unbindFromService(Context context) {
-      ServiceBinder sb = (ServiceBinder) sConnectionMap.remove(context);
-      Log.e(LOGTAG, "unbindFromService: Context");
-      if (sb == null)
-      {
-         Log.e(LOGTAG, "Trying to unbind for unknown Context");
-         return;
-      }
-      context.unbindService(sb);
-      if (sConnectionMap.isEmpty())
-      {
-         // presumably there is nobody interested in the service at this point,
-         // so don't hang on to the ServiceConnection
-         sService = null;
-      }
-   }
-
-   private static class ServiceBinder implements ServiceConnection
-   {
-      ServiceConnection mCallback;
-      ServiceBinder(ServiceConnection callback) {
-         mCallback = callback;
-      }
-
-      public void onServiceConnected(ComponentName className, android.os.IBinder service) {
-         sService = IFMRadioService.Stub.asInterface(service);
-         if (mCallback != null)
-         {
-            Log.e(LOGTAG, "onServiceConnected: mCallback");
-            mCallback.onServiceConnected(className, service);
-         }
-      }
-
-      public void onServiceDisconnected(ComponentName className) {
-         if (mCallback != null)
-         {
-            mCallback.onServiceDisconnected(className);
-         }
-         sService = null;
-      }
-   }
-
-   private ServiceConnection osc = new ServiceConnection() {
-      public void onServiceConnected(ComponentName classname, IBinder obj) {
-         mService = IFMRadioService.Stub.asInterface(obj);
-         Log.e(LOGTAG, "ServiceConnection: onServiceConnected: ");
-         if (mService != null)
-         {
-            try
-            {
-               mService.registerCallbacks(mServiceCallbacks);
-               if(SavedDataAndState == null) {
-                  enableRadio();
-               } else if(SavedDataAndState.onOrOff){
-                  enableRadioOnOffUI(true);
-               } else {
-                  enableRadioOnOffUI(false);
-               }
-            } catch (RemoteException e)
-            {
-               e.printStackTrace();
-            }
-            if(isRecording()) {
-                initiateRecordThread();
-            }
-            return;
-         } else
-         {
-            Log.e(LOGTAG, "IFMRadioService onServiceConnected failed");
-         }
-         if (getIntent().getData() == null)
-         {
-            Intent intent = new Intent(Intent.ACTION_MAIN);
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            intent.setClass(FMRadio.this, FMRadio.class);
-            startActivity(intent);
-         }
-         finish();
-      }
-      public void onServiceDisconnected(ComponentName classname) {
-      }
-   };
-
-   private IFMRadioServiceCallbacks.Stub  mServiceCallbacks = new IFMRadioServiceCallbacks.Stub()
-   {
-      public void onEnabled()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onEnabled :");
-         mHandler.post(mRadioEnabled);
-      }
-
-      public void onDisabled()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onDisabled :");
-         mHandler.post(mRadioDisabled);
-      }
-      public void onRadioReset()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onRadioReset :");
-         mHandler.post(mRadioReset);
-      }
-
-      public void onTuneStatusChanged()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onTuneStatusChanged :");
-         cleanupTimeoutHandler();
-         mHandler.post(mUpdateStationInfo);
-      }
-
-      public void onProgramServiceChanged()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onProgramServiceChanged :");
-         mHandler.post(mUpdateProgramService);
-      }
-
-      public void onRadioTextChanged()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onRadioTextChanged :");
-         mHandler.post(mUpdateRadioText);
-      }
-      public void onExtenRadioTextChanged()
-      {
-         mHandler.post(mUpdateExtenRadioText);
-      }
-      public void onAlternateFrequencyChanged()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onAlternateFrequencyChanged :");
-      }
-
-      public void onSignalStrengthChanged()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onSignalStrengthChanged :");
-      }
-
-      public void onSearchComplete()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onSearchComplete :");
-         mHandler.post(mSearchComplete);
-      }
-      public void onSearchListComplete()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onSearchListComplete :");
-         mHandler.post(mSearchListComplete);
-      }
-
-      public void onMute(boolean bMuted)
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onMute :" + bMuted);
-         mHandler.post(mOnMute);
-      }
-
-      public void onAudioUpdate(boolean bStereo)
-      {
-         if((bStereo) && (FmSharedPreferences.getAudioOutputMode()))
-         {
-            mStereo = FMRADIO_UI_STATION_AUDIO_STEREO;
-         }
-         else
-         {
-            mStereo = FMRADIO_UI_STATION_AUDIO_MONO;
-
-         }
-         Log.d(LOGTAG, "mServiceCallbacks.onAudioUpdate :" + mStereo);
-         mHandler.post(mOnStereo);
-      }
-
-      public void onStationRDSSupported(boolean bRDSSupported)
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onStationRDSSupported :" + bRDSSupported);
-         /*
-         * Depending on the signal strength etc, RDS Lock Sync/Supported may toggle,
-         * Since if a station Supports RDS, it will not change its support intermittently
-         * just save the status and ignore any "unsupported" state.
-         */
-         if(bRDSSupported)
-         {
-            mTunedStation.setRDSSupported(true);
-         }
-      }
-      public void onRecordingStopped()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onRecordingStopped:");
-         stopRecording();
-      }
-      public void onRecordingStarted()
-      {
-         Log.d(LOGTAG, "mServiceCallbacks.onRecordingStarted:");
-         startRecordingTimer();
-      }
-   };
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMRadioService.java b/fmapp/src/com/codeaurora/fmradio/FMRadioService.java
deleted file mode 100644
index db64782..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMRadioService.java
+++ /dev/null
@@ -1,2998 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import java.io.File;
-import java.util.*;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-
-import android.app.AlarmManager;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-import android.media.AudioManager;
-import android.media.AudioManager.OnAudioFocusChangeListener;
-import android.media.AudioSystem;
-import android.media.MediaRecorder;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.PowerManager;
-import android.os.PowerManager.WakeLock;
-import android.os.RemoteException;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-import android.widget.RemoteViews;
-import android.widget.Toast;
-import android.view.KeyEvent;
-import android.os.SystemProperties;
-
-import qcom.fmradio.FmReceiver;
-import qcom.fmradio.FmRxEvCallbacksAdaptor;
-import qcom.fmradio.FmRxRdsData;
-import qcom.fmradio.FmConfig;
-import android.net.Uri;
-import android.content.res.Resources;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import android.provider.MediaStore;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.database.Cursor;
-import com.codeaurora.utils.A2dpDeviceStatus;
-import android.media.AudioManager;
-import android.content.ComponentName;
-import android.os.StatFs;
-import android.os.SystemClock;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.app.IntentService;
-import android.os.UserHandle;
-import android.os.Process;
-import android.app.ActivityManager;
-import android.app.ActivityManager.RunningAppProcessInfo;
-
-/**
- * Provides "background" FM Radio (that uses the hardware) capabilities,
- * allowing the user to switch between activities without stopping playback.
- */
-public class FMRadioService extends Service
-{
-
-   public static final int RADIO_AUDIO_DEVICE_WIRED_HEADSET = 0;
-   public static final int RADIO_AUDIO_DEVICE_SPEAKER = 1;
-
-   private static final int FMRADIOSERVICE_STATUS = 101;
-   private static final String FMRADIO_DEVICE_FD_STRING = "/dev/radio0";
-   private static final String LOGTAG = "FMService";//FMRadio.LOGTAG;
-
-   private FmReceiver mReceiver;
-   private BroadcastReceiver mHeadsetReceiver = null;
-   private BroadcastReceiver mSdcardUnmountReceiver = null;
-   private BroadcastReceiver mMusicCommandListener = null;
-   private BroadcastReceiver mSleepExpiredListener = null;
-   private BroadcastReceiver mRecordTimeoutListener = null;
-   private BroadcastReceiver mDelayedServiceStopListener = null;
-   private boolean mOverA2DP = false;
-   private BroadcastReceiver mFmMediaButtonListener;
-   private IFMRadioServiceCallbacks mCallbacks;
-   private static FmSharedPreferences mPrefs;
-   private boolean mHeadsetPlugged = false;
-   private boolean mInternalAntennaAvailable = false;
-   private WakeLock mWakeLock;
-   private int mServiceStartId = -1;
-   private boolean mServiceInUse = false;
-   private static boolean mMuted = false;
-   private static boolean mResumeAfterCall = false;
-   private static String mAudioDevice="headset";
-   MediaRecorder mRecorder = null;
-   MediaRecorder mA2dp = null;
-   private boolean mFMOn = false;
-   private boolean mFmRecordingOn = false;
-   private boolean mSpeakerPhoneOn = false;
-   private int mCallStatus = 0;
-   private BroadcastReceiver mScreenOnOffReceiver = null;
-   final Handler mHandler = new Handler();
-   private boolean misAnalogModeSupported = false;
-   private boolean misAnalogPathEnabled = false;
-   private boolean mA2dpDisconnected = false;
-   //PhoneStateListener instances corresponding to each
-
-   private FmRxRdsData mFMRxRDSData=null;
-   // interval after which we stop the service when idle
-   private static final int IDLE_DELAY = 60000;
-   private File mA2DPSampleFile = null;
-   //Track FM playback for reenter App usecases
-   private boolean mPlaybackInProgress = false;
-   private boolean mStoppedOnFocusLoss = false;
-   private File mSampleFile = null;
-   long mSampleStart = 0;
-   // Messages handled in FM Service
-   private static final int FM_STOP =1;
-   private static final int RESET_NOTCH_FILTER =2;
-   private static final int STOPSERVICE_ONSLEEP = 3;
-   private static final int STOPRECORD_ONTIMEOUT = 4;
-   private static final int FOCUSCHANGE = 5;
-   //Track notch filter settings
-   private boolean mNotchFilterSet = false;
-   public static final int STOP_SERVICE = 0;
-   public static final int STOP_RECORD = 1;
-   // A2dp Device Status will be queried through this class
-   A2dpDeviceStatus mA2dpDeviceState = null;
-   private boolean mA2dpDeviceSupportInHal = false;
-   //on shutdown not to send start Intent to AudioManager
-   private boolean mAppShutdown = false;
-   private boolean mSingleRecordingInstanceSupported = false;
-   private AudioManager mAudioManager;
-   public static final long UNAVAILABLE = -1L;
-   public static final long PREPARING = -2L;
-   public static final long UNKNOWN_SIZE = -3L;
-   public static final long LOW_STORAGE_THRESHOLD = 50000000;
-   private long mStorageSpace;
-   private static final String IOBUSY_UNVOTE = "com.android.server.CpuGovernorService.action.IOBUSY_UNVOTE";
-   private static final String SLEEP_EXPIRED_ACTION = "com.codeaurora.fmradio.SLEEP_EXPIRED";
-   private static final String RECORD_EXPIRED_ACTION = "com.codeaurora.fmradio.RECORD_TIMEOUT";
-   private static final String SERVICE_DELAYED_STOP_ACTION = "com.codeaurora.fmradio.SERVICE_STOP";
-   public static final String ACTION_FM =
-               "codeaurora.intent.action.FM";
-   public static final String ACTION_FM_RECORDING =
-           "codeaurora.intent.action.FM_Recording";
-   public static final String ACTION_FM_RECORDING_STATUS =
-           "codeaurora.intent.action.FM.Recording.Status";
-   private String mFilePath = "";
-   private BroadcastReceiver mFmRecordingStatus  = null;
-   static final int RECORD_START = 1;
-   static final int RECORD_STOP = 0;
-
-   public FMRadioService() {
-   }
-
-   @Override
-   public void onCreate() {
-      super.onCreate();
-
-      mPrefs = new FmSharedPreferences(this);
-      mCallbacks = null;
-      TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-      tmgr.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE |
-                                       PhoneStateListener.LISTEN_DATA_ACTIVITY);
-      PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
-      mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getName());
-      mWakeLock.setReferenceCounted(false);
-      misAnalogModeSupported  = SystemProperties.getBoolean("ro.fm.analogpath.supported",false);
-      /* Register for Screen On/off broadcast notifications */
-      mA2dpDeviceState = new A2dpDeviceStatus(getApplicationContext());
-      registerScreenOnOffListener();
-      registerHeadsetListener();
-      registerSleepExpired();
-      registerRecordTimeout();
-      registerDelayedServiceStop();
-      registerFMRecordingStatus();
-      // registering media button receiver seperately as we need to set
-      // different priority for receiving media events
-      registerFmMediaButtonReceiver();
-      if ( false == SystemProperties.getBoolean("ro.fm.mulinst.recording.support",true)) {
-           mSingleRecordingInstanceSupported = true;
-      }
-
-      // Register for pause commands from other apps to stop FM
-      registerMusicServiceCommandReceiver();
-
-      // If the service was idle, but got killed before it stopped itself, the
-      // system will relaunch it. Make sure it gets stopped again in that case.
-      setAlarmDelayedServiceStop();
-      /* Query to check is a2dp supported in Hal */
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      String valueStr = audioManager.getParameters("isA2dpDeviceSupported");
-      mA2dpDeviceSupportInHal = valueStr.contains("=true");
-      Log.d(LOGTAG, " is A2DP device Supported In HAL"+mA2dpDeviceSupportInHal);
-   }
-
-   @Override
-   public void onDestroy() {
-      Log.d(LOGTAG, "onDestroy");
-      if (isFmOn())
-      {
-         Log.e(LOGTAG, "Service being destroyed while still playing.");
-      }
-
-      // make sure there aren't any other messages coming
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      cancelAlarms();
-      //release the audio focus listener
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      if (isMuted()) {
-          mMuted = false;
-          audioManager.setStreamMute(AudioManager.STREAM_MUSIC,false);
-      }
-      audioManager.abandonAudioFocus(mAudioFocusListener);
-      /* Remove the Screen On/off listener */
-      if (mScreenOnOffReceiver != null) {
-          unregisterReceiver(mScreenOnOffReceiver);
-          mScreenOnOffReceiver = null;
-      }
-      /* Unregister the headset Broadcase receiver */
-      if (mHeadsetReceiver != null) {
-          unregisterReceiver(mHeadsetReceiver);
-          mHeadsetReceiver = null;
-      }
-      if( mMusicCommandListener != null ) {
-          unregisterReceiver(mMusicCommandListener);
-          mMusicCommandListener = null;
-      }
-      if( mFmMediaButtonListener != null ) {
-          unregisterReceiver(mFmMediaButtonListener);
-          mFmMediaButtonListener = null;
-      }
-      if (mSleepExpiredListener != null ) {
-          unregisterReceiver(mSleepExpiredListener);
-          mSleepExpiredListener = null;
-      }
-      if (mRecordTimeoutListener != null) {
-          unregisterReceiver(mRecordTimeoutListener);
-          mRecordTimeoutListener = null;
-      }
-      if (mDelayedServiceStopListener != null) {
-          unregisterReceiver(mDelayedServiceStopListener);
-          mDelayedServiceStopListener = null;
-      }
-      if (mFmRecordingStatus != null ) {
-          unregisterReceiver(mFmRecordingStatus);
-          mFmRecordingStatus = null;
-      }
-      /* Since the service is closing, disable the receiver */
-      fmOff();
-
-      TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-      tmgr.listen(mPhoneStateListener, 0);
-
-      Log.d(LOGTAG, "onDestroy: unbindFromService completed");
-
-      //unregisterReceiver(mIntentReceiver);
-      mWakeLock.release();
-      super.onDestroy();
-   }
-
-   public void registerFMRecordingStatus() {
-         if (mFmRecordingStatus == null) {
-             mFmRecordingStatus = new BroadcastReceiver() {
-                 @Override
-                 public void onReceive(Context context, Intent intent) {
-                     Log.d(LOGTAG, "received intent " +intent);
-                     String action = intent.getAction();
-                     if (action.equals(ACTION_FM_RECORDING_STATUS)) {
-                         Log.d(LOGTAG, "ACTION_FM_RECORDING_STATUS Intent received");
-                         int state = intent.getIntExtra("state", 0);
-                         if (state == RECORD_START) {
-                             Log.d(LOGTAG, "FM Recording started");
-                             mFmRecordingOn = true;
-                             mSampleStart = SystemClock.elapsedRealtime();
-                             try {
-                                  if ((mServiceInUse) && (mCallbacks != null) ) {
-                                      Log.d(LOGTAG, "start recording thread");
-                                      mCallbacks.onRecordingStarted();
-                                  } 
-                             } catch (RemoteException e) {
-                                  e.printStackTrace();
-                             }
-                         } else if (state == RECORD_STOP) {
-                             Log.d(LOGTAG, "FM Recording stopped");
-                             mFmRecordingOn = false;
-                             try {
-                                  if ((mServiceInUse) && (mCallbacks != null) ) {
-                                     mCallbacks.onRecordingStopped();
-                                  }
-                             } catch (RemoteException e) {
-                                  e.printStackTrace();
-                             }
-                             mSampleStart = 0;
-                        }
-                     }
-                 }
-             };
-             IntentFilter iFilter = new IntentFilter();
-             iFilter.addAction(ACTION_FM_RECORDING_STATUS);
-             registerReceiver(mFmRecordingStatus , iFilter);
-         }
-   }
-
-     /**
-     * Registers an intent to listen for ACTION_HEADSET_PLUG
-     * notifications. This intent is called to know if the headset
-     * was plugged in/out
-     */
-    public void registerHeadsetListener() {
-        if (mHeadsetReceiver == null) {
-            mHeadsetReceiver = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    String action = intent.getAction();
-                    if (action.equals(Intent.ACTION_HEADSET_PLUG)) {
-                       Log.d(LOGTAG, "ACTION_HEADSET_PLUG Intent received");
-                       // Listen for ACTION_HEADSET_PLUG broadcasts.
-                       Log.d(LOGTAG, "mReceiver: ACTION_HEADSET_PLUG");
-                       Log.d(LOGTAG, "==> intent: " + intent);
-                       Log.d(LOGTAG, "    state: " + intent.getIntExtra("state", 0));
-                       Log.d(LOGTAG, "    name: " + intent.getStringExtra("name"));
-                       mHeadsetPlugged = (intent.getIntExtra("state", 0) == 1);
-                       // if headset is plugged out it is required to disable
-                       // in minimal duration to avoid race conditions with
-                       // audio policy manager switch audio to speaker.
-                       mHandler.removeCallbacks(mHeadsetPluginHandler);
-                       mHandler.post(mHeadsetPluginHandler);
-                    } else if(mA2dpDeviceState.isA2dpStateChange(action) ) {
-                        boolean  bA2dpConnected =
-                        mA2dpDeviceState.isConnected(intent);
-                        if (!bA2dpConnected) {
-                            Log.d(LOGTAG, "A2DP device is dis-connected!");
-                            mA2dpDisconnected = true;
-                        } else {
-                            mA2dpDisconnected = false;
-                        }
-                        if (isAnalogModeEnabled()) {
-                            Log.d(LOGTAG, "FM Audio Path is Analog Mode: FM Over BT not allowed");
-                            return ;
-                        }
-                       //when playback is overA2Dp and A2dp disconnected
-                       //when playback is not overA2DP and A2DP Connected
-                       // In above two cases we need to Stop and Start FM which
-                       // will take care of audio routing
-                       if( (isFmOn()) &&
-                           (true == ((bA2dpConnected)^(mOverA2DP))) &&
-                           (false == mStoppedOnFocusLoss) &&
-                           (!isSpeakerEnabled())) {
-                           stopFM();
-                           startFM();
-                       }
-                    } else if (action.equals("HDMI_CONNECTED")) {
-                        //FM should be off when HDMI is connected.
-                        fmOff();
-                        try
-                        {
-                            /* Notify the UI/Activity, only if the service is "bound"
-                               by an activity and if Callbacks are registered
-                             */
-                            if((mServiceInUse) && (mCallbacks != null) )
-                            {
-                                mCallbacks.onDisabled();
-                            }
-                        } catch (RemoteException e)
-                        {
-                            e.printStackTrace();
-                        }
-                    } else if( action.equals(Intent.ACTION_SHUTDOWN)) {
-                        mAppShutdown = true;
-                    }
-
-                }
-            };
-            IntentFilter iFilter = new IntentFilter();
-            iFilter.addAction(Intent.ACTION_HEADSET_PLUG);
-            iFilter.addAction(mA2dpDeviceState.getActionSinkStateChangedString());
-            iFilter.addAction("HDMI_CONNECTED");
-            iFilter.addAction(Intent.ACTION_SHUTDOWN);
-            iFilter.addCategory(Intent.CATEGORY_DEFAULT);
-            registerReceiver(mHeadsetReceiver, iFilter);
-        }
-    }
-
-    public void registerFmMediaButtonReceiver() {
-        if (mFmMediaButtonListener == null) {
-            mFmMediaButtonListener = new BroadcastReceiver() {
-                 public void onReceive(Context context, Intent intent) {
-                     Log.d(LOGTAG, "FMMediaButtonIntentReceiver.FM_MEDIA_BUTTON");
-                     Log.d(LOGTAG, "KeyEvent = " +intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT));
-                     String action = intent.getAction();
-                     if (action.equals(FMMediaButtonIntentReceiver.FM_MEDIA_BUTTON)) {
-                         KeyEvent event = (KeyEvent)
-                                     intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
-                         int keycode = event.getKeyCode();
-                         switch (keycode) {
-                             case KeyEvent.KEYCODE_HEADSETHOOK :
-                                 if (isFmOn()){
-                                     //FM should be off when Headset hook pressed.
-                                     fmOff();
-                                     if (isOrderedBroadcast()) {
-                                        abortBroadcast();
-                                     }
-                                     try {
-                                         /* Notify the UI/Activity, only if the service is "bound"
-                                            by an activity and if Callbacks are registered
-                                          */
-                                         if ((mServiceInUse) && (mCallbacks != null) ) {
-                                            mCallbacks.onDisabled();
-                                         }
-                                     } catch (RemoteException e) {
-                                         e.printStackTrace();
-                                     }
-                                 } else if( mServiceInUse ) {
-                                     fmOn();
-                                     if (isOrderedBroadcast()) {
-                                        abortBroadcast();
-                                     }
-                                     try {
-                                         /* Notify the UI/Activity, only if the service is "bound"
-                                            by an activity and if Callbacks are registered
-                                          */
-                                         if (mCallbacks != null ) {
-                                             mCallbacks.onEnabled();
-                                         }
-                                     } catch (RemoteException e) {
-                                         e.printStackTrace();
-                                     }
-                                 }
-                                 break;
-                             case KeyEvent.KEYCODE_MEDIA_PAUSE :
-                                 if (isFmOn()){
-                                     //FM should be off when Headset hook pressed.
-                                     fmOff();
-                                     if (isOrderedBroadcast()) {
-                                        abortBroadcast();
-                                     }
-                                     try {
-                                         /* Notify the UI/Activity, only if the service is "bound"
-                                            by an activity and if Callbacks are registered
-                                          */
-                                         if ((mServiceInUse) && (mCallbacks != null) ) {
-                                            mCallbacks.onDisabled();
-                                         }
-                                     } catch (RemoteException e) {
-                                         e.printStackTrace();
-                                     }
-                                 }
-                                 break;
-                             case KeyEvent.KEYCODE_MEDIA_PLAY:
-                                 if (isAntennaAvailable() && mServiceInUse ) {
-                                     fmOn();
-                                     if (isOrderedBroadcast()) {
-                                         abortBroadcast();
-                                     }
-                                     try {
-                                          /* Notify the UI/Activity, only if the service is "bound"
-                                             by an activity and if Callbacks are registered
-                                           */
-                                          if (mCallbacks != null ) {
-                                               mCallbacks.onEnabled();
-                                          }
-                                     } catch (RemoteException e) {
-                                          e.printStackTrace();
-                                     }
-                                 }
-                                 break;
-                         } // end of switch
-                     } // end of FMMediaButtonIntentReceiver.FM_MEDIA_BUTTON
-                 } // end of onReceive
-            };
-            IntentFilter iFilter = new IntentFilter();
-            iFilter.addAction(FMMediaButtonIntentReceiver.FM_MEDIA_BUTTON);
-            registerReceiver(mFmMediaButtonListener, iFilter);
-         }
-     }
-
-    public void registerMusicServiceCommandReceiver() {
-        if (mMusicCommandListener == null) {
-            mMusicCommandListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    String action = intent.getAction();
-
-                    if (action.equals("com.android.music.musicservicecommand")) {
-                        String cmd = intent.getStringExtra("command");
-                        Log.d(LOGTAG, "Music Service command : "+cmd+ " received");
-                        if (cmd != null && cmd.equals("pause")) {
-                            if (mA2dpDisconnected) {
-                                Log.d(LOGTAG, "not to pause,this is a2dp disconnected's pause");
-                                mA2dpDisconnected = false;
-                                return;
-                            }
-                            if(isFmOn()){
-                                fmOff();
-                                if (isOrderedBroadcast()) {
-                                    abortBroadcast();
-                                }
-                                try {
-                                    /* Notify the UI/Activity, only if the service is "bound"
-                                       by an activity and if Callbacks are registered
-                                    */
-                                    if((mServiceInUse) && (mCallbacks != null) ){
-                                        mCallbacks.onDisabled();
-                                    }
-                                } catch (RemoteException e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        }
-                    }
-                }
-            };
-            IntentFilter commandFilter = new IntentFilter();
-            commandFilter.addAction("com.android.music.musicservicecommand");
-            registerReceiver(mMusicCommandListener, commandFilter);
-        }
-    }
-    public void registerSleepExpired() {
-        if (mSleepExpiredListener == null) {
-            mSleepExpiredListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    Log.d(LOGTAG, "registerSleepExpired");
-                    mWakeLock.acquire(10 * 1000);
-                    fmOff();
-                }
-            };
-            IntentFilter intentFilter = new IntentFilter(SLEEP_EXPIRED_ACTION);
-            registerReceiver(mSleepExpiredListener, intentFilter);
-        }
-    }
-    public void registerRecordTimeout() {
-        if (mRecordTimeoutListener == null) {
-            mRecordTimeoutListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    Log.d(LOGTAG, "registerRecordTimeout");
-                    mWakeLock.acquire(5 * 1000);
-                    stopRecording();
-                }
-            };
-            IntentFilter intentFilter = new IntentFilter(RECORD_EXPIRED_ACTION);
-            registerReceiver(mRecordTimeoutListener, intentFilter);
-        }
-    }
-    public void registerDelayedServiceStop() {
-        if (mDelayedServiceStopListener == null) {
-            mDelayedServiceStopListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    Log.d(LOGTAG, "registerDelayedServiceStop");
-                    mWakeLock.acquire(5 * 1000);
-                    if (isFmOn() || mServiceInUse) {
-                        return;
-                    }
-                    stopSelf(mServiceStartId);
-                }
-            };
-            IntentFilter intentFilter = new IntentFilter(SERVICE_DELAYED_STOP_ACTION);
-            registerReceiver(mDelayedServiceStopListener, intentFilter);
-        }
-    }
-
-
-
-    final Runnable    mHeadsetPluginHandler = new Runnable() {
-        public void run() {
-            /* Update the UI based on the state change of the headset/antenna*/
-            if(!isAntennaAvailable())
-            {
-                /* Disable FM and let the UI know */
-                fmOff();
-                try
-                {
-                    /* Notify the UI/Activity, only if the service is "bound"
-                  by an activity and if Callbacks are registered
-                     */
-                    if((mServiceInUse) && (mCallbacks != null) )
-                    {
-                        mCallbacks.onDisabled();
-                    }
-                } catch (RemoteException e)
-                {
-                    e.printStackTrace();
-                }
-            }
-            else
-            {
-                /* headset is plugged back in,
-               So turn on FM if:
-               - FM is not already ON.
-               - If the FM UI/Activity is in the foreground
-                 (the service is "bound" by an activity
-                  and if Callbacks are registered)
-                 */
-                if ((!isFmOn()) && (mServiceInUse)
-                        && (mCallbacks != null))
-                {
-                    if( true != fmOn() ) {
-                        return;
-                    }
-                    try
-                    {
-                        mCallbacks.onEnabled();
-                    } catch (RemoteException e)
-                    {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-    };
-
-
-   @Override
-   public IBinder onBind(Intent intent) {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      cancelAlarms();
-      mServiceInUse = true;
-      /* Application/UI is attached, so get out of lower power mode */
-      setLowPowerMode(false);
-      Log.d(LOGTAG, "onBind");
-      return mBinder;
-   }
-
-   @Override
-   public void onRebind(Intent intent) {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      cancelAlarms();
-      mServiceInUse = true;
-      /* Application/UI is attached, so get out of lower power mode */
-      setLowPowerMode(false);
-      Log.d(LOGTAG, "onRebind");
-   }
-
-   @Override
-   public void onStart(Intent intent, int startId) {
-      Log.d(LOGTAG, "onStart");
-      mServiceStartId = startId;
-      // make sure the service will shut down on its own if it was
-      // just started but not bound to and nothing is playing
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      cancelAlarms();
-      setAlarmDelayedServiceStop();
-   }
-
-   @Override
-   public boolean onUnbind(Intent intent) {
-      mServiceInUse = false;
-      Log.d(LOGTAG, "onUnbind");
-
-      /* Application/UI is not attached, so go into lower power mode */
-      unregisterCallbacks();
-      setLowPowerMode(true);
-      if (isFmOn())
-      {
-         // something is currently playing, or will be playing once
-         // an in-progress call ends, so don't stop the service now.
-         return true;
-      }
-      gotoIdleState();
-      return true;
-   }
-
-   private String getProcessName() {
-      int id = Process.myPid();
-      String myProcessName = this.getPackageName();
-
-      ActivityManager actvityManager =
-             (ActivityManager)this.getSystemService(this.ACTIVITY_SERVICE);
-      List<RunningAppProcessInfo> procInfos =
-             actvityManager.getRunningAppProcesses();
-
-      for(RunningAppProcessInfo procInfo : procInfos) {
-         if (id == procInfo.pid) {
-              myProcessName = procInfo.processName;
-         }
-      }
-      procInfos.clear();
-      return myProcessName;
-   }
-
-   private void sendRecordIntent(int action) {
-       Intent intent = new Intent(ACTION_FM_RECORDING);
-       intent.putExtra("state", action);
-       if(action == RECORD_START) {
-          int mRecordDuration = -1;
-          if(FmSharedPreferences.getRecordDuration() !=
-             FmSharedPreferences.RECORD_DUR_INDEX_3_VAL) {
-             mRecordDuration = (FmSharedPreferences.getRecordDuration() * 60 * 1000);
-          }
-          intent.putExtra("record_duration", mRecordDuration);
-          intent.putExtra("process_name", getProcessName());
-          intent.putExtra("process_id", Process.myPid());
-        }
-       Log.d(LOGTAG, "Sending Recording intent for = " +action);
-       getApplicationContext().sendBroadcast(intent);
-   }
-
-   private void sendRecordServiceIntent(int action) {
-       Intent intent = new Intent(ACTION_FM);
-       intent.putExtra("state", action);
-       Log.d(LOGTAG, "Sending Recording intent for = " +action);
-       getApplicationContext().sendBroadcast(intent);
-   }
-
-   private void startFM(){
-       Log.d(LOGTAG, "In startFM");
-       if(true == mAppShutdown) { // not to send intent to AudioManager in Shutdown
-           return;
-       }
-       if (isCallActive()) { // when Call is active never let audio playback
-           mResumeAfterCall = true;
-           return;
-       }
-       mResumeAfterCall = false;
-       if ( true == mPlaybackInProgress ) // no need to resend event
-           return;
-       AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-       audioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC,
-              AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
-       Log.d(LOGTAG,"FM registering for registerMediaButtonEventReceiver");
-       mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-       ComponentName fmRadio = new ComponentName(this.getPackageName(),
-                                  FMMediaButtonIntentReceiver.class.getName());
-       mAudioManager.registerMediaButtonEventReceiver(fmRadio);
-       mStoppedOnFocusLoss = false;
-
-       if (!mA2dpDeviceSupportInHal &&  (true == mA2dpDeviceState.isDeviceAvailable()) &&
-            (!isSpeakerEnabled()) && !isAnalogModeEnabled()
-            && (true == startA2dpPlayback())) {
-            mOverA2DP=true;
-       } else {
-           Log.d(LOGTAG, "FMRadio: Requesting to start FM");
-           //reason for resending the Speaker option is we are sending
-           //ACTION_FM=1 to AudioManager, the previous state of Speaker we set
-           //need not be retained by the Audio Manager.
-           if (isSpeakerEnabled()) {
-               mSpeakerPhoneOn = true;
-               AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_SPEAKER);
-           } else {
-               AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-           }
-           AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM,
-                                     AudioSystem.DEVICE_STATE_AVAILABLE, "");
-           sendRecordServiceIntent(RECORD_START);
-       }
-       mPlaybackInProgress = true;
-   }
-
-   private void stopFM(){
-       Log.d(LOGTAG, "In stopFM");
-       if (mOverA2DP==true){
-           mOverA2DP=false;
-           stopA2dpPlayback();
-       }else{
-           Log.d(LOGTAG, "FMRadio: Requesting to stop FM");
-           AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM,
-                                    AudioSystem.DEVICE_STATE_UNAVAILABLE, "");
-       }
-       mPlaybackInProgress = false;
-   }
-
-   private void resetFM(){
-       Log.d(LOGTAG, "resetFM");
-       if (mOverA2DP==true){
-           mOverA2DP=false;
-           resetA2dpPlayback();
-       }else{
-          Log.d(LOGTAG, "FMRadio: Requesting to stop FM");
-          AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM,
-                                    AudioSystem.DEVICE_STATE_UNAVAILABLE, "");
-          sendRecordServiceIntent(RECORD_STOP);
-       }
-       mPlaybackInProgress = false;
-   }
-
-   public void startRecording() {
-
-       Log.d(LOGTAG, "In startRecording of Recorder");
-       if ((true == mSingleRecordingInstanceSupported) &&
-                               (true == mOverA2DP )) {
-            Toast.makeText( this,
-                      "playback on BT in progress,can't record now",
-                       Toast.LENGTH_SHORT).show();
-            return;
-       }
-       sendRecordIntent(RECORD_START);
-   }
-
-   public boolean startA2dpPlayback() {
-        Log.d(LOGTAG, "In startA2dpPlayback");
-    if( (true == mSingleRecordingInstanceSupported) &&
-        (true == mFmRecordingOn )) {
-                Toast.makeText(this,
-                               "Recording already in progress,can't play on BT",
-                               Toast.LENGTH_SHORT).show();
-                return false;
-       }
-        if(mOverA2DP)
-           stopA2dpPlayback();
-        mA2dp = new MediaRecorder();
-        if (mA2dp == null) {
-           Toast.makeText(this,"A2dpPlayback failed to create an instance",
-                            Toast.LENGTH_SHORT).show();
-           return false;
-        }
-        try {
-            mA2dp.setAudioSource(MediaRecorder.AudioSource.FM_RX_A2DP);
-            mA2dp.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
-            mA2dp.setAudioEncoder(MediaRecorder.OutputFormat.DEFAULT);
-            File sampleDir = new File(getFilesDir().getAbsolutePath());
-            try {
-                mA2DPSampleFile = File
-                    .createTempFile("FMRecording", ".3gpp", sampleDir);
-            } catch (IOException e) {
-                Log.e(LOGTAG, "Not able to access Phone's internal memory");
-                Toast.makeText(this, "Not able to access Phone's internal memory",
-                                Toast.LENGTH_SHORT).show();
-                return false;
-            }
-            mA2dp.setOutputFile(mA2DPSampleFile.getAbsolutePath());
-            mA2dp.prepare();
-            mA2dp.start();
-        } catch (Exception exception) {
-            mA2dp.reset();
-            mA2dp.release();
-            mA2dp = null;
-            return false;
-        }
-        return true;
- }
-
-   public void stopA2dpPlayback() {
-       if (mA2dp == null)
-           return;
-       if(mA2DPSampleFile != null)
-       {
-          try {
-              mA2DPSampleFile.delete();
-          } catch (Exception e) {
-              Log.e(LOGTAG, "Not able to delete file");
-          }
-       }
-       try {
-           mA2dp.stop();
-           mA2dp.reset();
-           mA2dp.release();
-           mA2dp = null;
-       } catch (Exception exception ) {
-           Log.e( LOGTAG, "Stop failed with exception"+ exception);
-       }
-       return;
-   }
-
-   private void resetA2dpPlayback() {
-       if (mA2dp == null)
-           return;
-       if(mA2DPSampleFile != null)
-       {
-          try {
-              mA2DPSampleFile.delete();
-          } catch (Exception e) {
-              Log.e(LOGTAG, "Not able to delete file");
-          }
-       }
-       try {
-           // Send Intent for IOBUSY VOTE, because MediaRecorder.stop
-           // gets Activity context which might not be always available
-           // and would thus fail to send the intent.
-           Intent ioBusyUnVoteIntent = new Intent(IOBUSY_UNVOTE);
-           // Remove vote for io_is_busy to be turned off.
-           ioBusyUnVoteIntent.putExtra("com.android.server.CpuGovernorService.voteType", 0);
-           sendBroadcast(ioBusyUnVoteIntent);
-
-           mA2dp.stop();
-
-           mA2dp.reset();
-           mA2dp.release();
-           mA2dp = null;
-       } catch (Exception exception ) {
-           Log.e( LOGTAG, "Stop failed with exception"+ exception);
-       }
-       return;
-   }
-
-   public void stopRecording() {
-       if (!mFmRecordingOn)
-           return;
-       sendRecordIntent(RECORD_STOP);
-       return;
-   }
-
-   private void fmActionOnCallState( int state ) {
-   //if Call Status is non IDLE we need to Mute FM as well stop recording if
-   //any. Similarly once call is ended FM should be unmuted.
-       AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-       mCallStatus = state;
-
-       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
-           if (isFmOn() && fmOff()) {
-               if((mServiceInUse) && (mCallbacks != null)) {
-                   try {
-                        mCallbacks.onDisabled();
-                   } catch (RemoteException e) {
-                        e.printStackTrace();
-                   }
-               }
-               mResumeAfterCall = true;
-               mSpeakerPhoneOn = bTempSpeaker;
-               mCallStatus = bTempCall;
-               mMuted = bTempMute;
-           } else if (!mResumeAfterCall) {
-               mResumeAfterCall = false;
-               mSpeakerPhoneOn = bTempSpeaker;
-               mCallStatus = bTempCall;
-               mMuted = bTempMute;
-           }
-       }
-       else if (state == TelephonyManager.CALL_STATE_IDLE) {
-          // start playing again
-          if (mResumeAfterCall)
-          {
-             // resume playback only if FM Radio was playing
-             // when the call was answered
-              if (isAntennaAvailable() && (!isFmOn()) && mServiceInUse)
-              {
-                   Log.d(LOGTAG, "Resuming after call:");
-                   if(true != fmOn()) {
-                       return;
-                   }
-                   mResumeAfterCall = false;
-                   if(mCallbacks != null) {
-                      try {
-                           mCallbacks.onEnabled();
-                      } catch (RemoteException e) {
-                           e.printStackTrace();
-                      }
-                   }
-              }
-          }
-       }//idle
-   }
-
-    /* Handle Phone Call + FM Concurrency */
-   private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
-      @Override
-      public void onCallStateChanged(int state, String incomingNumber) {
-          Log.d(LOGTAG, "onCallStateChanged: State - " + state );
-          Log.d(LOGTAG, "onCallStateChanged: incomingNumber - " + incomingNumber );
-          fmActionOnCallState(state );
-      }
-
-      @Override
-      public void onDataActivity (int direction) {
-          Log.d(LOGTAG, "onDataActivity - " + direction );
-          if (direction == TelephonyManager.DATA_ACTIVITY_NONE ||
-              direction == TelephonyManager.DATA_ACTIVITY_DORMANT) {
-                 if (mReceiver != null) {
-                       Message msg = mDelayedStopHandler.obtainMessage(RESET_NOTCH_FILTER);
-                       mDelayedStopHandler.sendMessageDelayed(msg, 10000);
-                 }
-         } else {
-               if (mReceiver != null) {
-                   if( true == mNotchFilterSet )
-                   {
-                       mDelayedStopHandler.removeMessages(RESET_NOTCH_FILTER);
-                   }
-                   else
-                   {
-                       mReceiver.setNotchFilter(true);
-                       mNotchFilterSet = true;
-                   }
-               }
-         }
-      }
- };
-
-private Handler mSpeakerDisableHandler = new Handler();
-
-private Runnable mSpeakerDisableTask = new Runnable() {
-   public void run() {
-      Log.v(LOGTAG, "Disabling Speaker");
-      AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-   }
-};
-
-   private Handler mDelayedStopHandler = new Handler() {
-      @Override
-      public void handleMessage(Message msg) {
-          switch (msg.what) {
-          case FM_STOP:
-              // Check again to make sure nothing is playing right now
-              if (isFmOn() || mServiceInUse)
-              {
-                   return;
-              }
-              Log.d(LOGTAG, "mDelayedStopHandler: stopSelf");
-              stopSelf(mServiceStartId);
-              break;
-          case RESET_NOTCH_FILTER:
-              if (mReceiver != null) {
-                  mReceiver.setNotchFilter(false);
-                  mNotchFilterSet = false;
-              }
-              break;
-          case STOPSERVICE_ONSLEEP:
-              fmOff();
-              break;
-          case STOPRECORD_ONTIMEOUT:
-              stopRecording();
-              break;
-          case FOCUSCHANGE:
-              if( false == isFmOn() ) {
-                  Log.v(LOGTAG, "FM is not running, not handling change");
-                  return;
-              }
-              switch (msg.arg1) {
-                  case AudioManager.AUDIOFOCUS_LOSS:
-                      Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");
-                      //intentional fall through.
-                  case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
-                      Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
-                      if (true == isFmRecordingOn())
-                          stopRecording();
-                      if (mSpeakerPhoneOn) {
-                         mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);
-                         mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0);
-                      }
-                      if (true == mPlaybackInProgress) {
-                          fmOff();
-                      }
-                      mStoppedOnFocusLoss = true;
-                      break;
-                  case AudioManager.AUDIOFOCUS_GAIN:
-                      Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_GAIN");
-                      if(false == mPlaybackInProgress)
-                          startFM();
-                      mStoppedOnFocusLoss = false;
-                      break;
-                  case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
-                  default:
-                      Log.e(LOGTAG, "Unknown audio focus change code"+msg.arg1);
-              }
-              break;
-          }
-      }
-   };
-
-
-     /**
-     * Registers an intent to listen for
-     * ACTION_SCREEN_ON/ACTION_SCREEN_OFF notifications. This intent
-     * is called to know iwhen the screen is turned on/off.
-     */
-    public void registerScreenOnOffListener() {
-        if (mScreenOnOffReceiver == null) {
-            mScreenOnOffReceiver = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    String action = intent.getAction();
-                    if (action.equals(Intent.ACTION_SCREEN_ON)) {
-                       Log.d(LOGTAG, "ACTION_SCREEN_ON Intent received");
-                       //Screen turned on, set FM module into normal power mode
-                       mHandler.post(mScreenOnHandler);
-                    }
-                    else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
-                       Log.d(LOGTAG, "ACTION_SCREEN_OFF Intent received");
-                       //Screen turned on, set FM module into low power mode
-                       mHandler.post(mScreenOffHandler);
-                    }
-                }
-            };
-            IntentFilter iFilter = new IntentFilter();
-            iFilter.addAction(Intent.ACTION_SCREEN_ON);
-            iFilter.addAction(Intent.ACTION_SCREEN_OFF);
-            registerReceiver(mScreenOnOffReceiver, iFilter);
-        }
-    }
-
-    /* Handle all the Screen On actions:
-       Set FM Power mode to Normal
-     */
-    final Runnable    mScreenOnHandler = new Runnable() {
-       public void run() {
-          setLowPowerMode(false);
-       }
-    };
-    /* Handle all the Screen Off actions:
-       Set FM Power mode to Low Power
-       This will reduce all the interrupts coming up from the SoC, saving power
-     */
-    final Runnable    mScreenOffHandler = new Runnable() {
-       public void run() {
-          setLowPowerMode(true);
-       }
-    };
-
-   /* Show the FM Notification */
-   public void startNotification() {
-      RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
-      views.setImageViewResource(R.id.icon, R.drawable.stat_notify_fm);
-      if (isFmOn())
-      {
-         views.setTextViewText(R.id.frequency, getTunedFrequencyString());
-      } else
-      {
-         views.setTextViewText(R.id.frequency, "");
-      }
-
-      Notification status = new Notification();
-      status.contentView = views;
-      status.flags |= Notification.FLAG_ONGOING_EVENT;
-      status.icon = R.drawable.stat_notify_fm;
-      status.contentIntent = PendingIntent.getActivity(this, 0,
-                                                       new Intent("com.codeaurora.fmradio.FMRADIO_ACTIVITY"), 0);
-      startForeground(FMRADIOSERVICE_STATUS, status);
-      //NotificationManager nm = (NotificationManager)
-      //                         getSystemService(Context.NOTIFICATION_SERVICE);
-      //nm.notify(FMRADIOSERVICE_STATUS, status);
-      //setForeground(true);
-      mFMOn = true;
-   }
-
-   private void stop() {
-      Log.d(LOGTAG,"in stop");
-      if (!mServiceInUse) {
-          Log.d(LOGTAG,"calling unregisterMediaButtonEventReceiver in stop");
-          mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-          ComponentName fmRadio = new ComponentName(this.getPackageName(),
-                                  FMMediaButtonIntentReceiver.class.getName());
-          mAudioManager.unregisterMediaButtonEventReceiver(fmRadio);
-      }
-      gotoIdleState();
-      mFMOn = false;
-   }
-
-   private void gotoIdleState() {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      cancelAlarms();
-      setAlarmDelayedServiceStop();
-      stopForeground(true);
-   }
-
-   /** Read's the internal Antenna available state from the FM
-    *  Device.
-    */
-   public void readInternalAntennaAvailable()
-   {
-      mInternalAntennaAvailable  = false;
-      if (mReceiver != null)
-      {
-         mInternalAntennaAvailable = mReceiver.getInternalAntenna();
-         Log.d(LOGTAG, "getInternalAntenna: " + mInternalAntennaAvailable);
-      }
-   }
-
-   /*
-    * By making this a static class with a WeakReference to the Service, we
-    * ensure that the Service can be GCd even when the system process still
-    * has a remote reference to the stub.
-    */
-   static class ServiceStub extends IFMRadioService.Stub
-   {
-      WeakReference<FMRadioService> mService;
-
-      ServiceStub(FMRadioService service)
-      {
-         mService = new WeakReference<FMRadioService>(service);
-      }
-
-      public boolean fmOn() throws RemoteException
-      {
-         return(mService.get().fmOn());
-      }
-
-      public boolean fmOff() throws RemoteException
-      {
-         return(mService.get().fmOff());
-      }
-
-      public boolean fmRadioReset() throws RemoteException
-      {
-         return true;
-      }
-
-      public boolean isFmOn()
-      {
-         return(mService.get().isFmOn());
-      }
-
-      public boolean isAnalogModeEnabled()
-      {
-         return(mService.get().isAnalogModeEnabled());
-      }
-
-      public boolean isFmRecordingOn()
-      {
-         return(mService.get().isFmRecordingOn());
-      }
-
-      public boolean isSpeakerEnabled()
-      {
-         return(mService.get().isSpeakerEnabled());
-      }
-
-      public boolean fmReconfigure()
-      {
-         return(mService.get().fmReconfigure());
-      }
-
-      public void registerCallbacks(IFMRadioServiceCallbacks cb) throws RemoteException
-      {
-         mService.get().registerCallbacks(cb);
-      }
-
-      public void unregisterCallbacks() throws RemoteException
-      {
-         mService.get().unregisterCallbacks();
-      }
-
-      public boolean routeAudio(int device)
-      {
-         return(mService.get().routeAudio(device));
-      }
-
-      public boolean mute()
-      {
-         return(mService.get().mute());
-      }
-
-      public boolean unMute()
-      {
-         return(mService.get().unMute());
-      }
-
-      public boolean isMuted()
-      {
-         return(mService.get().isMuted());
-      }
-
-      public void startRecording()
-      {
-         mService.get().startRecording();
-      }
-
-      public void stopRecording()
-      {
-         mService.get().stopRecording();
-      }
-
-      public boolean tune(int frequency)
-      {
-         return(mService.get().tune(frequency));
-      }
-
-      public boolean seek(boolean up)
-      {
-         return(mService.get().seek(up));
-      }
-
-      public void enableSpeaker(boolean speakerOn)
-      {
-          mService.get().enableSpeaker(speakerOn);
-      }
-
-      public boolean scan(int pty)
-      {
-         return(mService.get().scan(pty));
-      }
-
-      public boolean seekPI(int piCode)
-      {
-         return(mService.get().seekPI(piCode));
-      }
-      public boolean searchStrongStationList(int numStations)
-      {
-         return(mService.get().searchStrongStationList(numStations));
-      }
-
-      public boolean cancelSearch()
-      {
-         return(mService.get().cancelSearch());
-      }
-
-      public String getProgramService()
-      {
-         return(mService.get().getProgramService());
-      }
-      public String getRadioText()
-      {
-         return(mService.get().getRadioText());
-      }
-      public String getExtenRadioText()
-      {
-         return(mService.get().getExtenRadioText());
-      }
-      public int getProgramType()
-      {
-         return(mService.get().getProgramType());
-      }
-      public int getProgramID()
-      {
-         return(mService.get().getProgramID());
-      }
-      public int[] getSearchList()
-      {
-         return(mService.get().getSearchList());
-      }
-
-      public boolean setLowPowerMode(boolean enable)
-      {
-         return(mService.get().setLowPowerMode(enable));
-      }
-
-      public int getPowerMode()
-      {
-         return(mService.get().getPowerMode());
-      }
-      public boolean enableAutoAF(boolean bEnable)
-      {
-         return(mService.get().enableAutoAF(bEnable));
-      }
-      public boolean enableStereo(boolean bEnable)
-      {
-         return(mService.get().enableStereo(bEnable));
-      }
-      public boolean isAntennaAvailable()
-      {
-         return(mService.get().isAntennaAvailable());
-      }
-      public boolean isWiredHeadsetAvailable()
-      {
-         return(mService.get().isWiredHeadsetAvailable());
-      }
-      public boolean isCallActive()
-      {
-          return(mService.get().isCallActive());
-      }
-      public int getRssi()
-      {
-          return (mService.get().getRssi());
-      }
-      public int getIoC()
-      {
-          return (mService.get().getIoC());
-      }
-      public int getMpxDcc()
-      {
-          return (mService.get().getMpxDcc());
-      }
-      public int getIntDet()
-      {
-          return (mService.get().getIntDet());
-      }
-      public void setHiLoInj(int inj)
-      {
-          mService.get().setHiLoInj(inj);
-      }
-      public void delayedStop(long duration, int nType)
-      {
-          mService.get().delayedStop(duration, nType);
-      }
-      public void cancelDelayedStop(int nType)
-      {
-          mService.get().cancelDelayedStop(nType);
-      }
-      public void requestFocus()
-      {
-          mService.get().requestFocus();
-      }
-      public int getSINR()
-      {
-          return (mService.get().getSINR());
-      }
-      public boolean setSinrSamplesCnt(int samplesCnt)
-      {
-          return (mService.get().setSinrSamplesCnt(samplesCnt));
-      }
-      public boolean setSinrTh(int sinr)
-      {
-          return (mService.get().setSinrTh(sinr));
-      }
-      public boolean setIntfDetLowTh(int intfLowTh)
-      {
-          return (mService.get().setIntfDetLowTh(intfLowTh));
-      }
-      public boolean setIntfDetHighTh(int intfHighTh)
-      {
-          return (mService.get().setIntfDetHighTh(intfHighTh));
-      }
-      public int getSearchAlgoType()
-      {
-          return (mService.get().getSearchAlgoType());
-      }
-      public boolean setSearchAlgoType(int searchType)
-      {
-          return (mService.get().setSearchAlgoType(searchType));
-      }
-      public int getSinrFirstStage()
-      {
-          return (mService.get().getSinrFirstStage());
-      }
-      public boolean setSinrFirstStage(int sinr)
-      {
-          return (mService.get().setSinrFirstStage(sinr));
-      }
-      public int getRmssiFirstStage()
-      {
-          return (mService.get().getRmssiFirstStage());
-      }
-      public boolean setRmssiFirstStage(int rmssi)
-      {
-          return (mService.get().setRmssiFirstStage(rmssi));
-      }
-      public int getCFOMeanTh()
-      {
-          return (mService.get().getCFOMeanTh());
-      }
-      public boolean setCFOMeanTh(int th)
-      {
-          return (mService.get().setCFOMeanTh(th));
-      }
-      public int getSinrSamplesCnt()
-      {
-          return (mService.get().getSinrSamplesCnt());
-      }
-      public int getSinrTh()
-      {
-          return (mService.get().getSinrTh());
-      }
-      public int getAfJmpRmssiTh()
-      {
-          return (mService.get().getAfJmpRmssiTh());
-      }
-      public boolean setAfJmpRmssiTh(int afJmpRmssiTh)
-      {
-          return (mService.get().setAfJmpRmssiTh(afJmpRmssiTh));
-      }
-      public int getGoodChRmssiTh()
-      {
-          return (mService.get().getGoodChRmssiTh());
-      }
-      public boolean setGoodChRmssiTh(int gdChRmssiTh)
-      {
-          return (mService.get().setGoodChRmssiTh(gdChRmssiTh));
-      }
-      public int getAfJmpRmssiSamplesCnt()
-      {
-          return (mService.get().getAfJmpRmssiSamplesCnt());
-      }
-      public boolean setAfJmpRmssiSamplesCnt(int afJmpRmssiSmplsCnt)
-      {
-          return (mService.get().setAfJmpRmssiSamplesCnt(afJmpRmssiSmplsCnt));
-      }
-      public boolean setRxRepeatCount(int count)
-      {
-           return (mService.get().setRxRepeatCount(count));
-      }
-      public long getRecordingStartTime()
-      {
-           return (mService.get().getRecordingStartTime());
-      }
-   }
-   private final IBinder mBinder = new ServiceStub(this);
-
-   private boolean setAudioPath(boolean analogMode) {
-
-        if (mReceiver == null) {
-              return false;
-        }
-        if (isAnalogModeEnabled() == analogMode) {
-                Log.d(LOGTAG,"Analog Path already is set to "+analogMode);
-                return false;
-        }
-        if (!isAnalogModeSupported()) {
-                Log.d(LOGTAG,"Analog Path is not supported ");
-                return false;
-        }
-        if (SystemProperties.getBoolean("hw.fm.digitalpath",false)) {
-                return false;
-        }
-
-        boolean state = mReceiver.setAnalogMode(analogMode);
-        if (false == state) {
-            Log.d(LOGTAG, "Error in toggling analog/digital path " + analogMode);
-            return false;
-        }
-        misAnalogPathEnabled = analogMode;
-        return true;
-   }
-  /*
-   * Turn ON FM: Powers up FM hardware, and initializes the FM module
-   *                                                                                 .
-   * @return true if fm Enable api was invoked successfully, false if the api failed.
-   */
-   private boolean fmOn() {
-      boolean bStatus=false;
-      mWakeLock.acquire(10*1000);
-      if ( TelephonyManager.CALL_STATE_IDLE != getCallState() ) {
-         return bStatus;
-      }
-
-      if(mReceiver == null)
-      {
-         try {
-            mReceiver = new FmReceiver(FMRADIO_DEVICE_FD_STRING, fmCallbacks);
-         }
-         catch (InstantiationException e)
-         {
-            throw new RuntimeException("FmReceiver service not available!");
-         }
-      }
-
-      if (mReceiver != null)
-      {
-         if (isFmOn())
-         {
-            /* FM Is already on,*/
-            bStatus = true;
-            Log.d(LOGTAG, "mReceiver.already enabled");
-         }
-         else
-         {
-            // This sets up the FM radio device
-            FmConfig config = FmSharedPreferences.getFMConfiguration();
-            Log.d(LOGTAG, "fmOn: RadioBand   :"+ config.getRadioBand());
-            Log.d(LOGTAG, "fmOn: Emphasis    :"+ config.getEmphasis());
-            Log.d(LOGTAG, "fmOn: ChSpacing   :"+ config.getChSpacing());
-            Log.d(LOGTAG, "fmOn: RdsStd      :"+ config.getRdsStd());
-            Log.d(LOGTAG, "fmOn: LowerLimit  :"+ config.getLowerLimit());
-            Log.d(LOGTAG, "fmOn: UpperLimit  :"+ config.getUpperLimit());
-            bStatus = mReceiver.enable(FmSharedPreferences.getFMConfiguration());
-            if (isSpeakerEnabled()) {
-                setAudioPath(false);
-            } else {
-                setAudioPath(true);
-            }
-            Log.d(LOGTAG, "mReceiver.enable done, Status :" +  bStatus);
-         }
-
-         if (bStatus == true)
-         {
-            /* Put the hardware into normal mode */
-            bStatus = setLowPowerMode(false);
-            Log.d(LOGTAG, "setLowPowerMode done, Status :" +  bStatus);
-
-
-            AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-            if( (audioManager != null) &&(false == mPlaybackInProgress) )
-            {
-               Log.d(LOGTAG, "mAudioManager.setFmRadioOn = true \n" );
-               //audioManager.setParameters("FMRadioOn="+mAudioDevice);
-               int state =  getCallState();
-               if ( TelephonyManager.CALL_STATE_IDLE != getCallState() )
-               {
-                 fmActionOnCallState(state);
-               } else {
-                   startFM(); // enable FM Audio only when Call is IDLE
-               }
-               Log.d(LOGTAG, "mAudioManager.setFmRadioOn done \n" );
-            }
-            if (mReceiver != null) {
-                bStatus = mReceiver.registerRdsGroupProcessing(FmReceiver.FM_RX_RDS_GRP_RT_EBL|
-                                                           FmReceiver.FM_RX_RDS_GRP_PS_EBL|
-                                                           FmReceiver.FM_RX_RDS_GRP_AF_EBL|
-                                                           FmReceiver.FM_RX_RDS_GRP_PS_SIMPLE_EBL);
-                Log.d(LOGTAG, "registerRdsGroupProcessing done, Status :" +  bStatus);
-            }
-            bStatus = enableAutoAF(FmSharedPreferences.getAutoAFSwitch());
-            Log.d(LOGTAG, "enableAutoAF done, Status :" +  bStatus);
-
-            /* There is no internal Antenna*/
-            bStatus = mReceiver.setInternalAntenna(false);
-            Log.d(LOGTAG, "setInternalAntenna done, Status :" +  bStatus);
-
-            /* Read back to verify the internal Antenna mode*/
-            readInternalAntennaAvailable();
-
-            startNotification();
-            bStatus = true;
-         }
-         else
-         {
-            mReceiver = null; // as enable failed no need to disable
-                              // failure of enable can be because handle
-                              // already open which gets effected if
-                              // we disable
-            stop();
-         }
-      }
-      return(bStatus);
-   }
-
-  /*
-   * Turn OFF FM Operations: This disables all the current FM operations             .
-   */
-   private void fmOperationsOff() {
-      if ( mSpeakerPhoneOn)
-      {
-          mSpeakerPhoneOn = false;
-          AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-      }
-      if (isFmRecordingOn())
-      {
-          stopRecording();
-      }
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      if(audioManager != null)
-      {
-         Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" );
-         unMute();
-         stopFM();
-         //audioManager.setParameters("FMRadioOn=false");
-         Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" );
-      }
-
-      sendRecordServiceIntent(RECORD_STOP);
-      if (isAnalogModeEnabled()) {
-              SystemProperties.set("hw.fm.isAnalog","false");
-              misAnalogPathEnabled = false;
-      }
-   }
-
-  /*
-   * Reset (OFF) FM Operations: This resets all the current FM operations             .
-   */
-   private void fmOperationsReset() {
-      if ( mSpeakerPhoneOn)
-      {
-          mSpeakerPhoneOn = false;
-          AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-      }
-
-      if (isFmRecordingOn())
-      {
-          stopRecording();
-      }
-
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      if(audioManager != null)
-      {
-         Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" );
-         unMute();
-         resetFM();
-         //audioManager.setParameters("FMRadioOn=false");
-         Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" );
-      }
-
-      if (isAnalogModeEnabled()) {
-              SystemProperties.set("hw.fm.isAnalog","false");
-              misAnalogPathEnabled = false;
-      }
-   }
-
-  /*
-   * Turn OFF FM: Disable the FM Host and hardware                                  .
-   *                                                                                 .
-   * @return true if fm Disable api was invoked successfully, false if the api failed.
-   */
-   private boolean fmOff() {
-      boolean bStatus=false;
-
-      fmOperationsOff();
-
-      // This will disable the FM radio device
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.disable();
-         mReceiver = null;
-      }
-      stop();
-      return(bStatus);
-   }
-
-  /*
-   * Turn OFF FM: Disable the FM Host when hardware resets asynchronously            .
-   *                                                                                 .
-   * @return true if fm Reset api was invoked successfully, false if the api failed  .
-   */
-   private boolean fmRadioReset() {
-      boolean bStatus=false;
-
-      Log.v(LOGTAG, "fmRadioReset");
-
-      fmOperationsReset();
-
-      // This will reset the FM radio receiver
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.reset();
-         mReceiver = null;
-      }
-      stop();
-      return(bStatus);
-   }
-
-   /* Returns whether FM hardware is ON.
-    *
-    * @return true if FM was tuned, searching. (at the end of
-    * the search FM goes back to tuned).
-    *
-    */
-   public boolean isFmOn() {
-      return mFMOn;
-   }
-
-   /* Returns true if Analog Path is enabled */
-   public boolean isAnalogModeEnabled() {
-         return misAnalogPathEnabled;
-   }
-
-   public boolean isAnalogModeSupported() {
-        return misAnalogModeSupported;
-   }
-
-   public boolean isFmRecordingOn() {
-      return mFmRecordingOn;
-   }
-
-   public boolean isSpeakerEnabled() {
-      return mSpeakerPhoneOn;
-   }
-   public boolean isExternalStorageAvailable() {
-     boolean mStorageAvail = false;
-     String state = Environment.getExternalStorageState();
-
-     if(Environment.MEDIA_MOUNTED.equals(state)){
-         Log.d(LOGTAG, "device available");
-         mStorageAvail = true;
-     }
-     return mStorageAvail;
-   }
-   public void enableSpeaker(boolean speakerOn) {
-       if(isCallActive())
-           return ;
-       mSpeakerPhoneOn = speakerOn;
-       boolean analogmode = isAnalogModeSupported();
-       if (false == speakerOn) {
-           if (analogmode) {
-                if (isFmRecordingOn())
-                    stopRecording();
-                stopFM();
-               AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-               if (mMuted) {
-                   setAudioPath(true);
-               } else {
-                   mute();
-                   setAudioPath(true);
-                   unMute();
-               }
-           } else {
-               AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_NONE);
-           }
-           if (analogmode)
-                startFM();
-       }
-
-
-       //Need to turn off BT path when Speaker is set on vice versa.
-       if( !mA2dpDeviceSupportInHal && !analogmode && true == mA2dpDeviceState.isDeviceAvailable()) {
-           if( ((true == mOverA2DP) && (true == speakerOn)) ||
-               ((false == mOverA2DP) && (false == speakerOn)) ) {
-              //disable A2DP playback for speaker option
-               stopFM();
-               startFM();
-           }
-       }
-       if (speakerOn) {
-           if (analogmode) {
-                 stopFM();
-                 if (mMuted) {
-                     setAudioPath(false);
-                 } else {
-                     mute();
-                     setAudioPath(false);
-                     unMute();
-                 }
-           }
-           AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_SPEAKER);
-           if (analogmode)
-                startFM();
-       }
-
-   }
-  /*
-   *  ReConfigure the FM Setup parameters
-   *  - Band
-   *  - Channel Spacing (50/100/200 KHz)
-   *  - Emphasis (50/75)
-   *  - Frequency limits
-   *  - RDS/RBDS standard
-   *
-   * @return true if configure api was invoked successfully, false if the api failed.
-   */
-   public boolean fmReconfigure() {
-      boolean bStatus=false;
-      Log.d(LOGTAG, "fmReconfigure");
-      if (mReceiver != null)
-      {
-         // This sets up the FM radio device
-         FmConfig config = FmSharedPreferences.getFMConfiguration();
-         Log.d(LOGTAG, "RadioBand   :"+ config.getRadioBand());
-         Log.d(LOGTAG, "Emphasis    :"+ config.getEmphasis());
-         Log.d(LOGTAG, "ChSpacing   :"+ config.getChSpacing());
-         Log.d(LOGTAG, "RdsStd      :"+ config.getRdsStd());
-         Log.d(LOGTAG, "LowerLimit  :"+ config.getLowerLimit());
-         Log.d(LOGTAG, "UpperLimit  :"+ config.getUpperLimit());
-         bStatus = mReceiver.configure(config);
-      }
-      return(bStatus);
-   }
-
-   /*
-    * Register UI/Activity Callbacks
-    */
-   public void registerCallbacks(IFMRadioServiceCallbacks cb)
-   {
-      mCallbacks = cb;
-   }
-
-   /*
-    *  unRegister UI/Activity Callbacks
-    */
-   public void unregisterCallbacks()
-   {
-      mCallbacks=null;
-   }
-
-   /*
-   *  Route Audio to headset or speaker phone
-   *  @return true if routeAudio call succeeded, false if the route call failed.
-   */
-   public boolean routeAudio(int audioDevice) {
-      boolean bStatus=false;
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-
-      //Log.d(LOGTAG, "routeAudio: " + audioDevice);
-
-      switch (audioDevice) {
-
-        case RADIO_AUDIO_DEVICE_WIRED_HEADSET:
-            mAudioDevice = "headset";
-            break;
-
-        case RADIO_AUDIO_DEVICE_SPEAKER:
-            mAudioDevice = "speaker";
-            break;
-
-        default:
-            mAudioDevice = "headset";
-            break;
-      }
-
-      if (mReceiver != null)
-      {
-      //audioManager.setParameters("FMRadioOn=false");
-      //Log.d(LOGTAG, "mAudioManager.setFmRadioOn =" + mAudioDevice );
-      //audioManager.setParameters("FMRadioOn="+mAudioDevice);
-      //Log.d(LOGTAG, "mAudioManager.setFmRadioOn done \n");
-       }
-
-       return bStatus;
-   }
-
-  /*
-   *  Mute FM Hardware (SoC)
-   * @return true if set mute mode api was invoked successfully, false if the api failed.
-   */
-   public boolean mute() {
-      boolean bCommandSent=true;
-      if(isMuted())
-          return bCommandSent;
-      if(isCallActive())
-         return false;
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      Log.d(LOGTAG, "mute:");
-      if (audioManager != null)
-      {
-         mMuted = true;
-         audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true);
-      }
-      return bCommandSent;
-   }
-
-   /*
-   *  UnMute FM Hardware (SoC)
-   * @return true if set mute mode api was invoked successfully, false if the api failed.
-   */
-   public boolean unMute() {
-      boolean bCommandSent=true;
-      if(!isMuted())
-          return bCommandSent;
-      if(isCallActive())
-         return false;
-      Log.d(LOGTAG, "unMute:");
-      AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-      if (audioManager != null)
-      {
-         mMuted = false;
-         audioManager.setStreamMute(AudioManager.STREAM_MUSIC,false);
-         if (mResumeAfterCall)
-         {
-             //We are unmuting FM in a voice call. Need to enable FM audio routing.
-             startFM();
-         }
-      }
-      return bCommandSent;
-   }
-
-   /* Returns whether FM Hardware(Soc) Audio is Muted.
-    *
-    * @return true if FM Audio is muted, false if not muted.
-    *
-    */
-   public boolean isMuted() {
-      return mMuted;
-   }
-
-   /* Tunes to the specified frequency
-    *
-    * @return true if Tune command was invoked successfully, false if not muted.
-    *  Note: Callback FmRxEvRadioTuneStatus will be called when the tune
-    *        is complete
-    */
-   public boolean tune(int frequency) {
-      boolean bCommandSent=false;
-      double doubleFrequency = frequency/1000.00;
-
-      Log.d(LOGTAG, "tuneRadio:  " + doubleFrequency);
-      if (mReceiver != null)
-      {
-         mReceiver.setStation(frequency);
-         bCommandSent = true;
-      }
-      return bCommandSent;
-   }
-
-   /* Seeks (Search for strong station) to the station in the direction specified
-    * relative to the tuned station.
-    * boolean up: true - Search in the forward direction.
-    *             false - Search in the backward direction.
-    * @return true if Seek command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvSearchComplete will be called when the Search
-    *        is complete
-    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to a station
-    *        at the end of the Search or if the seach was cancelled.
-    */
-   public boolean seek(boolean up)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         if (up == true)
-         {
-            Log.d(LOGTAG, "seek:  Up");
-            mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SEEK,
-                                             FmReceiver.FM_RX_DWELL_PERIOD_1S,
-                                             FmReceiver.FM_RX_SEARCHDIR_UP);
-         }
-         else
-         {
-            Log.d(LOGTAG, "seek:  Down");
-            mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SEEK,
-                                             FmReceiver.FM_RX_DWELL_PERIOD_1S,
-                                             FmReceiver.FM_RX_SEARCHDIR_DOWN);
-         }
-         bCommandSent = true;
-      }
-      return bCommandSent;
-   }
-
-   /* Scan (Search for station with a "preview" of "n" seconds)
-    * FM Stations. It always scans in the forward direction relative to the
-    * current tuned station.
-    * int pty: 0 or a reserved PTY value- Perform a "strong" station search of all stations.
-    *          Valid/Known PTY - perform RDS Scan for that pty.
-    *
-    * @return true if Scan command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvRadioTuneStatus will be called when tuned to various stations
-    *           during the Scan.
-    *        2. Callback FmRxEvSearchComplete will be called when the Search
-    *        is complete
-    *        3. Callback FmRxEvRadioTuneStatus will also be called when tuned to a station
-    *        at the end of the Search or if the seach was cancelled.
-    *
-    */
-   public boolean scan(int pty)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "scan:  PTY: " + pty);
-         if(FmSharedPreferences.isRBDSStd())
-         {
-            /* RBDS : Validate PTY value?? */
-            if( ((pty  > 0) && (pty  <= 23)) || ((pty  >= 29) && (pty  <= 31)) )
-            {
-               bCommandSent = mReceiver.searchStations(FmReceiver.FM_RX_SRCHRDS_MODE_SCAN_PTY,
-                                                       FmReceiver.FM_RX_DWELL_PERIOD_2S,
-                                                       FmReceiver.FM_RX_SEARCHDIR_UP,
-                                                       pty,
-                                                       0);
-            }
-            else
-            {
-               bCommandSent = mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SCAN,
-                                                FmReceiver.FM_RX_DWELL_PERIOD_2S,
-                                                FmReceiver.FM_RX_SEARCHDIR_UP);
-            }
-         }
-         else
-         {
-            /* RDS : Validate PTY value?? */
-            if( (pty  > 0) && (pty  <= 31) )
-            {
-               bCommandSent = mReceiver.searchStations(FmReceiver.FM_RX_SRCHRDS_MODE_SCAN_PTY,
-                                                          FmReceiver.FM_RX_DWELL_PERIOD_2S,
-                                                          FmReceiver.FM_RX_SEARCHDIR_UP,
-                                                          pty,
-                                                          0);
-            }
-            else
-            {
-               bCommandSent = mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SCAN,
-                                                FmReceiver.FM_RX_DWELL_PERIOD_2S,
-                                                FmReceiver.FM_RX_SEARCHDIR_UP);
-            }
-         }
-      }
-      return bCommandSent;
-   }
-
-   /* Search for the 'numStations' number of strong FM Stations.
-    *
-    * It searches in the forward direction relative to the current tuned station.
-    * int numStations: maximum number of stations to search.
-    *
-    * @return true if Search command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvSearchListComplete will be called when the Search
-    *        is complete
-    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to
-    *        the previously tuned station.
-    */
-   public boolean searchStrongStationList(int numStations)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "searchStrongStationList:  numStations: " + numStations);
-         bCommandSent = mReceiver.searchStationList(FmReceiver.FM_RX_SRCHLIST_MODE_STRONG,
-                                                    FmReceiver.FM_RX_SEARCHDIR_UP,
-                                                    numStations,
-                                                    0);
-      }
-      return bCommandSent;
-   }
-
-   /* Search for the FM Station that matches the RDS PI (Program Identifier) code.
-    * It always scans in the forward direction relative to the current tuned station.
-    * int piCode: PI Code of the station to search.
-    *
-    * @return true if Search command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvSearchComplete will be called when the Search
-    *        is complete
-    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to a station
-    *        at the end of the Search or if the seach was cancelled.
-    */
-   public boolean seekPI(int piCode)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "seekPI:  piCode: " + piCode);
-         bCommandSent = mReceiver.searchStations(FmReceiver.FM_RX_SRCHRDS_MODE_SEEK_PI,
-                                                            FmReceiver.FM_RX_DWELL_PERIOD_1S,
-                                                            FmReceiver.FM_RX_SEARCHDIR_UP,
-                                                            0,
-                                                            piCode
-                                                            );
-      }
-      return bCommandSent;
-   }
-
-
-  /* Cancel any ongoing Search (Seek/Scan/SearchStationList).
-   *
-   * @return true if Search command was invoked successfully, false if not muted.
-   *  Note: 1. Callback FmRxEvSearchComplete will be called when the Search
-   *        is complete/cancelled.
-   *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to a station
-   *        at the end of the Search or if the seach was cancelled.
-   */
-   public boolean cancelSearch()
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "cancelSearch");
-         bCommandSent = mReceiver.cancelSearch();
-      }
-      return bCommandSent;
-   }
-
-   /* Retrieves the RDS Program Service (PS) String.
-    *
-    * @return String - RDS PS String.
-    *  Note: 1. This is a synchronous call that should typically called when
-    *           Callback FmRxEvRdsPsInfo is invoked.
-    *        2. Since PS contains multiple fields, this Service reads all the fields and "caches"
-    *        the values and provides this helper routine for the Activity to get only the information it needs.
-    *        3. The "cached" data fields are always "cleared" when the tune status changes.
-    */
-   public String getProgramService() {
-      String str = "";
-      if (mFMRxRDSData != null)
-      {
-         str = mFMRxRDSData.getPrgmServices();
-         if(str == null)
-         {
-            str= "";
-         }
-      }
-      Log.d(LOGTAG, "Program Service: [" + str + "]");
-      return str;
-   }
-
-   /* Retrieves the RDS Radio Text (RT) String.
-    *
-    * @return String - RDS RT String.
-    *  Note: 1. This is a synchronous call that should typically called when
-    *           Callback FmRxEvRdsRtInfo is invoked.
-    *        2. Since RT contains multiple fields, this Service reads all the fields and "caches"
-    *        the values and provides this helper routine for the Activity to get only the information it needs.
-    *        3. The "cached" data fields are always "cleared" when the tune status changes.
-    */
-   public String getRadioText() {
-      String str = "";
-      if (mFMRxRDSData != null)
-      {
-         str = mFMRxRDSData.getRadioText();
-         if(str == null)
-         {
-            str= "";
-         }
-      }
-      Log.d(LOGTAG, "Radio Text: [" + str + "]");
-      return str;
-   }
-
-   public String getExtenRadioText() {
-      String str = "";
-      if (mFMRxRDSData != null)
-      {
-         str = mFMRxRDSData.getERadioText();
-         if(str == null)
-         {
-            str= "";
-         }
-      }
-      Log.d(LOGTAG, "eRadio Text:[" + str +"]");
-      return str;
-   }
-   /* Retrieves the RDS Program Type (PTY) code.
-    *
-    * @return int - RDS PTY code.
-    *  Note: 1. This is a synchronous call that should typically called when
-    *           Callback FmRxEvRdsRtInfo and or FmRxEvRdsPsInfo is invoked.
-    *        2. Since RT/PS contains multiple fields, this Service reads all the fields and "caches"
-    *        the values and provides this helper routine for the Activity to get only the information it needs.
-    *        3. The "cached" data fields are always "cleared" when the tune status changes.
-    */
-   public int getProgramType() {
-      int pty = -1;
-      if (mFMRxRDSData != null)
-      {
-         pty = mFMRxRDSData.getPrgmType();
-      }
-      Log.d(LOGTAG, "PTY: [" + pty + "]");
-      return pty;
-   }
-
-   /* Retrieves the RDS Program Identifier (PI).
-    *
-    * @return int - RDS PI code.
-    *  Note: 1. This is a synchronous call that should typically called when
-    *           Callback FmRxEvRdsRtInfo and or FmRxEvRdsPsInfo is invoked.
-    *        2. Since RT/PS contains multiple fields, this Service reads all the fields and "caches"
-    *        the values and provides this helper routine for the Activity to get only the information it needs.
-    *        3. The "cached" data fields are always "cleared" when the tune status changes.
-    */
-   public int getProgramID() {
-      int pi = -1;
-      if (mFMRxRDSData != null)
-      {
-         pi = mFMRxRDSData.getPrgmId();
-      }
-      Log.d(LOGTAG, "PI: [" + pi + "]");
-      return pi;
-   }
-
-
-   /* Retrieves the station list from the SearchStationlist.
-    *
-    * @return Array of integers that represents the station frequencies.
-    * Note: 1. This is a synchronous call that should typically called when
-    *           Callback onSearchListComplete.
-    */
-   public int[] getSearchList()
-   {
-      int[] frequencyList = null;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "getSearchList: ");
-         frequencyList = mReceiver.getStationList();
-      }
-      return frequencyList;
-   }
-
-   /* Set the FM Power Mode on the FM hardware SoC.
-    * Typically used when UI/Activity is in the background, so the Host is interrupted less often.
-    *
-    * boolean bLowPower: true: Enable Low Power mode on FM hardware.
-    *                    false: Disable Low Power mode on FM hardware. (Put into normal power mode)
-    * @return true if set power mode api was invoked successfully, false if the api failed.
-    */
-   public boolean setLowPowerMode(boolean bLowPower)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "setLowPowerMode: " + bLowPower);
-         if(bLowPower)
-         {
-            bCommandSent = mReceiver.setPowerMode(FmReceiver.FM_RX_LOW_POWER_MODE);
-         }
-         else
-         {
-            bCommandSent = mReceiver.setPowerMode(FmReceiver.FM_RX_NORMAL_POWER_MODE);
-         }
-      }
-      return bCommandSent;
-   }
-
-   /* Get the FM Power Mode on the FM hardware SoC.
-    *
-    * @return the device power mode.
-    */
-   public int getPowerMode()
-   {
-      int powerMode=FmReceiver.FM_RX_NORMAL_POWER_MODE;
-      if (mReceiver != null)
-      {
-         powerMode = mReceiver.getPowerMode();
-         Log.d(LOGTAG, "getLowPowerMode: " + powerMode);
-      }
-      return powerMode;
-   }
-
-  /* Set the FM module to auto switch to an Alternate Frequency for the
-   * station if one the signal strength of that frequency is stronger than the
-   * current tuned frequency.
-   *
-   * boolean bEnable: true: Auto switch to stronger alternate frequency.
-   *                  false: Do not switch to alternate frequency.
-   *
-   * @return true if set Auto AF mode api was invoked successfully, false if the api failed.
-   *  Note: Callback FmRxEvRadioTuneStatus will be called when tune
-   *        is complete to a different frequency.
-   */
-   public boolean enableAutoAF(boolean bEnable)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "enableAutoAF: " + bEnable);
-         bCommandSent = mReceiver.enableAFjump(bEnable);
-      }
-      return bCommandSent;
-   }
-
-   /* Set the FM module to Stereo Mode or always force it to Mono Mode.
-    * Note: The stereo mode will be available only when the station is broadcasting
-    * in Stereo mode.
-    *
-    * boolean bEnable: true: Enable Stereo Mode.
-    *                  false: Always stay in Mono Mode.
-    *
-    * @return true if set Stereo mode api was invoked successfully, false if the api failed.
-    */
-   public boolean enableStereo(boolean bEnable)
-   {
-      boolean bCommandSent=false;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "enableStereo: " + bEnable);
-         bCommandSent = mReceiver.setStereoMode(bEnable);
-      }
-      return bCommandSent;
-   }
-
-   /** Determines if an internal Antenna is available.
-    *  Returns the cached value initialized on FMOn.
-    *
-    * @return true if internal antenna is available or wired
-    *         headset is plugged in, false if internal antenna is
-    *         not available and wired headset is not plugged in.
-    */
-   public boolean isAntennaAvailable()
-   {
-      boolean bAvailable = false;
-      if ((mInternalAntennaAvailable) || (mHeadsetPlugged) )
-      {
-         bAvailable = true;
-      }
-      return bAvailable;
-   }
-
-   public static long getAvailableSpace() {
-       String state = Environment.getExternalStorageState();
-       Log.d(LOGTAG, "External storage state=" + state);
-       if (Environment.MEDIA_CHECKING.equals(state)) {
-           return PREPARING;
-       }
-       if (!Environment.MEDIA_MOUNTED.equals(state)) {
-           return UNAVAILABLE;
-       }
-
-       try {
-            File sampleDir = Environment.getExternalStorageDirectory();
-            StatFs stat = new StatFs(sampleDir.getAbsolutePath());
-            return stat.getAvailableBlocks() * (long) stat.getBlockSize();
-       } catch (Exception e) {
-            Log.i(LOGTAG, "Fail to access external storage", e);
-       }
-       return UNKNOWN_SIZE;
-  }
-
-   private boolean updateAndShowStorageHint() {
-       mStorageSpace = getAvailableSpace();
-       return showStorageHint();
-   }
-
-   private boolean showStorageHint() {
-       String errorMessage = null;
-       if (mStorageSpace == UNAVAILABLE) {
-           errorMessage = getString(R.string.no_storage);
-       } else if (mStorageSpace == PREPARING) {
-           errorMessage = getString(R.string.preparing_sd);
-       } else if (mStorageSpace == UNKNOWN_SIZE) {
-           errorMessage = getString(R.string.access_sd_fail);
-       } else if (mStorageSpace < LOW_STORAGE_THRESHOLD) {
-           errorMessage = getString(R.string.spaceIsLow_content);
-       }
-
-       if (errorMessage != null) {
-           Toast.makeText(this, errorMessage,
-                    Toast.LENGTH_LONG).show();
-           return false;
-       }
-       return true;
-   }
-
-   /** Determines if a Wired headset is plugged in. Returns the
-    *  cached value initialized on broadcast receiver
-    *  initialization.
-    *
-    * @return true if wired headset is plugged in, false if wired
-    *         headset is not plugged in.
-    */
-   public boolean isWiredHeadsetAvailable()
-   {
-      return (mHeadsetPlugged);
-   }
-   public boolean isCallActive()
-   {
-       //Non-zero: Call state is RINGING or OFFHOOK on the available subscriptions
-       //zero: Call state is IDLE on all the available subscriptions
-       if(0 != getCallState()) return true;
-       return false;
-   }
-   public int getCallState()
-   {
-       return mCallStatus;
-   }
-
-   public void clearStationInfo() {
-       if(mFMRxRDSData != null) {
-          mFMRxRDSData.setRadioText("");
-          mFMRxRDSData.setPrgmId(0);
-          mFMRxRDSData.setPrgmType(0);
-          mFMRxRDSData.setPrgmServices("");
-          mFMRxRDSData.setERadioText("");
-          mFMRxRDSData.setTagValue("", 1);
-          mFMRxRDSData.setTagValue("", 2);
-          mFMRxRDSData.setTagCode((byte)0, 1);
-          mFMRxRDSData.setTagCode((byte)0, 2);
-          Log.d(LOGTAG, "clear tags data");
-          FmSharedPreferences.clearTags();
-       }
-   }
-
-   /* Receiver callbacks back from the FM Stack */
-   FmRxEvCallbacksAdaptor fmCallbacks = new FmRxEvCallbacksAdaptor()
-   {
-      public void FmRxEvEnableReceiver() {
-         Log.d(LOGTAG, "FmRxEvEnableReceiver");
-         mReceiver.setRawRdsGrpMask();
-      }
-      public void FmRxEvDisableReceiver()
-      {
-         Log.d(LOGTAG, "FmRxEvDisableReceiver");
-         mFMOn = false;
-         FmSharedPreferences.clearTags();
-      }
-      public void FmRxEvRadioReset()
-      {
-         Log.d(LOGTAG, "FmRxEvRadioReset");
-         if(isFmOn()) {
-             // Received radio reset event while FM is ON
-             Log.d(LOGTAG, "FM Radio reset");
-             fmRadioReset();
-             try
-             {
-                /* Notify the UI/Activity, only if the service is "bound"
-                   by an activity and if Callbacks are registered
-                */
-                if((mServiceInUse) && (mCallbacks != null) )
-                {
-                    mCallbacks.onRadioReset();
-                }
-             }
-             catch (RemoteException e)
-             {
-                e.printStackTrace();
-             }
-         }
-      }
-      public void FmRxEvConfigReceiver()
-      {
-         Log.d(LOGTAG, "FmRxEvConfigReceiver");
-      }
-      public void FmRxEvMuteModeSet()
-      {
-         Log.d(LOGTAG, "FmRxEvMuteModeSet");
-      }
-      public void FmRxEvStereoModeSet()
-      {
-         Log.d(LOGTAG, "FmRxEvStereoModeSet");
-      }
-      public void FmRxEvRadioStationSet()
-      {
-         Log.d(LOGTAG, "FmRxEvRadioStationSet");
-      }
-      public void FmRxEvPowerModeSet()
-      {
-         Log.d(LOGTAG, "FmRxEvPowerModeSet");
-      }
-      public void FmRxEvSetSignalThreshold()
-      {
-         Log.d(LOGTAG, "FmRxEvSetSignalThreshold");
-      }
-
-      public void FmRxEvRadioTuneStatus(int frequency)
-      {
-         Log.d(LOGTAG, "FmRxEvRadioTuneStatus: Tuned Frequency: " +frequency);
-         try
-         {
-            FmSharedPreferences.setTunedFrequency(frequency);
-            mPrefs.Save();
-            //Log.d(LOGTAG, "Call mCallbacks.onTuneStatusChanged");
-            /* Since the Tuned Status changed, clear out the RDSData cached */
-            if(mReceiver != null) {
-               clearStationInfo();
-            }
-            if(mCallbacks != null)
-            {
-               mCallbacks.onTuneStatusChanged();
-            }
-            /* Update the frequency in the StatusBar's Notification */
-            startNotification();
-
-         }
-         catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-      public void FmRxEvStationParameters()
-      {
-         Log.d(LOGTAG, "FmRxEvStationParameters");
-      }
-
-      public void FmRxEvRdsLockStatus(boolean bRDSSupported)
-      {
-         Log.d(LOGTAG, "FmRxEvRdsLockStatus: " + bRDSSupported);
-         try
-         {
-            if(mCallbacks != null)
-            {
-               mCallbacks.onStationRDSSupported(bRDSSupported);
-            }
-         }
-         catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-      public void FmRxEvStereoStatus(boolean stereo)
-      {
-         Log.d(LOGTAG, "FmRxEvStereoStatus: " + stereo);
-         try
-         {
-            if(mCallbacks != null)
-            {
-               mCallbacks.onAudioUpdate(stereo);
-            }
-         }
-         catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      public void FmRxEvServiceAvailable(boolean signal)
-      {
-         Log.d(LOGTAG, "FmRxEvServiceAvailable");
-         if(signal) {
-             Log.d(LOGTAG, "FmRxEvServiceAvailable: Tuned frequency is above signal threshold level");
-         }
-         else {
-             Log.d(LOGTAG, "FmRxEvServiceAvailable: Tuned frequency is below signal threshold level");
-         }
-      }
-      public void FmRxEvGetSignalThreshold()
-      {
-         Log.d(LOGTAG, "FmRxEvGetSignalThreshold");
-      }
-      public void FmRxEvSearchInProgress()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchInProgress");
-      }
-      public void FmRxEvSearchRdsInProgress()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchRdsInProgress");
-      }
-      public void FmRxEvSearchListInProgress()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchListInProgress");
-      }
-      public void FmRxEvSearchComplete(int frequency)
-       {
-         Log.d(LOGTAG, "FmRxEvSearchComplete: Tuned Frequency: " +frequency);
-         try
-         {
-            FmSharedPreferences.setTunedFrequency(frequency);
-            //Log.d(LOGTAG, "Call mCallbacks.onSearchComplete");
-            /* Since the Tuned Status changed, clear out the RDSData cached */
-            if(mReceiver != null) {
-               clearStationInfo();
-            }
-            if(mCallbacks != null)
-            {
-               mCallbacks.onSearchComplete();
-            }
-            /* Update the frequency in the StatusBar's Notification */
-            startNotification();
-         }
-         catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-      public void FmRxEvSearchRdsComplete()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchRdsComplete");
-      }
-
-      public void FmRxEvSearchListComplete()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchListComplete");
-         try
-         {
-            if(mCallbacks != null)
-            {
-               mCallbacks.onSearchListComplete();
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-      public void FmRxEvSearchCancelled()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchCancelled: Cancelled the on-going search operation.");
-      }
-      public void FmRxEvRdsGroupData()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsGroupData");
-      }
-
-      public void FmRxEvRdsPsInfo() {
-         Log.d(LOGTAG, "FmRxEvRdsPsInfo: ");
-         try
-         {
-            if(mReceiver != null)
-            {
-               mFMRxRDSData = mReceiver.getPSInfo();
-               if(mFMRxRDSData != null)
-               {
-                  Log.d(LOGTAG, "PI: [" + mFMRxRDSData.getPrgmId() + "]");
-                  Log.d(LOGTAG, "PTY: [" + mFMRxRDSData.getPrgmType() + "]");
-                  Log.d(LOGTAG, "PS: [" + mFMRxRDSData.getPrgmServices() + "]");
-               }
-               if(mCallbacks != null)
-               {
-                  mCallbacks.onProgramServiceChanged();
-               }
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-
-      public void FmRxEvRdsRtInfo() {
-         Log.d(LOGTAG, "FmRxEvRdsRtInfo");
-         try
-         {
-            //Log.d(LOGTAG, "Call mCallbacks.onRadioTextChanged");
-            if(mReceiver != null)
-            {
-               mFMRxRDSData = mReceiver.getRTInfo();
-               if(mFMRxRDSData != null)
-               {
-                  Log.d(LOGTAG, "PI: [" + mFMRxRDSData.getPrgmId() + "]");
-                  Log.d(LOGTAG, "PTY: [" + mFMRxRDSData.getPrgmType() + "]");
-                  Log.d(LOGTAG, "RT: [" + mFMRxRDSData.getRadioText() + "]");
-               }
-               if(mCallbacks != null)
-               {
-                  mCallbacks.onRadioTextChanged();
-               }
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-
-      }
-
-      public void FmRxEvRdsAfInfo()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsAfInfo");
-         mReceiver.getAFInfo();
-      }
-      public void FmRxEvRTPlus()
-      {
-         int tag_nums;
-         Log.d(LOGTAG, "FmRxEvRTPlusInfo");
-         if (mReceiver != null) {
-             mFMRxRDSData = mReceiver.getRTPlusInfo();
-             tag_nums = mFMRxRDSData.getTagNums();
-             if (tag_nums >= 1) {
-                 Log.d(LOGTAG, "tag1 is: " + mFMRxRDSData.getTagCode(1) + "value: "
-                        + mFMRxRDSData.getTagValue(1));
-                 FmSharedPreferences.addTags(mFMRxRDSData.getTagCode(1), mFMRxRDSData.getTagValue(1));
-             }
-             if(tag_nums == 2) {
-                Log.d(LOGTAG, "tag2 is: " + mFMRxRDSData.getTagCode(2) + "value: "
-                      + mFMRxRDSData.getTagValue(2));
-                 FmSharedPreferences.addTags(mFMRxRDSData.getTagCode(2), mFMRxRDSData.getTagValue(2));
-             }
-         }
-      }
-      public void FmRxEvERTInfo()
-      {
-         Log.d(LOGTAG, "FmRxEvERTInfo");
-         try {
-             if (mReceiver != null) {
-                mFMRxRDSData = mReceiver.getERTInfo();
-                if(mCallbacks != null)
-                   mCallbacks.onExtenRadioTextChanged();
-             }
-         } catch (RemoteException e) {
-             e.printStackTrace();
-         }
-      }
-      public void FmRxEvRdsPiMatchAvailable()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsPiMatchAvailable");
-      }
-      public void FmRxEvRdsGroupOptionsSet()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsGroupOptionsSet");
-      }
-      public void FmRxEvRdsProcRegDone()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsProcRegDone");
-      }
-      public void FmRxEvRdsPiMatchRegDone()
-      {
-         Log.d(LOGTAG, "FmRxEvRdsPiMatchRegDone");
-      }
-   };
-
-
-   /*
-    *  Read the Tuned Frequency from the FM module.
-    */
-   private String getTunedFrequencyString() {
-
-      double frequency = FmSharedPreferences.getTunedFrequency() / 1000.0;
-      String frequencyString = getString(R.string.stat_notif_frequency, (""+frequency));
-      return frequencyString;
-   }
-   public int getRssi() {
-      if (mReceiver != null)
-          return mReceiver.getRssi();
-      else
-          return Integer.MAX_VALUE;
-   }
-   public int getIoC() {
-      if (mReceiver != null)
-          return mReceiver.getIoverc();
-      else
-          return Integer.MAX_VALUE;
-   }
-   public int getIntDet() {
-      if (mReceiver != null)
-          return mReceiver.getIntDet();
-      else
-          return Integer.MAX_VALUE;
-   }
-   public int getMpxDcc() {
-      if (mReceiver != null)
-          return mReceiver.getMpxDcc();
-      else
-          return Integer.MAX_VALUE;
-   }
-   public void setHiLoInj(int inj) {
-      if (mReceiver != null)
-          mReceiver.setHiLoInj(inj);
-   }
-   public int getSINR() {
-      if (mReceiver != null)
-          return mReceiver.getSINR();
-      else
-          return Integer.MAX_VALUE;
-   }
-   public boolean setSinrSamplesCnt(int samplesCnt) {
-      if(mReceiver != null)
-         return mReceiver.setSINRsamples(samplesCnt);
-      else
-         return false;
-   }
-   public boolean setSinrTh(int sinr) {
-      if(mReceiver != null)
-         return mReceiver.setSINRThreshold(sinr);
-      else
-         return false;
-   }
-   public boolean setIntfDetLowTh(int intfLowTh) {
-      if(mReceiver != null)
-         return mReceiver.setOnChannelThreshold(intfLowTh);
-      else
-         return false;
-   }
-   public boolean setIntfDetHighTh(int intfHighTh) {
-      if(mReceiver != null)
-         return mReceiver.setOffChannelThreshold(intfHighTh);
-      else
-         return false;
-   }
-   public int getSearchAlgoType() {
-       if(mReceiver != null)
-          return mReceiver.getSearchAlgoType();
-       else
-          return -1;
-   }
-   public boolean setSearchAlgoType(int searchType) {
-        if(mReceiver != null)
-           return mReceiver.setSearchAlgoType(searchType);
-        else
-           return false;
-   }
-   public int getSinrFirstStage() {
-        if(mReceiver != null)
-           return mReceiver.getSinrFirstStage();
-        else
-           return Integer.MAX_VALUE;
-   }
-   public boolean setSinrFirstStage(int sinr) {
-        if(mReceiver != null)
-           return mReceiver.setSinrFirstStage(sinr);
-        else
-           return false;
-   }
-   public int getRmssiFirstStage() {
-        if(mReceiver != null)
-           return mReceiver.getRmssiFirstStage();
-        else
-           return Integer.MAX_VALUE;
-   }
-   public boolean setRmssiFirstStage(int rmssi) {
-         if(mReceiver != null)
-            return mReceiver.setRmssiFirstStage(rmssi);
-         else
-            return false;
-   }
-   public int getCFOMeanTh() {
-          if(mReceiver != null)
-             return mReceiver.getCFOMeanTh();
-          else
-             return Integer.MAX_VALUE;
-   }
-   public boolean setCFOMeanTh(int th) {
-          if(mReceiver != null)
-             return mReceiver.setCFOMeanTh(th);
-          else
-             return false;
-   }
-   public int getSinrSamplesCnt() {
-          if(mReceiver != null)
-             return mReceiver.getSINRsamples();
-          else
-             return Integer.MAX_VALUE;
-   }
-   public int getSinrTh() {
-          if(mReceiver != null)
-             return mReceiver.getSINRThreshold();
-          else
-             return Integer.MAX_VALUE;
-   }
-
-   boolean setAfJmpRmssiTh(int afJmpRmssiTh) {
-          if(mReceiver != null)
-             return mReceiver.setAFJumpRmssiTh(afJmpRmssiTh);
-          else
-             return false;
-   }
-   boolean setGoodChRmssiTh(int gdChRmssiTh) {
-          if(mReceiver != null)
-             return mReceiver.setGdChRmssiTh(gdChRmssiTh);
-          else
-             return false;
-   }
-   boolean setAfJmpRmssiSamplesCnt(int afJmpRmssiSmplsCnt) {
-          if(mReceiver != null)
-             return mReceiver.setAFJumpRmssiSamples(afJmpRmssiSmplsCnt);
-          else
-             return false;
-   }
-   int getAfJmpRmssiTh() {
-          if(mReceiver != null)
-             return mReceiver.getAFJumpRmssiTh();
-          else
-             return Integer.MIN_VALUE;
-   }
-   int getGoodChRmssiTh() {
-          if(mReceiver != null)
-             return mReceiver.getGdChRmssiTh();
-          else
-             return Integer.MAX_VALUE;
-   }
-   int getAfJmpRmssiSamplesCnt() {
-          if(mReceiver != null)
-             return mReceiver.getAFJumpRmssiSamples();
-          else
-             return Integer.MIN_VALUE;
-   }
-   private void setAlarmSleepExpired (long duration) {
-       Intent i = new Intent(SLEEP_EXPIRED_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       Log.d(LOGTAG, "delayedStop called" + SystemClock.elapsedRealtime() + duration);
-       am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
-   }
-   private void cancelAlarmSleepExpired() {
-       Intent i = new Intent(SLEEP_EXPIRED_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       am.cancel(pi);
-   }
-   private void setAlarmRecordTimeout(long duration) {
-       Intent i = new Intent(RECORD_EXPIRED_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       Log.d(LOGTAG, "delayedStop called" + SystemClock.elapsedRealtime() + duration);
-       am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
-   }
-   private void cancelAlarmRecordTimeout() {
-       Intent i = new Intent(RECORD_EXPIRED_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       am.cancel(pi);
-   }
-   private void setAlarmDelayedServiceStop() {
-       Intent i = new Intent(SERVICE_DELAYED_STOP_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + IDLE_DELAY, pi);
-   }
-   private void cancelAlarmDealyedServiceStop() {
-       Intent i = new Intent(SERVICE_DELAYED_STOP_ACTION);
-       AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-       am.cancel(pi);
-   }
-   private void cancelAlarms() {
-       cancelAlarmSleepExpired();
-       cancelAlarmRecordTimeout();
-       cancelAlarmDealyedServiceStop();
-   }
-   public boolean setRxRepeatCount(int count) {
-      if(mReceiver != null)
-         return mReceiver.setPSRxRepeatCount(count);
-      else
-         return false;
-   }
-
-   public long getRecordingStartTime() {
-      return mSampleStart;
-   }
-   //handling the sleep and record stop when FM App not in focus
-   private void delayedStop(long duration, int nType) {
-       int whatId = (nType == STOP_SERVICE) ? STOPSERVICE_ONSLEEP: STOPRECORD_ONTIMEOUT;
-       if (nType == STOP_SERVICE)
-           setAlarmSleepExpired(duration);
-       else
-           setAlarmRecordTimeout(duration);
-   }
-   private void cancelDelayedStop(int nType) {
-       int whatId = (nType == STOP_SERVICE) ? STOPSERVICE_ONSLEEP: STOPRECORD_ONTIMEOUT;
-       if (nType == STOP_SERVICE)
-           cancelAlarmSleepExpired();
-       else
-           cancelAlarmRecordTimeout();
-   }
-   private void requestFocus() {
-      if( (false == mPlaybackInProgress) &&
-          (true  == mStoppedOnFocusLoss) ) {
-           // adding code for audio focus gain.
-           AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-           audioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC,
-                  AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
-           startFM();
-           mStoppedOnFocusLoss = false;
-       }
-   }
-   private OnAudioFocusChangeListener mAudioFocusListener = new OnAudioFocusChangeListener() {
-       public void onAudioFocusChange(int focusChange) {
-           mDelayedStopHandler.obtainMessage(FOCUSCHANGE, focusChange, 0).sendToTarget();
-       }
-   };
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMStats.java b/fmapp/src/com/codeaurora/fmradio/FMStats.java
deleted file mode 100644
index 6d6c516..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMStats.java
+++ /dev/null
@@ -1,2554 +0,0 @@
-/*
- * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Handler;
-import android.os.Message;
-import android.os.RemoteException;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.View;
-import android.view.ViewGroup.LayoutParams;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.RadioButton;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.Spinner;
-import android.widget.TableLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import qcom.fmradio.FmReceiver;
-import android.os.SystemProperties;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.view.LayoutInflater;
-import android.content.DialogInterface;
-import android.os.PowerManager;
-import android.os.PowerManager.WakeLock;
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.IntentFilter;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuInflater;
-import android.os.SystemClock;
-
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.HashMap;
-import android.os.SystemProperties;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.util.Formatter;
-import java.util.Locale;
-
-public class FMStats extends Activity  {
-
-    EditText txtbox1;
-    Button button1;
-    Button button2;
-    TextView tv1;
-    Button SetButton;
-    Button RunButton;
-    ProgressBar  pbar;
-    TableLayout tLayout;
-
-    private FmReceiver mReceiver;
-
-    TextView  bandSweepSettingButton;
-
-    /*Data structure for band*/
-    private class Band {
-      public int lFreq;
-      public int hFreq;
-      public int Spacing;
-      public int cur_freq;
-    }
-    /* Data structure for Result*/
-    private class Result {
-
-      private String mFreq;
-      private String mRSSI;
-      private String mIoC;
-      private String mIntDet;
-      private String mMpxDcc;
-      private String mSINR;
-
-
-      public void setFreq(String aFreq) {
-         this.mFreq = aFreq;
-      }
-
-      public String getFreq() {
-         return mFreq;
-      }
-
-      public void setRSSI(String aRSSI) {
-         this.mRSSI = aRSSI;
-      }
-
-      public String getRSSI() {
-         return mRSSI;
-      }
-
-      public void setIoC(String aIoC) {
-         this.mIoC = aIoC;
-      }
-
-      public String getIoC() {
-         return mIoC;
-      }
-
-      public void setIntDet(String aIntDet) {
-         this.mIntDet = aIntDet;
-      }
-
-      public String getIntDet() {
-         return mIntDet;
-      }
-
-      public void setMpxDcc(String aMpxDcc) {
-         this.mMpxDcc = aMpxDcc;
-      }
-
-      public String getMpxDcc() {
-         return mMpxDcc;
-      }
-      public void setSINR(String aSINR) {
-         this.mSINR = aSINR;
-      }
-
-      public String getSINR() {
-         return mSINR;
-      }
-    };
-
-    /*constant column header*/
-    Result mColumnHeader = new Result();
-
-    boolean mTestRunning = false;
-    FmRfItemSelectedListener mSpinFmRfListener =
-                                     new FmRfItemSelectedListener();
-    RfCfgItemSelectedListener mSpinRfCfgListener =
-                                     new RfCfgItemSelectedListener();
-    CfgRfItemSelectedListener1 mSpinCfgRfListener1 = null;
-    CfgRfItemSelectedListener2 mSpinCfgRfListener2 = null;
-    BandSweepMthdsSelectedListener mSweepMthdsListener =
-                                     new BandSweepMthdsSelectedListener();
-
-    int  mTestSelected = 0;
-    boolean mIsSearching = false;
-    private static String LOGTAG = "FMStats";
-    private static IFMRadioService mService = null;
-    private Thread mMultiUpdateThread = null;
-    private static final int STATUS_UPDATE = 1;
-    private static final int STATUS_DONE = 2;
-    private static final int RECORDTIMER_UPDATE = 3;
-    private static final int RECORDTIMER_EXPIRED = 4;
-    private static final int STOP_ROW_ID = 200;
-    private static final int NEW_ROW_ID = 300;
-    private int mStopIds = STOP_ROW_ID;
-    private int mNewRowIds = NEW_ROW_ID;
-    private static final int SCAN_DWELL_PERIOD = 1;
-
-    private static final int CUR_FREQ_TEST = 0;
-    private static final int CUR_MULTI_TEST = 1;
-    private static final int SEARCH_TEST =2;
-    private static final int SWEEP_TEST = 3;
-    private Band mBand = null;
-    private Band mSync = null;
-    int Lo = 1, Auto = 0;
-
-    private FileOutputStream mFileCursor = null;
-    private String mCurrentFileName = null;
-
-    Spinner spinOptionFmRf;
-    Spinner spinOptionBandSweepMthds;
-    ArrayAdapter<CharSequence> adaptCfgRf;
-    ArrayAdapter<CharSequence> adaptRfCfg;
-    ArrayAdapter<CharSequence> adaptFmRf;
-    ArrayAdapter<CharSequence> bandSweepMthds;
-
-    private static boolean mIsTransportSMD = false;
-
-    private static final int MPX_DCC = 0;
-    private static final int SINR_INTF = 1;
-    private static final int MIN_SINR_FIRST_STAGE = -128;
-    private static final int MAX_SINR_FIRST_STAGE = 127;
-    private static final int MIN_RMSSI_FIRST_STAGE = -128;
-    private static final int MAX_RMSSI_FIRST_STAGE = 127;
-    private static final int MIN_CF0TH12 = -2147483648;
-    private static final int MAX_CF0TH12 = 2147483647;
-    private static final int MIN_SINR_TH = -128;
-    private static final int MAX_SINR_TH = 127;
-    private static final int MIN_SINR_SAMPLES = 0;
-    private static final int MAX_SINR_SAMPLES = 255;
-    private static final int MIN_AF_JMP_RMSSI_TH = 0;
-    private static final int MAX_AF_JMP_RMSSI_TH = 65535;
-    private static final int MIN_GD_CH_RMSSI_TH = -128;
-    private static final int MAX_GD_CH_RMSSI_TH = 127;
-    private static final int MIN_AF_JMP_RMSSI_SAMPLES = 0;
-    private static final int MAX_AF_JMP_RMSSI_SAMPLES = 255;
-
-    private static final int DIALOG_BAND_SWEEP_SETTING = 1;
-
-    private int prevDwellTime = 2; //2secs
-    private int prevDelayTime = 0;//0secs
-    private int prevSweepMthd = 0; //Manual (using band min, max)
-
-    private int curSweepMthd = 0;
-
-    private Thread mRecordUpdateHandlerThread = null;
-    boolean mRecording = false;
-
-
-    private static StringBuilder sFormatBuilder = new StringBuilder();
-    private static Formatter sFormatter = new Formatter(sFormatBuilder, Locale
-                                                       .getDefault());
-    private static final Object[] sTimeArgs = new Object[5];
-
-    private final String FREQ_LIST_FILE_NAME = "/freq_list_comma_separated.txt";
-    private static final String BAND_SWEEP_START_DELAY_TIMEOUT = "com.codeaurora.fmradio.SWEEP_START_DELAY_EXP";
-    private static final String BAND_SWEEP_DWELL_DELAY_TIMEOUT = "com.codeaurora.fmradio.SWEEP_DWELL_DELAY_EXP";
-
-    private BroadcastReceiver mBandSweepDelayExprdListener = null;
-    private BroadcastReceiver mBandSweepDwellExprdListener = null;
-
-    private WakeLock mWakeLock;
-
-    private GetNextFreqInterface mNextFreqInterface;
-    private CommaSeparatedFreqFileReader mFreqFileReader;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        this.setContentView(R.layout.fmstats);
-
-        spinOptionFmRf = (Spinner)findViewById(R.id.spinner);
-        adaptFmRf = ArrayAdapter.createFromResource
-                       (this, R.array.stats_options
-                         , android.R.layout.simple_spinner_item);
-        adaptFmRf.setDropDownViewResource
-                   (android.R.layout.simple_spinner_dropdown_item);
-        if (spinOptionFmRf != null) {
-           spinOptionFmRf.setAdapter(adaptFmRf);
-           spinOptionFmRf.setOnItemSelectedListener(mSpinFmRfListener);
-        }
-
-        bandSweepMthds = ArrayAdapter.createFromResource
-                          (this, R.array.band_sweep_methods,
-                            android.R.layout.simple_spinner_item);
-
-        checkTransportLayer();
-        if (!isTransportLayerSMD()) {
-            mSpinCfgRfListener1 = new CfgRfItemSelectedListener1();
-            adaptCfgRf = ArrayAdapter.createFromResource(
-                           this, R.array.cfg_rf1,
-                           android.R.layout.simple_spinner_item);
-        }else {
-            mSpinCfgRfListener2 = new CfgRfItemSelectedListener2();
-            adaptCfgRf = ArrayAdapter.createFromResource(
-                           this, R.array.cfg_rf2,
-                           android.R.layout.simple_spinner_item);
-        }
-        adaptRfCfg = ArrayAdapter.createFromResource(
-            this, R.array.rf_cfg, android.R.layout.simple_spinner_item);
-
-        tLayout = (TableLayout) findViewById(R.id.maintable);
-
-        if(mReceiver == null)
-            mReceiver = new FmReceiver();
-
-        long curTime = System.currentTimeMillis();
-        mCurrentFileName = "FMStats_".concat(
-                                 Long.toString(curTime).concat(".txt")
-                              );
-        Log.e(LOGTAG,"Filename is " + mCurrentFileName);
-        try {
-            mFileCursor = openFileOutput(
-                                 mCurrentFileName,
-                                 Context.MODE_PRIVATE);
-            if(null != mFileCursor) {
-               Log.e(LOGTAG, "location of the file is"+getFilesDir());
-            }
-        }catch (IOException e) {
-            e.printStackTrace();
-            Log.e(LOGTAG,"Couldn't create the file to writeLog");
-            mCurrentFileName = null;
-        }
-
-        if (false == bindToService(this, osc)) {
-            Log.d(LOGTAG, "onCreate: Failed to Start Service");
-        }else {
-            Log.d(LOGTAG, "onCreate: Start Service completed successfully");
-        }
-
-        /*Initialize the column header with
-         constant values*/
-        mColumnHeader.setFreq("Freq");
-        mColumnHeader.setRSSI("RMSSI");
-        mColumnHeader.setIoC("IoC");
-        mColumnHeader.setSINR("SINR");
-        mColumnHeader.setMpxDcc("Offset");
-        mColumnHeader.setIntDet("IntDet");
-
-        bandSweepSettingButton = (TextView)findViewById(R.id.BandSweepSetting);
-        if(bandSweepSettingButton != null) {
-           bandSweepSettingButton.setOnClickListener(mClicktBandSweepSettingListener);
-        }
-
-        PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
-        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getName());
-        mWakeLock.setReferenceCounted(false);
-
-        registerBandSweepDelayExprdListener();
-        registerBandSweepDwellExprdListener();
-    }
-
-    @Override
-    public void onStart() {
-       super.onStart();
-       if(isRecording()) {
-          Log.d(LOGTAG, "onStart");
-          initiateRecordThread();
-       }
-    }
-
-    @Override
-    public void onStop() {
-       super.onStop();
-       if(isRecording()) {
-          try {
-               if(null != mRecordUpdateHandlerThread) {
-                  mRecordUpdateHandlerThread.interrupt();
-               }
-          }catch (NullPointerException e) {
-               e.printStackTrace();
-          }
-       }
-    }
-
-    @Override
-    public void onDestroy() {
-
-        stopCurTest();
-
-        unRegisterBroadcastReceiver(mBandSweepDelayExprdListener);
-        unRegisterBroadcastReceiver(mBandSweepDwellExprdListener);
-
-        if(null != mFileCursor ) {
-            try {
-                mFileCursor.close();
-            }catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-
-        unbindFromService(this);
-        Log.d(LOGTAG, "onDestroy: unbindFromService completed");
-        mReceiver = null;
-        mService = null;
-        removeDialog(DIALOG_BAND_SWEEP_SETTING);
-        mWakeLock.release();
-        super.onDestroy();
-    }
-
-    private View.OnClickListener mOnRunListener = new View.OnClickListener() {
-        public void onClick(View v) {
-           if(false == mTestRunning) {
-              clearPreviousTestResults();
-              mTestRunning = true;
-              if(mTestSelected == SWEEP_TEST) {
-                 disableBandSweepSetting();
-              }
-              runCurrentTest();
-           }else {
-              mTestRunning = false;
-              /*Stop the thread by interrupting it*/
-              if(mMultiUpdateThread != null) {
-                 mMultiUpdateThread.interrupt();
-                 mMultiUpdateThread = null;
-              }
-
-              if(SEARCH_TEST == mTestSelected) {
-                 try {
-                      mService.cancelSearch();
-                 }catch (RemoteException e) {
-                      e.printStackTrace();
-                 }
-              }
-              if(mTestSelected == SWEEP_TEST) {
-                 stopBandSweep();
-                 sendStatusDoneMsg();
-                 enableBandSweepSetting();
-              }
-           }
-       }
-    };
-
-    private void clearPreviousTestResults() {
-       TableLayout tl = (TableLayout)findViewById(R.id.maintable);
-       if (tl != null) {
-           tl.removeAllViewsInLayout();
-       }
-       mNewRowIds = NEW_ROW_ID;
-    }
-
-    private void SetButtonState(boolean state) {
-       // Get the TableRow
-       Button RunButton = (Button)findViewById(R.id.Runbutton);
-       ProgressBar  pbar = (ProgressBar)findViewById(R.id.progressbar);
-       /*Update the state of the button based on
-        state*/
-       if(state) {
-          if(RunButton != null) {
-             RunButton.setText(R.string.test_run);
-          }
-          if(pbar != null) {
-             pbar.setVisibility(View.INVISIBLE);
-          }
-          if(mTestSelected == SWEEP_TEST) {
-             enableBandSweepSetting();
-          }
-       }else {
-          if(RunButton != null) {
-             RunButton.setText("Stop Test");
-          }
-          if(pbar != null) {
-             pbar.setVisibility(View.VISIBLE);
-          }
-       }
-    }
-
-    private void chooseFMRFoption(){
-       String[] szTestInformation = getResources().getStringArray(
-                        R.array.stats_options);
-       final StringBuilder szbTestHeader = new StringBuilder();
-       szbTestHeader.append("running test:").append
-                              (szTestInformation[mTestSelected]);
-       String szTestHeader = new String(szbTestHeader);
-       switch(mTestSelected)
-       {
-       case 1:
-               RunButton = (Button)findViewById(R.id.Runbutton);
-               if(RunButton != null) {
-                  RunButton.setVisibility(View.INVISIBLE);
-               }
-               pbar = (ProgressBar) findViewById(R.id.progressbar);
-               if(pbar != null) {
-                  pbar.setVisibility(View.INVISIBLE);
-               }
-               adaptCfgRf.setDropDownViewResource
-                           (android.R.layout.simple_spinner_dropdown_item);
-               spinOptionFmRf.setAdapter(adaptCfgRf);
-               if(isTransportLayerSMD())
-                  spinOptionFmRf.setOnItemSelectedListener
-                                   (mSpinCfgRfListener2);
-               else
-                  spinOptionFmRf.setOnItemSelectedListener
-                                   (mSpinCfgRfListener1);
-               break;
-       case 2:
-               txtbox1 = (EditText)findViewById(R.id.txtbox1);
-               tv1 = (TextView)findViewById(R.id.label);
-               if(txtbox1 != null) {
-                  txtbox1.setVisibility(View.INVISIBLE);
-               }
-               if(tv1 != null) {
-                  tv1.setVisibility(View.INVISIBLE);
-               }
-               Button SetButton = (Button)findViewById(R.id.Setbutton);
-               if(SetButton != null) {
-                  SetButton.setVisibility(View.INVISIBLE);
-               }
-               adaptRfCfg.setDropDownViewResource
-                               (android.R.layout.simple_spinner_dropdown_item);
-               spinOptionFmRf.setAdapter(adaptRfCfg);
-               spinOptionFmRf.setOnItemSelectedListener(mSpinRfCfgListener);
-               break;
-        }
-    }
-
-    private View.OnClickListener mOnSetRmssitListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-               int rdel = Integer.parseInt(a);
-               Log.d(LOGTAG, "Value of RMSSI DELTA is : " + rdel);
-               mReceiver.setRmssiDel(rdel);
-          }catch (NumberFormatException e) {
-               Log.e(LOGTAG, "Value entered is not in correct format: " + a);
-               txtbox1.setText("");
-          }catch (NullPointerException e) {
-               e.printStackTrace();
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetRxRePeatCount = new View.OnClickListener() {
-        public void onClick(View v) {
-	    String a;
-	    a =  txtbox1.getText().toString();
-	    try {
-	         int count = Integer.parseInt(a);
-	         Log.d(LOGTAG, "Value entered for mOnSetRxRePeatCount: " + count);
-	         if((count < 0) ||
-	            (count > 255))
-	              return;
-	         if(mService != null) {
-	            try {
-	                 mService.setRxRepeatCount(count);
-	            } catch (RemoteException e) {
-	                 e.printStackTrace();
-	            }
-	         }
-	    } catch (NumberFormatException e) {
-	         Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-	         txtbox1.setText("");
-	    }
-        }
-    };
-
-    private View.OnClickListener mOnSetSigThListener =
-     new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rdel = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value of Signal Th. is : " + rdel);
-              mReceiver.setSignalThreshold(rdel);
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
-              txtbox1.setText("");
-          }catch (NullPointerException e) {
-              e.printStackTrace();
-          }
-      }
-    };
-
-    private View.OnClickListener mOnSetSinrSmplCntListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rdel = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value of Sinr Samples count is : " + rdel);
-              if(mService != null) {
-                 try {
-                     mService.setSinrSamplesCnt(rdel);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
-              txtbox1.setText("");
-          }
-      }
-    };
-
-    private View.OnClickListener mOnSetSinrThListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rdel = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value of Sinr Th is : " + rdel);
-              if(mService != null) {
-                 try {
-                     mService.setSinrTh(rdel);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
-              txtbox1.setText("");
-          }
-      }
-    };
-
-    private View.OnClickListener mOnSetIntfLowThListener =
-     new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rdel = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value of Intf Det Low Th is : " + rdel);
-              if(mService != null) {
-                 try {
-                     mService.setIntfDetLowTh(rdel);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
-              txtbox1.setText("");
-          }
-      }
-    };
-    private View.OnClickListener mOnSetIntfHighThListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rdel = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value of Intf Det Low Th is : " + rdel);
-              if(mService != null) {
-                 try {
-                     mService.setIntfDetHighTh(rdel);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetSinrFirstStageListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int sinr = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for SINR FIRST STAGE is : " + sinr);
-              if((sinr < MIN_SINR_FIRST_STAGE) ||
-                     (sinr > MAX_SINR_FIRST_STAGE))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setSinrFirstStage(sinr);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetRmssiFirstStageListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int rmssi = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for RMSSI FIRST STAGE is: " + rmssi);
-              if((rmssi < MIN_RMSSI_FIRST_STAGE) ||
-                     (rmssi > MAX_RMSSI_FIRST_STAGE))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setRmssiFirstStage(rmssi);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetCFOMeanThListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int cf0 = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for CF0TH12 is: " + cf0);
-              if((cf0 < MIN_CF0TH12) ||
-                     (cf0 > MAX_CF0TH12))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setCFOMeanTh(cf0);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetSearchMPXDCCListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          Log.d(LOGTAG, "Value entered for search is: MPX DCC");
-          if(mService != null) {
-             try {
-                  mService.setSearchAlgoType(MPX_DCC);
-             }catch (RemoteException e) {
-                  e.printStackTrace();
-             }
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetSearchSinrIntfListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          Log.d(LOGTAG, "Value entered for search is: SINR INTF");
-          if(mService != null) {
-             try {
-                  mService.setSearchAlgoType(SINR_INTF);
-             }catch (RemoteException e) {
-                  e.printStackTrace();
-             }
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetAfJmpRmssiThListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int th = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for AfJmpRmssiTh is: " + th);
-              if((th < MIN_AF_JMP_RMSSI_TH) ||
-                     (th > MAX_AF_JMP_RMSSI_TH))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setAfJmpRmssiTh(th);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetGdChRmssiThListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int th = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for Good channel Rmssi Th is: " + th);
-              if((th < MIN_GD_CH_RMSSI_TH) ||
-                     (th > MAX_GD_CH_RMSSI_TH))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setGoodChRmssiTh(th);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    private View.OnClickListener mOnSetAfJmpRmssiSmplsCntListener =
-    new View.OnClickListener() {
-       public void onClick(View v) {
-          String a;
-          a = txtbox1.getText().toString();
-          try {
-              int cnt = Integer.parseInt(a);
-              Log.d(LOGTAG, "Value entered for AfJmpRmssiSamples is: " + cnt);
-              if((cnt < MIN_AF_JMP_RMSSI_SAMPLES) ||
-                     (cnt > MAX_AF_JMP_RMSSI_SAMPLES))
-                  return;
-              if(mService != null) {
-                 try {
-                     mService.setAfJmpRmssiSamplesCnt(cnt);
-                 }catch (RemoteException e) {
-                     e.printStackTrace();
-                 }
-              }
-          }catch (NumberFormatException e) {
-              Log.e(LOGTAG, "Value entered is not in correct format : " + a);
-              txtbox1.setText("");
-          }
-       }
-    };
-
-    public class CfgRfItemSelectedListener1 implements OnItemSelectedListener {
-        public void onItemSelected(
-                     AdapterView<?> parent, View view, int pos, long id) {
-            Log.d("Table","onItemSelected is hit with " + pos);
-            txtbox1 = (EditText)findViewById(R.id.txtbox1);
-            tv1 = (TextView)findViewById(R.id.label);
-            Button SetButton = (Button)findViewById(R.id.Setbutton);
-            tLayout.setVisibility(View.INVISIBLE);
-            switch(pos)
-            {
-            case 0:
-                   if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                   }
-                   if (tv1 != null) {
-                       tv1.setText(R.string.enter_rssi);
-                       tv1.setVisibility(View.VISIBLE);
-                   }
-                   if (SetButton != null) {
-                       SetButton.setText(R.string.set_rmmsi_delta);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetRmssitListener);
-                   }
-                   break;
-            case 1:
-                   if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                   }
-                   if (tv1 != null) {
-                       tv1.setText(R.string.enter_sigth);
-                       tv1.setVisibility(View.VISIBLE);
-                   }
-                   if (SetButton != null) {
-                       SetButton.setText(R.string.set_sigth);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetSigThListener);
-                   }
-                   break;
-            case 2:
-                   tLayout.removeAllViewsInLayout();
-                   mNewRowIds = NEW_ROW_ID;
-                   tLayout.setVisibility(View.VISIBLE);
-                   if (txtbox1 != null) {
-                       txtbox1.setVisibility(View.INVISIBLE);
-                   }
-                   if (tv1 != null) {
-                       tv1.setVisibility(View.INVISIBLE);
-                   }
-                   if (SetButton != null) {
-                       SetButton.setVisibility(View.INVISIBLE);
-                   }
-                   adaptRfCfg.setDropDownViewResource(
-                              android.R.layout.simple_spinner_dropdown_item);
-                   spinOptionFmRf.setAdapter(adaptRfCfg);
-                   spinOptionFmRf.setOnItemSelectedListener(
-                                                 mSpinRfCfgListener);
-                   break;
-            }
-        }
-
-        public void onNothingSelected(AdapterView<?> parent) {
-            // Do Nothing
-        }
-    }
-
-    public class CfgRfItemSelectedListener2 implements OnItemSelectedListener {
-        public void onItemSelected(AdapterView<?> parent,
-                                    View view, int pos, long id) {
-            Log.d("Table","onItemSelected is hit with " + pos);
-            int ret = Integer.MAX_VALUE;
-            txtbox1 = (EditText) findViewById(R.id.txtbox1);
-            tv1 = (TextView) findViewById(R.id.label);
-            button1 = (Button)findViewById(R.id.SearchMpxDcc);
-            button2 = (Button)findViewById(R.id.SearchSinrInt);
-            Button SetButton = (Button)findViewById(R.id.Setbutton);
-            tLayout.setVisibility(View.INVISIBLE);
-            switch(pos)
-            {
-                case 0:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_SinrSmplsCnt);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_SinrSmplsCnt);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetSinrSmplCntListener);
-                    }
-                    break;
-                case 1:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_SinrTh);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_SinrTh);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetSinrThListener);
-                    }
-                    break;
-                case 2:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_IntfLowTh);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_IntfLowTh);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetIntfLowThListener);
-                    }
-                    break;
-                case 3:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_IntfHighTh);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_IntfHighTh);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetIntfHighThListener);
-                    }
-                    break;
-                case 4:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_SinrFirstStage);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_SinrFirstStage);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetSinrFirstStageListener);
-                    }
-                    break;
-                case 5:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_RmssiFirstStage);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_RmssiFirstStage);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetRmssiFirstStageListener);
-                    }
-                    break;
-                case 6:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_CF0Th12);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_CF0Th12);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetCFOMeanThListener);
-                    }
-                    break;
-                case 7:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setText(R.string.search_algo_mpx);
-                       button1.setVisibility(View.VISIBLE);
-                       button1.setOnClickListener(mOnSetSearchMPXDCCListener);
-                    }
-                    if(button2 != null) {
-                       button2.setText(R.string.search_algo_sinrint);
-                       button2.setVisibility(View.VISIBLE);
-                       button2.setOnClickListener(mOnSetSearchSinrIntfListener);
-                    }
-                    break;
-                case 8:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null)
-                           ret = mService.getSinrSamplesCnt();
-                           Log.d(LOGTAG, "Get Sinr Samples Count: " + ret);
-                           if((ret >= MIN_SINR_SAMPLES) &&
-                                  (ret <= MAX_SINR_SAMPLES))
-                              tv1.setText(" " + String.valueOf(ret));
-                    }catch (RemoteException e) {
-                    }
-                    break;
-                case 9:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null)
-                           ret = mService.getSinrTh();
-                           Log.d(LOGTAG, "Get Sinr Threshold: " + ret);
-                           if((ret >= MIN_SINR_TH) &&
-                                   (ret <= MAX_SINR_TH))
-                              tv1.setText(" " + String.valueOf(ret));
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 10:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getSinrFirstStage();
-                           Log.d(LOGTAG, "Get Sinr First Stage: " + ret);
-                           if (ret >= MIN_SINR_FIRST_STAGE &&
-                                   ret <= MAX_SINR_FIRST_STAGE)
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 11:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getRmssiFirstStage();
-                           Log.d(LOGTAG, "Get Rmssi First Stage: " + ret);
-                           if (ret >= MIN_RMSSI_FIRST_STAGE &&
-                                   ret <= MAX_RMSSI_FIRST_STAGE)
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 12:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getCFOMeanTh();
-                           Log.d(LOGTAG, "Get CF0 Threshold: " + ret);
-                           if (ret >= MIN_CF0TH12 &&
-                                   ret <= MAX_CF0TH12)
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 13:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getSearchAlgoType();
-                           Log.d(LOGTAG, "Search Type: " + ret);
-                           if (ret == MPX_DCC)
-                               tv1.setText(R.string.search_algo_mpx);
-                           else if(ret == SINR_INTF)
-                               tv1.setText(R.string.search_algo_sinrint);
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 14:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_AfJmpRmssiTh);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_AfJmpRmssiTh);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetAfJmpRmssiThListener);
-                    }
-                    break;
-                case 15:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_GdChRmssiTh);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_GdChRmssiTh);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetGdChRmssiThListener);
-                    }
-                    break;
-                case 16:
-                    if (txtbox1 != null) {
-                       txtbox1.setText(R.string.type_rd);
-                       txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setText(R.string.enter_AfJmpRmssiSmplsCnt);
-                       tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setText(R.string.set_AfJmpRmssiSmplsCnt);
-                       SetButton.setVisibility(View.VISIBLE);
-                       SetButton.setOnClickListener(mOnSetAfJmpRmssiSmplsCntListener);
-                    }
-                    break;
-                case 17:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getAfJmpRmssiTh();
-                           Log.d(LOGTAG, "Get Af Jmp Rmssi Th: " + ret);
-                           if ((ret >= MIN_AF_JMP_RMSSI_TH) &&
-                                  (ret <= MAX_AF_JMP_RMSSI_TH))
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 18:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getGoodChRmssiTh();
-                           Log.d(LOGTAG, "Get GoodChRmssi Threshold: " + ret);
-                           if ((ret >= MIN_GD_CH_RMSSI_TH) &&
-                                  (ret <= MAX_GD_CH_RMSSI_TH))
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 19:
-                    if (txtbox1 != null) {
-                        txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText("");
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    try {
-                        if(mService != null) {
-                           ret = mService.getAfJmpRmssiSamplesCnt();
-                           Log.d(LOGTAG, "Get AfJmpRmssiSamples count: " + ret);
-                           if ((ret >= MIN_AF_JMP_RMSSI_SAMPLES) &&
-                                  (ret <= MAX_AF_JMP_RMSSI_SAMPLES))
-                               tv1.setText(" " + String.valueOf(ret));
-                        }
-                    }catch (RemoteException e) {
-
-                    }
-                    break;
-                case 20:
-                    tLayout.removeAllViewsInLayout();
-                    mNewRowIds = NEW_ROW_ID;
-                    tLayout.setVisibility(View.VISIBLE);
-                    if (txtbox1 != null) {
-                       txtbox1.setVisibility(View.INVISIBLE);
-                    }
-                    if (tv1 != null) {
-                       tv1.setVisibility(View.INVISIBLE);
-                    }
-                    if (SetButton != null) {
-                       SetButton.setVisibility(View.INVISIBLE);
-                    }
-                    if(button1 != null) {
-                       button1.setVisibility(View.INVISIBLE);
-                    }
-                    if(button2 != null) {
-                       button2.setVisibility(View.INVISIBLE);
-                    }
-                    adaptRfCfg.setDropDownViewResource(
-                              android.R.layout.simple_spinner_dropdown_item);
-                    spinOptionFmRf.setAdapter(adaptRfCfg);
-                    spinOptionFmRf.setOnItemSelectedListener(mSpinRfCfgListener);
-                    break;
-                case 21:
-                    if (txtbox1 != null) {
-                        txtbox1.setText(R.string.type_rd);
-                        txtbox1.setVisibility(View.VISIBLE);
-                    }
-                    if (tv1 != null) {
-                        tv1.setText(R.string.enter_RxRePeatCount);
-                        tv1.setVisibility(View.VISIBLE);
-                    }
-                    if (SetButton != null) {
-                        SetButton.setText(R.string.set_RxRePeatCount);
-                        SetButton.setVisibility(View.VISIBLE);
-                        SetButton.setOnClickListener(mOnSetRxRePeatCount);
-                    }
-                    break;
-            }
-        }
-        public void onNothingSelected(AdapterView<?> parent) {
-            // Do Nothing
-        }
-    }
-
-    public class RfCfgItemSelectedListener implements OnItemSelectedListener {
-        public void onItemSelected(AdapterView<?> parent,
-                                    View view, int pos, long id) {
-            Log.d("Table","onItemSelected is hit with "+pos);
-            tLayout.setVisibility(View.INVISIBLE);
-            if (mTestRunning)
-                stopCurTest();
-            switch(pos)
-            {
-                case 0:
-                case 1:
-                case 2:
-                case 3:
-                    mTestSelected = pos;
-                    tLayout.removeAllViewsInLayout();
-                    mNewRowIds = NEW_ROW_ID;
-                    tLayout.setVisibility(View.VISIBLE);
-                    RunButton = (Button)findViewById(R.id.Runbutton);
-                    if (RunButton != null) {
-                       RunButton.setText(R.string.test_run);
-                       RunButton.setVisibility(View.VISIBLE);
-                       RunButton.setOnClickListener(mOnRunListener);
-                    }
-                    if(mTestSelected == SWEEP_TEST) {
-                       enableBandSweepSetting();
-                    }else {
-                       disableBandSweepSetting();
-                    }
-                    break;
-                case 4:
-                    RunButton = (Button)findViewById(R.id.Runbutton);
-                    if (RunButton != null) {
-                       RunButton.setVisibility(View.INVISIBLE);
-                    }
-                    pbar = (ProgressBar) findViewById(R.id.progressbar);
-                    if (pbar != null) {
-                       pbar.setVisibility(View.INVISIBLE);
-                    }
-                    adaptCfgRf.setDropDownViewResource(
-                                     android.R.layout.simple_spinner_dropdown_item);
-                    spinOptionFmRf.setAdapter(adaptCfgRf);
-                    if(isTransportLayerSMD())
-                       spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener2);
-                    else
-                       spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener1);
-                    disableBandSweepSetting();
-                    break;
-            }
-        }
-
-        public void onNothingSelected(AdapterView<?> parent) {
-            // Do Nothing
-        }
-    }
-    public class FmRfItemSelectedListener implements OnItemSelectedListener {
-        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-            Log.d("Table","onItemSelected is hit with "+pos);
-            mTestSelected = pos;
-            tLayout.setVisibility(View.INVISIBLE);
-            chooseFMRFoption();
-        }
-        public void onNothingSelected(AdapterView<?> parent) {
-            // Do Nothing
-        }
-    }
-    private void checkTransportLayer() {
-        String transportLayer = "";
-
-        transportLayer = SystemProperties.get("ro.qualcomm.bt.hci_transport");
-        if(transportLayer.equals("smd"))
-           mIsTransportSMD = true;
-    }
-    private boolean isTransportLayerSMD() {
-        return mIsTransportSMD;
-    }
-    private void createResult(Result aRes) {
-        // Get the TableLayout
-        TableLayout tl = (TableLayout) findViewById(R.id.maintable);
-        if (tl == null) {
-           return;
-        }
-
-         /* Create a new row to be added. */
-        mNewRowIds++;
-        TableRow tr2 = new TableRow(getApplicationContext());
-        int width = getWindowManager().getDefaultDisplay().getWidth();
-        tr2.setLayoutParams(new LayoutParams(
-                     LayoutParams.FILL_PARENT,
-                     LayoutParams.WRAP_CONTENT));
-        tr2.setId(mNewRowIds);
-        /* Create a Button to be the row-content. */
-        TextView colFreq = new TextView(getApplicationContext());
-        colFreq.setText(aRes.getFreq());
-        colFreq.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
-        colFreq.setWidth(width/4);
-                /* Add Button to row. */
-        tr2.addView(colFreq);
-
-        TextView colRMSSI = new TextView(getApplicationContext());
-        colRMSSI.setText(aRes.getRSSI());
-        colRMSSI.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
-        colRMSSI.setWidth(width/4);
-        tr2.addView(colRMSSI);
-
-        TextView colIoC = new TextView(getApplicationContext());
-        colIoC.setText(aRes.getIoC());
-        colIoC.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
-        colIoC.setWidth(width/4);
-        tr2.addView(colIoC);
-        if(isTransportLayerSMD())
-        {
-             TextView colSINR = new TextView(getApplicationContext());
-             colSINR.setText(aRes.getSINR());
-             colSINR.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
-             colSINR.setWidth(width/4);
-             tr2.addView(colSINR);
-        } else
-        {
-             TextView colMpxDcc = new TextView(getApplicationContext());
-             colMpxDcc.setText(aRes.getMpxDcc());
-             colMpxDcc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
-             colMpxDcc.setWidth(width/4);
-             tr2.addView(colMpxDcc);
-        }
-          /* Add row to TableLayout. */
-          /* Add row to TableLayout. */
-        tl.addView(tr2,new TableLayout.LayoutParams(
-             LayoutParams.FILL_PARENT,
-             LayoutParams.WRAP_CONTENT));
-        if(null != mFileCursor)
-        {
-           try {
-                 StringBuilder tempStr = new StringBuilder();
-                 tempStr.append(String.format("%10s", aRes.getFreq()));
-                 tempStr.append(String.format("%10s", aRes.getRSSI()));
-                 tempStr.append(String.format("%10s", aRes.getIoC()));
-                 tempStr.append(String.format("%10s", aRes.getIntDet()));
-                 if(isTransportLayerSMD())
-                 {
-                    tempStr.append(String.format("%10s", aRes.getSINR()));
-                 } else
-                 {
-                    tempStr.append(String.format("%10s", aRes.getMpxDcc()));
-                 }
-                 tempStr.append("\r\n");
-                 String testStr = new String(tempStr);
-                 mFileCursor.write(testStr.getBytes());
-           } catch(IOException ioe) {
-                 ioe.printStackTrace();
-           }
-        }
-    }
-
-    private void runCurrentTest() {
-        Log.d(LOGTAG, "The test being run is" +mTestSelected);
-
-        //get test summary
-        String[] szTestInformation = getResources().getStringArray(
-                        R.array.rf_cfg);
-        final StringBuilder szbTestHeader = new StringBuilder();
-        szbTestHeader.append("running test:").append(szTestInformation[mTestSelected]);
-        szbTestHeader.append("\r\n");
-        String szTestHeader = new String(szbTestHeader);
-        if(null != mFileCursor ) {
-           try {
-                mFileCursor.write(szTestHeader.getBytes());
-           } catch (IOException ioe) {
-                ioe.printStackTrace();
-           }
-        }
-        switch(mTestSelected)
-        {
-        case CUR_FREQ_TEST:
-             Log.d(LOGTAG,"Current Freq test is going to run");
-             int freq = FmSharedPreferences.getTunedFrequency();
-             Result res = GetFMStatsForFreq(freq);
-             createResult(mColumnHeader);
-             if(res != null)
-                createResult(res);
-              mTestRunning = false;
-              break;
-        case CUR_MULTI_TEST:
-             /*Set it to ready to Stop*/
-             SetButtonState(false);
-             createResult(mColumnHeader);
-
-             if(mMultiUpdateThread == null) {
-                mMultiUpdateThread = new Thread(null, getMultipleResults,
-                                                 "MultiResultsThread");
-             }
-             /* Launch dummy thread to simulate the transfer progress */
-             Log.d(LOGTAG, "Thread State: " + mMultiUpdateThread.getState());
-             if(mMultiUpdateThread.getState() == Thread.State.TERMINATED) {
-                mMultiUpdateThread = new Thread(null, getMultipleResults,
-                                                 "MultiResultsThread");
-             }
-             /* If the thread state is "new" then the thread has not yet started */
-             if(mMultiUpdateThread.getState() == Thread.State.NEW) {
-                mMultiUpdateThread.start();
-             }
-             // returns and UI in different thread.
-             break;
-        case SEARCH_TEST:
-             try {
-                 Log.d(LOGTAG, "start scanning\n");
-                 if(isTransportLayerSMD()) {
-                    Log.d(LOGTAG,"Scanning with 0 scan time");
-                    if (mReceiver != null)
-                        mIsSearching = mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SCAN,
-                                           SCAN_DWELL_PERIOD, FmReceiver.FM_RX_SEARCHDIR_UP);
-                 }else {
-                    mIsSearching = mService.scan(0);
-                 }
-             }catch (RemoteException e) {
-                 e.printStackTrace();
-             }
-
-             if(mIsSearching) {
-                 /*Set it to Ready to Stop*/
-                 SetButtonState(false);
-                 createResult(mColumnHeader);
-                 Log.d(LOGTAG, "Created the results and cancel UI\n");
-             }else {
-                 mTestRunning = false;
-             }
-             break;
-        case SWEEP_TEST:
-             int Spacing = FmSharedPreferences.getChSpacing();
-             int lowerFreq = FmSharedPreferences.getLowerLimit();
-             int higherFreq = FmSharedPreferences.getUpperLimit();
-             try {
-                 Log.d(LOGTAG, "Going to set low side injection\n");
-                 mService.setHiLoInj(Lo);
-             }catch (RemoteException e) {
-                 e.printStackTrace();
-             }
-             /* Set it to Ready to stop*/
-             SetButtonState(false);
-             createResult(mColumnHeader);
-             getFMStatsInBand(lowerFreq, higherFreq, Spacing);
-             break;
-        }
-    }
-
-    /* Thread processing */
-    private Runnable getMultipleResults = new Runnable() {
-       public void run() {
-          /*Collect the data for the current frequency
-           20 times*/
-          int freq = FmSharedPreferences.getTunedFrequency();
-
-          for(int i = 0; i < 20; i++) {
-              try {
-                   Thread.sleep(500);
-                   Message updateUI = new Message();
-                   updateUI.what = STATUS_UPDATE;
-                   updateUI.obj = (Object)GetFMStatsForFreq(freq);
-                   if(updateUI.obj == null)
-                        break;
-                   mUIUpdateHandlerHandler.sendMessage(updateUI);
-              }catch (InterruptedException e) {
-                   /*break the loop*/
-                   break;
-              }
-            }
-            mTestRunning = false;
-            Message updateStop = new Message();
-            updateStop.what = STATUS_DONE;
-            mUIUpdateHandlerHandler.sendMessage(updateStop);
-       }
-    };
-
-    private void getFMStatsInBand(int lFreq, int hFreq, int Spacing) {
-       if(null == mBand) {
-          mBand = new Band();
-       }
-       mBand.lFreq = lFreq;
-       mBand.hFreq = hFreq;
-       mBand.cur_freq = lFreq;
-       if(Spacing == 0) {
-          mBand.Spacing = 200; // 200KHz
-       }else if(Spacing == 1) {
-          mBand.Spacing = 100; // 100KHz
-       }else {
-          mBand.Spacing = 50;
-       }
-
-       setAlarm(prevDelayTime * 1000, BAND_SWEEP_START_DELAY_TIMEOUT);
-    }
-
-    /* Thread processing */
-    private Runnable getManualSweepResults = new Runnable() {
-       public void run() {
-           mWakeLock.acquire(10 * 1000);
-           if(mBand.cur_freq <= mBand.hFreq) {
-              if(!tuneAndUpdateSweepResult(mBand.cur_freq)) {
-                 sendStatusDoneMsg();
-              }
-              mBand.cur_freq += mBand.Spacing;
-              if(mBand.cur_freq > mBand.hFreq) {
-                 sendStatusDoneMsg();
-              }else {
-                 setAlarm(prevDwellTime * 1000, BAND_SWEEP_DWELL_DELAY_TIMEOUT);
-              }
-           }else {
-              sendStatusDoneMsg();
-           }
-       }
-    };
-
-    private void sendStatusDoneMsg() {
-       mTestRunning = false;
-       Message updateStop = new Message();
-       updateStop.what = STATUS_DONE;
-       try {
-           Log.d(LOGTAG, "Going to set auto hi-lo injection\n");
-           mService.setHiLoInj(Auto);
-       } catch (RemoteException e) {
-           e.printStackTrace();
-       }
-       if(mUIUpdateHandlerHandler != null) {
-          Log.d(LOGTAG, "Sending message to stop test");
-          mUIUpdateHandlerHandler.sendMessage(updateStop);
-       }
-    }
-
-    private Runnable getFileSweepResults = new Runnable() {
-       public void run() {
-         boolean status = true;
-         int freq;
-
-         mWakeLock.acquire(10 * 1000);
-         freq = mNextFreqInterface.getNextFreq();
-
-         for(; (status = (!mNextFreqInterface.errorOccured()) & (!Thread.currentThread().isInterrupted()));
-                  freq = mNextFreqInterface.getNextFreq()) {
-            if(validFreq(freq)) {
-               if(!tuneAndUpdateSweepResult(freq)) {
-                  status = false;
-                  break;
-               }else {
-                  setAlarm(prevDwellTime * 1000, BAND_SWEEP_DWELL_DELAY_TIMEOUT);
-                  break;
-               }
-            }
-         }
-         if(!status) {
-            sendStatusDoneMsg();
-            mNextFreqInterface.Stop();
-            mNextFreqInterface = null;
-         }
-       }
-    };
-
-    private boolean validFreq(int freq) {
-       if((freq >= mBand.lFreq) &&
-          (((freq - mBand.lFreq) / mBand.Spacing) >= 0)) {
-           return true;
-       }else {
-           return false;
-       }
-    }
-
-    private boolean tuneAndUpdateSweepResult(int freq) {
-       try {
-            if(!mService.tune(freq)) {
-               Log.e(LOGTAG, "tune failed");
-               return false;
-            }
-            mSync = new Band();
-            synchronized(mSync) {
-                mSync.wait(); //wait till notified
-            }
-            mSync = null;
-            Message updateUI = new Message();
-            updateUI.what = STATUS_UPDATE;
-            updateUI.obj = (Object)GetFMStatsForFreq(freq);
-            if(updateUI.obj == null) {
-               return false;
-            }else {
-               mUIUpdateHandlerHandler.sendMessage(updateUI);
-               Log.d(LOGTAG,"highFerq is " + mBand.hFreq);
-            }
-       }catch (RemoteException e) {
-            Log.e(LOGTAG, "SweepResults:Tune failed\n");
-            return false;
-       }catch (InterruptedException e) {
-            return false;
-       }
-       return true;
-    }
-
-    private Result GetFMStatsForFreq(int freq)
-    {
-        Result result = new Result();
-        Log.d(LOGTAG,"freq is "+freq);
-        result.setFreq(Integer.toString(freq));
-        byte nRssi = 0;
-        int nIoC = 0;
-        int dummy = 0;
-        int nIntDet = 0;
-        int nMpxDcc = 0;
-        byte nSINR = 0;
-        if((null != mService)) {
-           try {
-               dummy = mService.getRssi();
-               if (dummy != Integer.MAX_VALUE) {
-                   nRssi = (byte)dummy;
-                   result.setRSSI(Byte.toString(nRssi));
-               } else {
-                   return null;
-               }
-           } catch (RemoteException e) {
-               e.printStackTrace();
-           }
-
-           try {
-               nIoC = mService.getIoC();
-               if (nIoC != Integer.MAX_VALUE)
-                   result.setIoC(Integer.toString(nIoC));
-               else
-                   return null;
-           } catch (RemoteException e) {
-               e.printStackTrace();
-           }
-
-           if(isTransportLayerSMD()) {
-              try {
-                  dummy = mService.getSINR();
-                  if (dummy != Integer.MAX_VALUE) {
-                      nSINR = (byte)dummy;
-                      result.setSINR(Integer.toString(nSINR));
-                  } else {
-                      return null;
-                  }
-              } catch (RemoteException e) {
-                  e.printStackTrace();
-              }
-           } else {
-              try {
-                  nMpxDcc = mService.getMpxDcc();
-                  if (nMpxDcc != Integer.MAX_VALUE)
-                      result.setMpxDcc(Integer.toString(nMpxDcc));
-                  else
-                      return null;
-              } catch (RemoteException e) {
-                  e.printStackTrace();
-              }
-           }
-
-           try {
-               nIntDet = mService.getIntDet();
-               if (nIntDet != Integer.MAX_VALUE)
-                   result.setIntDet(Integer.toString(nIntDet));
-               else
-                   return null;
-           } catch (RemoteException e) {
-               e.printStackTrace();
-           }
-        } else {
-           return null;
-        }
-        return result;
-   }
-
-
-    private Handler mUIUpdateHandlerHandler = new Handler() {
-            public void handleMessage(Message msg) {
-               switch (msg.what)
-               {
-               case STATUS_UPDATE:
-                    Result myRes = (Result) msg.obj;
-                    Log.d(LOGTAG,"Status update is" +myRes.mFreq);
-                    createResult(myRes);
-                    break;
-               case STATUS_DONE:
-                    SetButtonState(true);
-                    break;
-               case RECORDTIMER_EXPIRED:
-                    Log.d(LOGTAG, "mUIUpdateHandlerHandler - RECORDTIMER_EXPIRED");
-                    if(!isRecording()) {
-                       Log.d(LOGTAG, "Stop Recording");
-                       stopRecording();
-                    }
-                   break;
-               case RECORDTIMER_UPDATE:
-                   Log.d(LOGTAG, "mUIUpdateHandlerHandler - RECORDTIMER_UPDATE");
-                   updateExpiredRecordTime();
-                   break;
-               }
-            }
-    };
-
-    public static IFMRadioService sService = null;
-    private static HashMap<Context, ServiceBinder> sConnectionMap = new HashMap<Context, ServiceBinder>();
-
-    public static boolean bindToService(Context context) {
-       Log.e(LOGTAG, "bindToService: Context");
-       return bindToService(context, null);
-    }
-
-    public static boolean bindToService(Context context, ServiceConnection callback) {
-       Log.e(LOGTAG, "bindToService: Context with serviceconnection callback");
-       context.startService(new Intent(context, FMRadioService.class));
-       ServiceBinder sb = new ServiceBinder(callback);
-       sConnectionMap.put(context, sb);
-       return context.bindService((new Intent()).setClass(context,
-                                                          FMRadioService.class), sb, 0);
-    }
-
-    public static void unbindFromService(Context context) {
-       ServiceBinder sb = (ServiceBinder) sConnectionMap.remove(context);
-       Log.e(LOGTAG, "unbindFromService: Context");
-       if (sb == null)
-       {
-          Log.e(LOGTAG, "Trying to unbind for unknown Context");
-          return;
-       }
-       context.unbindService(sb);
-       if (sConnectionMap.isEmpty())
-       {
-          // presumably there is nobody interested in the service at this point,
-          // so don't hang on to the ServiceConnection
-          sService = null;
-       }
-    }
-
-    private static class ServiceBinder implements ServiceConnection
-    {
-       ServiceConnection mCallback;
-       ServiceBinder(ServiceConnection callback) {
-          mCallback = callback;
-       }
-
-       public void onServiceConnected(ComponentName className, android.os.IBinder service) {
-          sService = IFMRadioService.Stub.asInterface(service);
-          if (mCallback != null)
-          {
-             Log.e(LOGTAG, "onServiceConnected: mCallback");
-             mCallback.onServiceConnected(className, service);
-          }
-       }
-
-       public void onServiceDisconnected(ComponentName className) {
-          if (mCallback != null)
-          {
-             mCallback.onServiceDisconnected(className);
-          }
-          sService = null;
-       }
-    }
-
-
-    private ServiceConnection osc = new ServiceConnection() {
-          public void onServiceConnected(ComponentName classname, IBinder obj) {
-             mService = IFMRadioService.Stub.asInterface(obj);
-             Log.e(LOGTAG, "ServiceConnection: onServiceConnected: ");
-             if (mService != null)
-             {
-                try
-                {
-                   mService.registerCallbacks(mServiceCallbacks);
-
-                } catch (RemoteException e)
-                {
-                   e.printStackTrace();
-                }
-                if(isRecording()) {
-                   initiateRecordThread();
-                }
-                return;
-             } else
-             {
-                Log.e(LOGTAG, "IFMRadioService onServiceConnected failed");
-             }
-             finish();
-          }
-          public void onServiceDisconnected(ComponentName classname) {
-          }
-       };
-
-
-       private IFMRadioServiceCallbacks.Stub  mServiceCallbacks = new IFMRadioServiceCallbacks.Stub()
-       {
-          public void onEnabled()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onEnabled :");
-             invalidateOptionsMenu();
-          }
-
-          public void onDisabled()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onDisabled :");
-             stopAllOperations();
-          }
-
-          public void onRadioReset()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onRadioReset :");
-             stopAllOperations();
-          }
-
-          public void onTuneStatusChanged()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onTuneStatusChanged :");
-             if (mTestRunning)
-                 mHandler.post(mTuneComplete);
-          }
-
-          public void onProgramServiceChanged()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onProgramServiceChanged :");
-          }
-
-          public void onRadioTextChanged()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onRadioTextChanged :");
-          }
-          public void onExtenRadioTextChanged()
-          {
-             Log.d(LOGTAG, "Extended Radio Text changed:");
-          }
-          public void onAlternateFrequencyChanged()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onAlternateFrequencyChanged :");
-          }
-
-          public void onSignalStrengthChanged()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onSignalStrengthChanged :");
-          }
-
-          public void onSearchComplete()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onSearchComplete :");
-             /*Stop the update*/
-             mTestRunning = false;
-             Message updateStop = new Message();
-             updateStop.what = STATUS_DONE;
-             mUIUpdateHandlerHandler.sendMessage(updateStop);
-          }
-          public void onSearchListComplete()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onSearchListComplete :");
-
-          }
-
-          public void onMute(boolean bMuted)
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onMute :" + bMuted);
-          }
-
-          public void onAudioUpdate(boolean bStereo)
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onAudioUpdate :" + bStereo);
-          }
-
-          public void onStationRDSSupported(boolean bRDSSupported)
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onStationRDSSupported :" + bRDSSupported);
-          }
-          public void onRecordingStopped()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onDisabled :");
-             stopRecording();
-          }
-          public void onFinishActivity()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onFinishActivity:");
-          }
-          public void onRecordingStarted()
-          {
-             Log.d(LOGTAG, "mServiceCallbacks.onRecordingStarted:");
-             int durationInMins = FmSharedPreferences.getRecordDuration();
-             Log.e(LOGTAG, " Fected duration: " + durationInMins);
-             initiateRecordDurationTimer(durationInMins);
-             invalidateOptionsMenu();
-          }
-      };
-      /* Radio Vars */
-     final Handler mHandler = new Handler();
-
-     final Runnable mTuneComplete = new Runnable(){
-         public void run(){
-             if((null != mMultiUpdateThread) &&(null != mSync))
-             {
-                 synchronized(mSync){
-                     mSync.notify();
-                 }
-             }
-            if((mTestSelected == SEARCH_TEST) && (mService != null)) {
-                /* On every Tune Complete generate the result for the current
-                Frequency*/
-                Message updateUI = new Message();
-                updateUI.what = STATUS_UPDATE;
-                int freq = FmSharedPreferences.getTunedFrequency();
-                updateUI.obj = (Object)GetFMStatsForFreq(freq);
-                if (updateUI.obj == null)
-                    updateUI.what = STATUS_DONE;
-                mUIUpdateHandlerHandler.sendMessage(updateUI);
-            }
-         }
-     };
-
-     private void stopCurTest() {
-         if (mTestRunning) {
-             switch(mTestSelected) {
-             case CUR_FREQ_TEST:
-                  break;
-             case SWEEP_TEST:
-                  stopBandSweep();
-                  sendStatusDoneMsg();
-                  break;
-             case CUR_MULTI_TEST:
-                  if (mMultiUpdateThread != null)
-                      mMultiUpdateThread.interrupt();
-                  break;
-             case SEARCH_TEST:
-                  mHandler.removeCallbacks(mTuneComplete);
-                  if (mService != null) {
-                      try {
-                           Message updateStop = new Message();
-                           updateStop.what = STATUS_DONE;
-                           mUIUpdateHandlerHandler.sendMessage(updateStop);
-                           mService.cancelSearch();
-                      } catch (RemoteException e) {
-                           e.printStackTrace();
-                      }
-                  }
-                  break;
-             }
-             mTestRunning = false;
-         }
-     }
-
-     @Override
-     protected Dialog onCreateDialog(int id) {
-         AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-         switch(id)
-         {
-         case DIALOG_BAND_SWEEP_SETTING:
-              return createBandSweepDialog(id, dlgBuilder);
-         }
-         return null;
-     }
-
-     private Dialog createBandSweepDialog(int id, AlertDialog.Builder dlgBuilder) {
-         LayoutInflater inflater = LayoutInflater.from(this);
-         final View listview = inflater.inflate(R.layout.band_sweep_setting, null);
-         spinOptionBandSweepMthds = (Spinner)listview.findViewById(R.id.band_sweep_spinner);
-         final EditText delayBox = (EditText)listview.findViewById(R.id.txtboxDelayTime);
-         final EditText dwellBox = (EditText)listview.findViewById(R.id.txtboxDwellTime);
-
-         if(delayBox != null) {
-            delayBox.setText("" + prevDelayTime);
-         }
-         if(dwellBox != null) {
-            dwellBox.setText("" + prevDwellTime);
-         }
-         if(spinOptionBandSweepMthds != null) {
-            spinOptionBandSweepMthds.setAdapter(bandSweepMthds);
-            spinOptionBandSweepMthds.setOnItemSelectedListener(mSweepMthdsListener);
-            spinOptionBandSweepMthds.setSelection(prevSweepMthd);
-         }else {
-            Log.e(LOGTAG, "could not find spinner for methods\n");
-         }
-         dlgBuilder.setView(listview)
-                .setPositiveButton(R.string.band_sweep_setting_set, new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int id) {
-                        prevSweepMthd = curSweepMthd;
-                        if(delayBox != null) {
-                           String s = delayBox.getText().toString();
-                           prevDelayTime = Integer.parseInt(s);
-                        }
-                        if(dwellBox != null) {
-                           String s = dwellBox.getText().toString();
-                           prevDwellTime = Integer.parseInt(s);
-                        }
-                        removeDialog(DIALOG_BAND_SWEEP_SETTING);
-                    }
-                })
-                .setNegativeButton(R.string.band_sweep_setting_cancel, new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int id) {
-                        removeDialog(DIALOG_BAND_SWEEP_SETTING);
-                    }
-                });
-         return dlgBuilder.create();
-     }
-
-    private View.OnClickListener mClicktBandSweepSettingListener = new View.OnClickListener() {
-         public void onClick(View v) {
-            showDialog(DIALOG_BAND_SWEEP_SETTING);
-         }
-    };
-
-    private void enableBandSweepSetting() {
-         if(bandSweepSettingButton != null) {
-            bandSweepSettingButton.setEnabled(true);
-            bandSweepSettingButton.setVisibility(View.VISIBLE);
-         }
-    }
-
-    private void disableBandSweepSetting() {
-         if(bandSweepSettingButton != null) {
-            bandSweepSettingButton.setEnabled(false);
-            bandSweepSettingButton.setVisibility(View.INVISIBLE);
-         }
-    }
-
-    public class BandSweepMthdsSelectedListener implements OnItemSelectedListener {
-        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-            Log.d("Band Sweep Methods","onItemSelected is hit with " + pos);
-            curSweepMthd = pos;
-        }
-
-        public void onNothingSelected(AdapterView<?> parent) {
-            // Do Nothing
-        }
-    }
-
-    private void registerBandSweepDelayExprdListener() {
-        if(mBandSweepDelayExprdListener == null) {
-           mBandSweepDelayExprdListener = new BroadcastReceiver() {
-              @Override
-               public void onReceive(Context context, Intent intent) {
-                   Log.d(LOGTAG, "Received Band sweep delay expired");
-                   mWakeLock.acquire(5 * 1000);
-                   StartBandSweep();
-               }
-           };
-           IntentFilter intentFilter = new IntentFilter(BAND_SWEEP_START_DELAY_TIMEOUT);
-           registerReceiver(mBandSweepDelayExprdListener, intentFilter);
-        }
-    }
-
-    private void registerBandSweepDwellExprdListener() {
-        if(mBandSweepDwellExprdListener == null) {
-           mBandSweepDwellExprdListener = new BroadcastReceiver() {
-              @Override
-               public void onReceive(Context context, Intent intent) {
-                   Log.d(LOGTAG, "received Band sweep Dwell expired");
-                   mWakeLock.acquire(5 * 1000);
-                   ResumeBandSweep();
-               }
-           };
-           IntentFilter intentFilter = new IntentFilter(BAND_SWEEP_DWELL_DELAY_TIMEOUT);
-           registerReceiver(mBandSweepDwellExprdListener, intentFilter);
-        }
-    }
-
-    private void unRegisterBroadcastReceiver(BroadcastReceiver receiver) {
-        if(receiver != null) {
-           unregisterReceiver(receiver);
-           receiver = null;
-        }
-    }
-
-    private void setAlarm(long duration, String action) {
-        Intent i = new Intent(action);
-        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
-    }
-
-    private void cancelAlarm(String action) {
-        Intent i = new Intent(action);
-        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
-        am.cancel(pi);
-    }
-
-    private void StartBandSweep() {
-       if(mMultiUpdateThread == null ||
-            (mMultiUpdateThread.getState() == Thread.State.TERMINATED)) {
-          if(prevSweepMthd == 0) {
-             mMultiUpdateThread = new Thread(null, getManualSweepResults,
-                                           "MultiResultsThread");
-          }else {
-             mNextFreqInterface = new CommaSeparatedFreqFileReader(getFilesDir() + FREQ_LIST_FILE_NAME);
-             mMultiUpdateThread = new Thread(null, getFileSweepResults,
-                                           "MultiResultsThread");
-          }
-       }
-
-       /* If the thread state is "new" then the thread has not yet started */
-       if(mMultiUpdateThread.getState() == Thread.State.NEW) {
-          mMultiUpdateThread.start();
-       }
-    }
-
-    private void ResumeBandSweep() {
-       if(mMultiUpdateThread == null ||
-            (mMultiUpdateThread.getState() == Thread.State.TERMINATED)) {
-          if(prevSweepMthd == 0) {
-             mMultiUpdateThread = new Thread(null, getManualSweepResults,
-                                           "MultiResultsThread");
-          }else {
-             mMultiUpdateThread = new Thread(null, getFileSweepResults,
-                                           "MultiResultsThread");
-          }
-       }
-
-       /* If the thread state is "new" then the thread has not yet started */
-       if(mMultiUpdateThread.getState() == Thread.State.NEW) {
-          mMultiUpdateThread.start();
-       }
-    }
-
-    private void stopBandSweep() {
-       cancelAlarm(BAND_SWEEP_START_DELAY_TIMEOUT);
-       cancelAlarm(BAND_SWEEP_DWELL_DELAY_TIMEOUT);
-       if(mMultiUpdateThread != null) {
-          mMultiUpdateThread.interrupt();
-       }
-       if(mNextFreqInterface != null) {
-          mNextFreqInterface.Stop();
-          mNextFreqInterface = null;
-       }
-    }
-
-    public boolean isRecording() {
-       if(mService == null)
-          return false;
-       try {
-            return mService.isFmRecordingOn();
-       }catch(RemoteException e) {
-            return false;
-       }
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        MenuInflater inflater = getMenuInflater();
-        inflater.inflate(R.menu.menu_rf_stats, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-        MenuItem item;
-
-        item = menu.findItem(R.id.menu_recording);
-        if(item != null && !isRecording()) {
-           item.setTitle(R.string.menu_record_start);
-           item.setEnabled(isFmOn());
-        }else if(item != null) {
-           item.setTitle(R.string.menu_record_stop);
-           setRecordDurationDisplay(menu, R.id.menu_record_duration);
-        }
-        return true;
-    }
-
-    private void setRecordDurationDisplay(Menu menu, int id) {
-       MenuItem item;
-       long timeNow;
-       long seconds;
-
-       if(menu == null)
-          return;
-       item = menu.findItem(id);
-       if(item != null) {
-          timeNow = SystemClock.elapsedRealtime();
-          seconds = (timeNow - getRecordingStartTime()) / 1000;
-          item.setTitle(makeTimeString(seconds));
-       }
-    }
-
-    private void startRecording() {
-      if(isFmOn()) {
-         try {
-              mService.startRecording();
-         }catch(RemoteException e) {
-              e.printStackTrace();
-         }
-      }
-    }
-
-    private void stopRecording() {
-       if(null != mRecordUpdateHandlerThread) {
-          mRecordUpdateHandlerThread.interrupt();
-       }
-       if(mService != null) {
-          try {
-               mService.stopRecording();
-           }catch (RemoteException e) {
-               e.printStackTrace();
-           }
-        }
-        invalidateOptionsMenu();
-    }
-
-    private long getRecordingStartTime() {
-       if(mService == null)
-          return 0;
-       try {
-            return mService.getRecordingStartTime();
-       }catch(RemoteException e) {
-            return 0;
-       }
-    }
-
-    private void initiateRecordDurationTimer(long mins ) {
-       Log.d(LOGTAG, "Stop Recording in mins : " + mins);
-       initiateRecordThread();
-    }
-
-    private void initiateRecordThread() {
-      if(mRecordUpdateHandlerThread == null) {
-         mRecordUpdateHandlerThread = new Thread(null, doRecordProcessing,
-                                                "RecordUpdateThread");
-      }
-      /* Launch the dummy thread to simulate the transfer progress */
-      Log.d(LOGTAG, "Thread State: " + mRecordUpdateHandlerThread.getState());
-      if(mRecordUpdateHandlerThread.getState() == Thread.State.TERMINATED) {
-         mRecordUpdateHandlerThread = new Thread(null, doRecordProcessing,
-                                                "RecordUpdateThread");
-      }
-      /* If the thread state is "new" then the thread has not yet started */
-      if(mRecordUpdateHandlerThread.getState() == Thread.State.NEW) {
-         mRecordUpdateHandlerThread.start();
-      }
-   }
-
-   /* Recorder Thread processing */
-   private Runnable doRecordProcessing = new Runnable() {
-      public void run() {
-         while(isRecording() &&
-                 (!Thread.currentThread().isInterrupted())) {
-               try {
-                    Thread.sleep(500);
-                    Message statusUpdate = new Message();
-                    statusUpdate.what = RECORDTIMER_UPDATE;
-                    mUIUpdateHandlerHandler.sendMessage(statusUpdate);
-               }catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-               }
-               if(!isRecording()) {
-                  Message finished = new Message();
-                  finished.what = RECORDTIMER_EXPIRED;
-                  mUIUpdateHandlerHandler.sendMessage(finished);
-               }
-         }
-      }
-   };
-
-   private void updateExpiredRecordTime() {
-      int vis = View.VISIBLE;
-      if(isRecording()) {
-         invalidateOptionsMenu();
-      }
-   }
-
-   private String makeTimeString(long secs) {
-      String durationformat = getString(R.string.durationformat);
-
-      /** Provide multiple arguments so the format can be changed easily by
-       *  modifying the xml.
-       **/
-      sFormatBuilder.setLength(0);
-
-      final Object[] timeArgs = sTimeArgs;
-      timeArgs[0] = secs / 3600;
-      timeArgs[1] = secs / 60;
-      timeArgs[2] = (secs / 60) % 60;
-      timeArgs[3] = secs;
-      timeArgs[4] = secs % 60;
-
-      return sFormatter.format(durationformat, timeArgs).toString();
-   }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch(item.getItemId())
-        {
-          case R.id.menu_recording:
-               if(isRecording()) {
-                  stopRecording();
-               }else {
-                  startRecording();
-               }
-               break;
-        }
-        return true;
-    }
-
-    private boolean isFmOn() {
-       boolean status = false;
-
-       if(mService != null) {
-          try {
-               status = mService.isFmOn();
-          }catch(RemoteException e) {
-          }
-       }
-       return status;
-    }
-
-    private void stopAllOperations() {
-       stopCurTest();
-       stopRecording();
-    }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMTransmitterActivity.java b/fmapp/src/com/codeaurora/fmradio/FMTransmitterActivity.java
deleted file mode 100644
index f21ed00..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMTransmitterActivity.java
+++ /dev/null
@@ -1,1477 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.media.AudioManager;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView; //import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-import android.text.TextUtils; //import android.app.ProgressDialog;
-
-import java.lang.ref.WeakReference; //import java.text.DecimalFormat;
-import java.util.HashMap;
-import java.util.ArrayList;
-
-import com.codeaurora.utils.FrequencyPicker;
-import com.codeaurora.utils.FrequencyPickerDialog;
-import android.content.ServiceConnection;
-
-import qcom.fmradio.FmConfig;
-import android.os.ServiceManager;
-
-public class FMTransmitterActivity extends Activity {
-        public static final String LOGTAG = "FMTransmitterActivity";
-
-        /* menu Identifiers */
-        private static final int MENU_SCAN_START = Menu.FIRST + 1;
-        private static final int MENU_SCAN_STOP = Menu.FIRST + 2;
-        private static final int MENU_SETTINGS = Menu.FIRST + 3;
-
-        /* Dialog Identifiers */
-        private static final int DIALOG_PRESET_LIST_AUTO_SET = 1;
-        private static final int DIALOG_PICK_FREQUENCY = 2;
-        private static final int DIALOG_PRESET_OPTIONS = 3;
-        private static final int DIALOG_PROGRESS_PROGRESS = 5;
-        private static final int DIALOG_CMD_FAILED_HDMI_ON = 14;
-        /* Activity Return ResultIdentifiers */
-        private static final int ACTIVITY_RESULT_SETTINGS = 1;
-
-        private static final int MAX_PRESETS = 6;
-        private static IFMTransmitterService mService = null;
-        private static FmSharedPreferences mPrefs;
-
-        /* Button Resources */
-        private ImageButton mOnOffButton;
-        /* 6 Preset Buttons */
-        private Button[] mPresetButtons = { null, null, null, null, null, null };
-        private int[] mPresetFrequencies = { 0, 0, 0, 0, 0, 0 };
-        // private ImageButton mSearchButton;
-        private ImageView mForwardButton;
-        private ImageView mBackButton;
-
-        /* row in the station info layout */
-        private TextView mTransmitStaticMsgTV;
-        private TextView mTuneStationFrequencyTV;
-
-        /* Bottom row in the station info layout */
-        private TextView mRadioTextTV;
-
-        /* Current Status Indicators */
-        private static boolean mIsSearching = false;
-        private static boolean mSearchingResultStatus = false;
-
-
-        private boolean mInternalAntennaAvailable = false;
-
-        private Animation mAnimation = null;
-        private ScrollerText mRadioTextScroller = null;
-
-        private static int mTunedFrequency = 0;;
-        private int mPresetButtonIndex = -1;
-        private String mMetaData = null;
-        private String mPSData = null;
-
-        /* Radio Vars */
-        final Handler mHandler = new Handler();
-        private final Handler enableRadioHandler = new Handler();
-        private final Handler disableRadioHandler = new Handler();
-
-        /* Search Progress Dialog */
-        private ProgressDialog mProgressDialog = null;
-
-        private LoadedDataAndState SavedDataAndState = null;
-
-        /** Called when the activity is first created. */
-        @Override
-        public void onCreate(Bundle savedInstanceState) {
-
-                super.onCreate(savedInstanceState);
-                mPrefs = new FmSharedPreferences(this);
-                Log.d(LOGTAG, "onCreate - Height : "
-                                + getWindowManager().getDefaultDisplay().getHeight()
-                                + " - Width  : "
-                                + getWindowManager().getDefaultDisplay().getWidth());
-                setContentView(R.layout.fmtransmitter);
-                SavedDataAndState = (LoadedDataAndState)getLastNonConfigurationInstance();
-                mAnimation = AnimationUtils.loadAnimation(this, R.anim.preset_select);
-
-                mOnOffButton = (ImageButton) findViewById(R.id.btn_onoff);
-                if (mOnOffButton != null) {
-                   mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
-                }
-
-                mForwardButton = (ImageView) findViewById(R.id.btn_forward);
-                if (mForwardButton != null) {
-                   mForwardButton.setOnClickListener(mForwardClickListener);
-                }
-
-                mBackButton = (ImageView) findViewById(R.id.btn_back);
-                if (mBackButton != null) {
-                   mBackButton.setOnClickListener(mBackClickListener);
-                }
-
-                /* Preset Buttons */
-                mPresetButtons[0] = (Button) findViewById(R.id.presets_button_1);
-                mPresetButtons[1] = (Button) findViewById(R.id.presets_button_2);
-                mPresetButtons[2] = (Button) findViewById(R.id.presets_button_3);
-                mPresetButtons[3] = (Button) findViewById(R.id.presets_button_4);
-                mPresetButtons[4] = (Button) findViewById(R.id.presets_button_5);
-                mPresetButtons[5] = (Button) findViewById(R.id.presets_button_6);
-                for (int nButton = 0; nButton < MAX_PRESETS; nButton++) {
-                    if (mPresetButtons[nButton] != null) {
-                       mPresetButtons[nButton]
-                               .setOnClickListener(mPresetButtonClickListener);
-                       mPresetButtons[nButton]
-                                .setOnLongClickListener(mPresetButtonOnLongClickListener);
-                    }
-                }
-
-                mTransmitStaticMsgTV = (TextView) findViewById(R.id.transmit_msg_tv);
-                String str = getString(R.string.transmit_msg_string);
-                if(null != mPSData ) {
-                    str = mPSData.concat("\n").concat(str);
-                }
-                if (mTransmitStaticMsgTV != null) {
-                   mTransmitStaticMsgTV.setText(str);
-                }
-
-                mTuneStationFrequencyTV = (TextView) findViewById(R.id.prog_frequency_tv);
-                if (mTuneStationFrequencyTV != null) {
-                        mTuneStationFrequencyTV
-                                        .setOnLongClickListener(mFrequencyViewClickListener);
-                }
-
-                mRadioTextTV = (TextView) findViewById(R.id.radio_text_tv);
-
-                if ((mRadioTextScroller == null) && (mRadioTextTV != null)) {
-                        mRadioTextScroller = new ScrollerText(mRadioTextTV);
-                }
-
-                enableRadioOnOffUI(false);
-                //HDMI and FM concurrecny is not supported.
-                if (isHdmiOn())
-                {
-                    showDialog(DIALOG_CMD_FAILED_HDMI_ON);
-                }
-                else {
-                    if (false == bindToService(this, osc))
-                    {
-                        Log.d(LOGTAG, "onCreate: Failed to Start Service");
-                    } else
-                    {
-                        Log.d(LOGTAG, "onCreate: Start Service completed successfully");
-                    }
-                }
-        }
-
-        @Override
-        public void onRestart() {
-                Log.d(LOGTAG, "onRestart");
-                super.onRestart();
-        }
-
-        @Override
-        public void onStop() {
-                Log.d(LOGTAG, "onStop");
-                super.onStop();
-        }
-
-        @Override
-        public void onStart() {
-                super.onStart();
-                Log.d(LOGTAG, "onStart");
-                try {
-                        if (mService != null) {
-                                mService.registerCallbacks(mServiceCallbacks);
-                        }
-                } catch (RemoteException e) {
-                        e.printStackTrace();
-                }
-
-        }
-
-        @Override
-        protected void onPause() {
-                super.onPause();
-                mRadioTextScroller.stopScroll();
-                SavePreferences();
-        }
-
-        private static final String TX_PREF_LAST_TUNED_FREQUENCY = "last_tx_frequency";
-        private static final String TX_PRESET_FREQUENCY = "tx_preset_freq_";
-    private static final int DEFAULT_NO_FREQUENCY = 98100;
-
-        public void SavePreferences() {
-                Log.d(LOGTAG, "Save preferences ");
-                SharedPreferences sp = getPreferences(Context.MODE_PRIVATE);
-                SharedPreferences.Editor ed = sp.edit();
-
-                ed.putInt(TX_PREF_LAST_TUNED_FREQUENCY, mTunedFrequency);
-
-                for (int presetIndex = 0; presetIndex < MAX_PRESETS; presetIndex++) {
-                        ed.putInt(TX_PRESET_FREQUENCY + presetIndex,
-                                        mPresetFrequencies[presetIndex]);
-                }
-                ed.commit();
-        }
-
-        public void LoadPreferences() {
-                SharedPreferences sp = getPreferences(Context.MODE_PRIVATE);
-        mTunedFrequency = sp.getInt(TX_PREF_LAST_TUNED_FREQUENCY, DEFAULT_NO_FREQUENCY);
-                for (int presetIndex = 0; presetIndex < MAX_PRESETS; presetIndex++) {
-                        mPresetFrequencies[presetIndex] =
-                                sp.getInt(TX_PRESET_FREQUENCY + presetIndex, DEFAULT_NO_FREQUENCY);
-                }
-        }
-
-        @Override
-        public void onResume() {
-                super.onResume();
-                LoadPreferences();
-                try {
-                    if((null != mService )&&mService.isFmOn()) {
-                        mHandler.post(mUpdateRadioText);
-                    }
-                } catch(RemoteException ex){
-                    Log.d(LOGTAG,"expection for service");
-                }
-                mHandler.post(mUpdateRadioText);
-                updateStationInfoToUI();
-                enableRadioOnOffUI();
-        }
-
-        @Override
-        public void onDestroy() {
-                unbindFromService(this);
-                mService = null;
-
-                Log.d(LOGTAG, "onDestroy: unbindFromService completed");
-                super.onDestroy();
-        }
-
-        private class LoadedDataAndState {
-                public LoadedDataAndState(){};
-                public boolean onOrOff;
-        }
-
-        @Override
-        public Object onRetainNonConfigurationInstance() {
-                final LoadedDataAndState data = new LoadedDataAndState();
-                if(mService != null) {
-                   try {
-                       data.onOrOff = mService.isFmOn();
-                   } catch(RemoteException e) {
-                       data.onOrOff = false;
-                       e.printStackTrace();
-                   }
-                } else {
-                   data.onOrOff = false;
-                }
-                return data;
-        }
-
-        @Override
-        public boolean onCreateOptionsMenu(Menu menu) {
-                super.onCreateOptionsMenu(menu);
-                MenuItem item;
-                boolean radioOn = isFmOn();
-                boolean searchActive = isSearchActive();
-
-                item = menu.add(0, MENU_SCAN_START, 0, R.string.menu_scan_for_preset)
-                                .setIcon(R.drawable.ic_btn_search);
-                if (item != null) {
-                        item.setVisible(!searchActive && radioOn);
-                }
-                item = menu.add(0, MENU_SCAN_STOP, 0, R.string.menu_scan_stop).setIcon(
-                                R.drawable.ic_btn_search);
-                if (item != null) {
-                        item.setVisible(searchActive && radioOn);
-                }
-
-                /* Settings can be active */
-                item = menu.add(0, MENU_SETTINGS, 0, R.string.menu_settings).setIcon(
-                                android.R.drawable.ic_menu_preferences);
-                return true;
-        }
-
-        @Override
-        public boolean onPrepareOptionsMenu(Menu menu) {
-                super.onPrepareOptionsMenu(menu);
-
-                MenuItem item;
-                boolean radioOn = isFmOn();
-                boolean searchActive = isSearchActive();
-
-                item = menu.findItem(MENU_SCAN_START);
-                if (item != null) {
-                        item.setVisible(!searchActive && radioOn);
-                }
-                item = menu.findItem(MENU_SCAN_STOP);
-                if (item != null) {
-                        item.setVisible(searchActive && radioOn);
-                }
-                return true;
-        }
-
-        @Override
-        public boolean onOptionsItemSelected(MenuItem item) {
-                switch (item.getItemId()) {
-                case MENU_SETTINGS:
-                 Intent launchPreferencesIntent = new Intent().setClass(this,
-                     Settings.class);
-                        launchPreferencesIntent.putExtra(Settings.RX_MODE,false);
-                        startActivityForResult(launchPreferencesIntent,
-                        ACTIVITY_RESULT_SETTINGS);
-
-                        // startActivity(launchPreferencesIntent);
-                        return true;
-
-                case MENU_SCAN_START:
-                        showDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                        return true;
-
-                case MENU_SCAN_STOP:
-                        cancelSearch();
-                        return true;
-
-                default:
-                        break;
-                }
-                return super.onOptionsItemSelected(item);
-        }
-
-        private boolean isHdmiOn() {
-            //HDMI and FM concurrecny is not supported.
-                try {
-                    String hdmiUserOption = android.provider.Settings.System.getString(
-                                            getContentResolver(), "HDMI_USEROPTION");
-                }
-                catch (Exception ex){
-                    Log.d(LOGTAG,"Get HDMI open failed");
-                }
-                return false;
-        }
-        @Override
-        protected Dialog onCreateDialog(int id) {
-                switch (id) {
-                case DIALOG_PRESET_LIST_AUTO_SET: {
-                        return createPresetListAutoSelectWarnDlg(id);
-                }
-                case DIALOG_PICK_FREQUENCY: {
-                        FmConfig fmConfig = FmSharedPreferences.getFMConfiguration();
-                        return new FrequencyPickerDialog(this, fmConfig, mTunedFrequency,
-                                        mFrequencyChangeListener);
-                }
-                case DIALOG_PROGRESS_PROGRESS: {
-                        return createProgressDialog(id);
-                }
-                case DIALOG_PRESET_OPTIONS: {
-                        return createPresetOptionsDlg(id);
-                }
-                default:
-                        break;
-                }
-                return null;
-        }
-
-        @Override
-        protected void onPrepareDialog(int id, Dialog dialog) {
-                super.onPrepareDialog(id, dialog);
-                switch (id) {
-                case DIALOG_PICK_FREQUENCY: {
-                        ((FrequencyPickerDialog) dialog).UpdateFrequency(mTunedFrequency);
-                        break;
-                }
-                case DIALOG_PRESET_OPTIONS: {
-                        AlertDialog alertDlg = ((AlertDialog) dialog);
-                        if ((alertDlg != null) && (mPresetButtonIndex >= 0)
-                                        && (mPresetButtonIndex <= MAX_PRESETS)) {
-                                int frequency = mPresetFrequencies[mPresetButtonIndex];
-                                alertDlg.setTitle(PresetStation.getFrequencyString(frequency));
-                        }
-                        break;
-                }
-
-                default:
-                        break;
-                }
-        }
-
-        @Override
-        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-                super.onActivityResult(requestCode, resultCode, data);
-                Log.d(LOGTAG, "onActivityResult : requestCode -> " + requestCode);
-                Log.d(LOGTAG, "onActivityResult : resultCode -> " + resultCode);
-              if (requestCode ==ACTIVITY_RESULT_SETTINGS)
-              {
-                 if (resultCode == RESULT_OK)
-                 {
-                    /* */
-                    if (data != null)
-                    {
-                       String action = data.getAction();
-                       if (action != null)
-                       {
-                          if (action.equals(Settings.RESTORE_FACTORY_DEFAULT_ACTION))
-                          {
-                             RestoreDefaults();
-                             enableRadioOnOffUI();
-                             tuneRadio(mTunedFrequency);
-                          }
-                       }
-                    }
-                 } //if ACTIVITY_RESULT_SETTINGS
-              }//if (resultCode == RESULT_OK)
-        }
-
-
-
-
-        /**
-         * @return true if a internal antenna is available.
-         *
-         */
-        boolean isInternalAntennaAvailable() {
-                return mInternalAntennaAvailable;
-        }
-
-        private Dialog createPresetOptionsDlg(int id) {
-                if ((mPresetButtonIndex >= 0) && (mPresetButtonIndex <= MAX_PRESETS)) {
-                        int frequency = mPresetFrequencies[mPresetButtonIndex];
-                        AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-                        dlgBuilder.setTitle(PresetStation.getFrequencyString(frequency));
-                        ArrayList<String> arrayList = new ArrayList<String>();
-                        arrayList.add(getResources().getString(R.string.preset_tune));
-                        arrayList.add(getResources().getString(R.string.preset_replace));
-                        arrayList.add(getResources().getString(R.string.preset_delete));
-                        dlgBuilder.setCancelable(true);
-                        dlgBuilder
-                                        .setOnCancelListener(new DialogInterface.OnCancelListener() {
-                                                public void onCancel(DialogInterface dialog) {
-                                                        mPresetButtonIndex = -1;
-                                                        removeDialog(DIALOG_PRESET_OPTIONS);
-                                                }
-                                        });
-                        String[] items = new String[arrayList.size()];
-                        arrayList.toArray(items);
-                        dlgBuilder.setItems(items, new DialogInterface.OnClickListener() {
-                                public void onClick(DialogInterface dialog, int item) {
-                                        if ((mPresetButtonIndex >= 0)
-                                                        && (mPresetButtonIndex <= MAX_PRESETS)) {
-                                                int frequency = mPresetFrequencies[mPresetButtonIndex];
-                                                switch (item) {
-                                                case 0: {
-                                                        // Tune to this station
-                                                        mPresetButtonIndex = -1;
-                                                        tuneRadio(frequency);
-                                                        break;
-                                                }
-                                                case 1: {
-                                                        // Replace preset Station with currently tuned
-                                                        // station
-                                                        Log.d(LOGTAG, "Replace station - " + frequency
-                                                                        + " with " + mTunedFrequency);
-                                                        mPresetFrequencies[mPresetButtonIndex] = mTunedFrequency;
-                                                        mPresetButtonIndex = -1;
-                                                        setupPresetLayout();
-                                                        SavePreferences();
-                                                        break;
-                                                }
-                                                case 2: {
-                                                        // Delete
-                                                        mPresetFrequencies[mPresetButtonIndex] = 0;
-                                                        mPresetButtonIndex = -1;
-                                                        setupPresetLayout();
-                                                        SavePreferences();
-                                                        break;
-                                                }
-                                                default: {
-                                                        // Should not happen
-                                                        mPresetButtonIndex = -1;
-                                                        break;
-                                                }
-                                                }// switch item
-                                        }// if(mPresetButtonStation != null)
-                                        removeDialog(DIALOG_PRESET_OPTIONS);
-                                }// onClick
-                        });
-                        return dlgBuilder.create();
-                }
-                return null;
-        }
-
-        private Dialog createProgressDialog(int id) {
-                String msgStr = "";
-                String titleStr = "";
-                boolean bSearchActive = false;
-
-                if (isSearchActive()) {
-                        msgStr = getString(R.string.msg_weak_searching);
-                        titleStr = getString(R.string.msg_searching_title);
-                        bSearchActive = true;
-                }
-
-                if (bSearchActive) {
-                        mProgressDialog = new ProgressDialog(FMTransmitterActivity.this);
-                        if (mProgressDialog != null) {
-                           mProgressDialog.setTitle(titleStr);
-                           mProgressDialog.setMessage(msgStr);
-                           mProgressDialog.setIcon(R.drawable.ic_launcher_fm_tx);
-                           mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
-                           mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE,
-                                        getText(R.string.button_text_stop),
-                                        new DialogInterface.OnClickListener() {
-                                                public void onClick(DialogInterface dialog,
-                                                                int whichButton) {
-                                                        cancelSearch();
-                                                }
-                                        });
-                           mProgressDialog
-                                        .setOnCancelListener(new DialogInterface.OnCancelListener() {
-                                                public void onCancel(DialogInterface dialog) {
-                                                        cancelSearch();
-                                                }
-                                        });
-                        }
-
-                        Message msg = new Message();
-                        msg.what = TIMEOUT_PROGRESS_DLG;
-                        mSearchProgressHandler.sendMessageDelayed(msg, SHOWBUSY_TIMEOUT);
-                }
-                return mProgressDialog;
-        }
-
-        private Dialog createPresetListAutoSelectWarnDlg(int id) {
-                AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
-                dlgBuilder.setIcon(R.drawable.alert_dialog_icon).setTitle(
-                                R.string.presetlist_autoselect_title);
-                dlgBuilder.setMessage(getString(R.string.fmtx_autoselect_name));
-
-                dlgBuilder.setPositiveButton(R.string.alert_dialog_ok,
-                                new DialogInterface.OnClickListener() {
-                                        public void onClick(DialogInterface dialog, int whichButton) {
-                                                /*
-                                                 * Since the presets will be changed, reset the page
-                                                 * number
-                                                 */
-                                                initiateSearchList();
-                                                setupPresetLayout();
-                                                SavePreferences();
-                                                removeDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                                        }
-                                });
-
-                dlgBuilder.setNegativeButton(R.string.alert_dialog_cancel,
-                                new DialogInterface.OnClickListener() {
-                                        public void onClick(DialogInterface dialog, int whichButton) {
-                                                removeDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                                        }
-                                });
-                return (dlgBuilder.create());
-        }
-
-        private void RestoreDefaults() {
-                for (int index = 0; index < MAX_PRESETS; index++) {
-                        mPresetFrequencies[index] = FmSharedPreferences.getLowerLimit();
-                }
-                mTunedFrequency = FmSharedPreferences.getLowerLimit();
-                SavePreferences();
-        }
-
-        private View.OnLongClickListener mFrequencyViewClickListener = new View.OnLongClickListener() {
-                public boolean onLongClick(View v) {
-                        showDialog(DIALOG_PICK_FREQUENCY);
-                        return true;
-                }
-        };
-
-        private View.OnClickListener mForwardClickListener = new View.OnClickListener() {
-                public void onClick(View v) {
-                        int frequency = FmSharedPreferences
-                                        .getNextTuneFrequency(mTunedFrequency);
-                        Log.d(LOGTAG, "Tune Up: to " + frequency);
-                        tuneRadio(frequency);
-                }
-        };
-
-        private View.OnClickListener mBackClickListener = new View.OnClickListener() {
-                public void onClick(View v) {
-                        int frequency = FmSharedPreferences
-                                        .getPrevTuneFrequency(mTunedFrequency);
-                        Log.d(LOGTAG, "Tune Down: to " + frequency);
-                        tuneRadio(frequency);
-                }
-        };
-
-        private View.OnClickListener mPresetButtonClickListener = new View.OnClickListener() {
-                public void onClick(View view) {
-                        Integer indexInteger = (Integer) view.getTag();
-                        int index = indexInteger.intValue();
-                        if ((index >= 0) && (index <= MAX_PRESETS)) {
-                                Log.d(LOGTAG, "station - " + index);
-                                if(mPresetFrequencies[index] != 0)
-                                {
-                                        mTunedFrequency = mPresetFrequencies[index];
-                                        tuneRadio(mTunedFrequency);
-                                        view.startAnimation(mAnimation);
-                                }
-                        }
-                }
-        };
-
-        private View.OnLongClickListener mPresetButtonOnLongClickListener = new View.OnLongClickListener() {
-                public boolean onLongClick(View view) {
-                        Integer indexInteger = (Integer) view.getTag();
-                        int index = indexInteger.intValue();
-                        if ((index >= 0) && (index <= MAX_PRESETS)) {
-                                int frequency = mPresetFrequencies[index];
-                                mPresetButtonIndex = index;
-                                if (frequency > 0) {
-                                        showDialog(DIALOG_PRESET_OPTIONS);
-                                } else {
-                                        mPresetFrequencies[index] = mTunedFrequency;
-                                        view.startAnimation(mAnimation);
-                                        setupPresetLayout();
-                                        SavePreferences();
-                                }
-                        }
-                        return true;
-                }
-        };
-
-        final FrequencyPickerDialog.OnFrequencySetListener mFrequencyChangeListener = new FrequencyPickerDialog.OnFrequencySetListener() {
-                public void onFrequencySet(FrequencyPicker view, int frequency) {
-                        Log.d(LOGTAG, "mFrequencyChangeListener: onFrequencyChanged to : "
-                                        + frequency);
-                        tuneRadio(frequency);
-                }
-        };
-
-        private View.OnClickListener mTurnOnOffClickListener = new View.OnClickListener() {
-                public void onClick(View v) {
-
-                        if (isFmOn()) {
-                                enableRadioHandler.removeCallbacks(enableRadioTask);
-                                disableRadioHandler.removeCallbacks(disableRadioTask);
-                                disableRadioHandler.postDelayed(disableRadioTask, 0);
-                        } else {
-                                enableRadioHandler.removeCallbacks(enableRadioTask);
-                                disableRadioHandler.removeCallbacks(disableRadioTask);
-                                enableRadioHandler.postDelayed(enableRadioTask, 0);
-                        }
-                        setTurnOnOffButtonImage();
-                }
-        };
-
-        private void setTurnOnOffButtonImage() {
-                if (isFmOn() == true) {
-                        mOnOffButton.setImageResource(R.drawable.ic_btn_onoff);
-                } else {
-                        /* Find a icon to indicate off */
-                        mOnOffButton.setImageResource(R.drawable.ic_btn_onoff);
-                }
-        }
-
-        private void enableRadioOnOffButton() {
-                if(mOnOffButton != null) {
-                   mOnOffButton.setEnabled(true);
-                   mOnOffButton.setClickable(true);
-                }
-        }
-
-        private void disableRadioOnOffButton() {
-                if(mOnOffButton != null) {
-                   mOnOffButton.setEnabled(false);
-                   mOnOffButton.setClickable(false);
-                }
-        }
-        private void setHsPluggedInMsg() {
-                if (mRadioTextTV != null) {
-                    mRadioTextTV.setVisibility(View.VISIBLE);
-                    mRadioTextTV.setText(getString(R.string.msg_headsetpluggedin));
-                }
-        }
-        private Runnable enableRadioTask = new Runnable() {
-                public void run() {
-                     enableRadio();
-                }
-        };
-
-        private Runnable disableRadioTask = new Runnable() {
-                public void run() {
-                     disableRadio();
-                }
-        };
-
-        private void enableRadio() {
-                mIsSearching = false;
-                disableRadioOnOffButton();
-                if (mService != null) {
-                        try {
-                                if(mService.isHeadsetPlugged()) {
-                                   setHsPluggedInMsg();
-                                   enableRadioOnOffButton();
-                                } else if(mService.isCallActive()) {
-                                   enableRadioOnOffButton();
-                                } else if(!mService.fmOn()) {
-                                   enableRadioOnOffButton();
-                                }
-                        } catch (RemoteException e) {
-                                enableRadioOnOffButton();
-                                e.printStackTrace();
-                        }
-                }
-
-        }
-
-        private void disableRadio() {
-                enableRadioOnOffUI(false);
-                cancelSearch();
-                if (mService != null) {
-                        try {
-                               if(!mService.fmOff()) {
-                                  enableRadioOnOffButton();
-                               }
-                        } catch (RemoteException e) {
-                                enableRadioOnOffButton();
-                                e.printStackTrace();
-                        }
-                }
-        }
-
-        public static void fmConfigure() {
-                if (mService != null) {
-                        try {
-                                mService.fmReconfigure();
-                        } catch (RemoteException e) {
-                                e.printStackTrace();
-                        }
-                }
-        }
-
-        private void enableRadioOnOffUI() {
-                boolean bEnable = true;
-                //decide enable or disable UI based on
-                //Tx Service status.This is valid only
-                // when search is not in progress. When
-                // search is in progress UI should be active
-                if( false == isSearchActive() ) {
-                    bEnable = isFmOn();
-                }
-                /* Disable if no antenna/headset is available */
-                if (!readInternalAntennaAvailable()) {
-                    Log.d(LOGTAG,"finding internal antenna avialable as false");
-                        bEnable = false;
-                }
-                enableRadioOnOffUI(bEnable);
-        }
-
-        private void enableRadioOnOffUI(boolean bEnable) {
-                if (bEnable) {
-                        if (mTuneStationFrequencyTV != null) {
-                           mTuneStationFrequencyTV
-                                        .setOnLongClickListener(mFrequencyViewClickListener);
-                        }
-                        if (mRadioTextScroller != null) {
-                           mRadioTextScroller.startScroll();
-                        }
-                } else {
-                        if (mTuneStationFrequencyTV != null) {
-                           mTuneStationFrequencyTV.setOnLongClickListener(null);
-                        }
-                        if (mRadioTextScroller != null) {
-                           mRadioTextScroller.stopScroll();
-                        }
-                }
-
-                if (mForwardButton != null) {
-                   mForwardButton.setVisibility(((bEnable == true) ? View.VISIBLE
-                                : View.INVISIBLE));
-                }
-                if (mBackButton != null) {
-                   mBackButton.setVisibility(((bEnable == true) ? View.VISIBLE
-                                : View.INVISIBLE));
-                }
-                if (mTransmitStaticMsgTV != null) {
-                   mTransmitStaticMsgTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                : View.INVISIBLE));
-                }
-                if (mTuneStationFrequencyTV != null) {
-                   mTuneStationFrequencyTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                : View.INVISIBLE));
-                }
-                if (mRadioTextTV != null) {
-                   mRadioTextTV.setVisibility(((bEnable == true) ? View.VISIBLE
-                                : View.INVISIBLE));
-                }
-
-                try {
-                    if( null != mService) {
-                        if ( mService.isHeadsetPlugged()) {
-                            Log.d(LOGTAG,"headset plugged in");
-                            if (mRadioTextTV != null) {
-                               mRadioTextTV.setVisibility(View.VISIBLE);
-                               mRadioTextTV.setText(getString(R.string.msg_headsetpluggedin));
-                            }
-                            if (mOnOffButton != null) {
-                               mOnOffButton.setEnabled(false);
-                            }
-                        } else if (mService.isCallActive()) {
-                            Log.d(LOGTAG,"call active");
-                            if (mRadioTextTV != null) {
-                               mRadioTextTV.setVisibility(View.VISIBLE);
-                               mRadioTextTV.setText(getString(R.string.msg_callactive));
-                            }
-                            if (mOnOffButton != null) {
-                               mOnOffButton.setEnabled(false);
-                            }
-                        } else {
-                            if (mRadioTextTV != null) {
-                               mRadioTextTV.setText("");
-                            }
-                            if (mOnOffButton != null) {
-                               mOnOffButton.setEnabled(true);
-                            }
-                        }
-                    } else {
-                        Log.d(LOGTAG,"Service null");
-                        if (mRadioTextTV != null) {
-                           mRadioTextTV.setText("");
-                        }
-                        if (mOnOffButton != null) {
-                           mOnOffButton.setEnabled(true);
-                        }
-                    }
-                } catch (RemoteException e) {
-                    e.printStackTrace();
-                }
-
-                for (int nButton = 0; nButton < MAX_PRESETS; nButton++) {
-                     if (mPresetButtons[nButton] != null) {
-                        mPresetButtons[nButton].setEnabled(bEnable);
-                     }
-                }
-        }
-
-        private void updateSearchProgress() {
-                boolean searchActive = isSearchActive();
-                if (searchActive) {
-                        synchronized (this) {
-                                if (mProgressDialog == null) {
-                                        showDialog(DIALOG_PROGRESS_PROGRESS);
-                                } else {
-                                        Message msg = new Message();
-                                        msg.what = UPDATE_PROGRESS_DLG;
-                                        mSearchProgressHandler.sendMessage(msg);
-                                }
-                        }
-                } else {
-                        Message msg = new Message();
-                        msg.what = END_PROGRESS_DLG;
-                        mSearchProgressHandler.sendMessage(msg);
-                }
-        }
-
-        private void resetSearchProgress() {
-                Message msg = new Message();
-                msg.what = END_PROGRESS_DLG;
-                mSearchProgressHandler.sendMessage(msg);
-        }
-
-        private void setupPresetLayout() {
-                /*
-                 * For every station, save the station as a tag and update the display
-                 * on the preset Button.
-                 */
-                for (int buttonIndex = 0; (buttonIndex < MAX_PRESETS); buttonIndex++) {
-                        if (mPresetButtons[buttonIndex] != null) {
-                                String display = "";
-                                int frequency = mPresetFrequencies[buttonIndex];
-                                if (frequency != 0) {
-                                        display = PresetStation.getFrequencyString(frequency);
-                                }
-                                mPresetButtons[buttonIndex].setText(display);
-                                mPresetButtons[buttonIndex].setTag(new Integer(buttonIndex));
-                        }
-                }
-        }
-
-        private void updateStationInfoToUI() {
-                mTuneStationFrequencyTV.setText(PresetStation.getFrequencyString(mTunedFrequency));
-                mRadioTextTV.setText("");
-                setupPresetLayout();
-        }
-
-        private boolean isFmOn() {
-                boolean bOn = false;
-                if (mService != null) {
-                        try {
-                                bOn = mService.isFmOn();
-                        } catch (RemoteException e) {
-                                e.printStackTrace();
-                        }
-                }
-                return (bOn);
-        }
-
-        private boolean isSearchActive() {
-                return (mIsSearching);
-        }
-
-        public static int getCurrentTunedFrequency() {
-                return mTunedFrequency;
-        }
-
-        private void cancelSearch() {
-                synchronized (this) {
-                        if (mService != null) {
-                                try {
-                                        if (mIsSearching == true) {
-                                                if (true == mService.cancelSearch()) {
-                                                }
-                                        }
-                                } catch (RemoteException e) {
-                                        e.printStackTrace();
-                                }
-                        }
-                }
-                updateSearchProgress();
-        }
-
-        /** get Weakest Stations */
-        private void initiateSearchList() {
-                synchronized (this) {
-                        mIsSearching = true;
-                        if (mService != null) {
-                                try {
-                                        mSearchingResultStatus = false;
-                                        mIsSearching = mService.searchWeakStationList(MAX_PRESETS);
-                                } catch (RemoteException e) {
-                                        e.printStackTrace();
-                                }
-                                updateSearchProgress();
-                        }
-                }
-        }
-
-        /** get Internal Antenna Available mode Stations */
-        private boolean readInternalAntennaAvailable() {
-                mInternalAntennaAvailable = false;
-                if (mService != null) {
-                        try {
-                                mInternalAntennaAvailable = mService
-                                                .isInternalAntennaAvailable();
-                        } catch (RemoteException e) {
-                                e.printStackTrace();
-                        }
-                }
-                Log.e(LOGTAG, "readInternalAntennaAvailable: internalAntenna : "
-                                + mInternalAntennaAvailable);
-                return mInternalAntennaAvailable;
-        }
-
-        private static final int UPDATE_PROGRESS_DLG = 1;
-        private static final int END_PROGRESS_DLG = 2;
-        private static final int TIMEOUT_PROGRESS_DLG = 3;
-        private static final int SHOWBUSY_TIMEOUT = 300000;
-        private Handler mSearchProgressHandler = new Handler() {
-                public void handleMessage(Message msg) {
-                        if (msg.what == UPDATE_PROGRESS_DLG) {
-                                // Log.d(LOGTAG, "mTimeoutHandler: UPDATE_PROGRESS_DLG");
-                                if (mProgressDialog != null) {
-                                        mTuneStationFrequencyTV.setText(PresetStation.getFrequencyString(mTunedFrequency));
-                                        String titleStr = getString( R.string.msg_search_title,
-                                                                             PresetStation.getFrequencyString(mTunedFrequency));
-
-                                        mProgressDialog.setTitle(titleStr);
-                                }
-                        } else if (msg.what == END_PROGRESS_DLG) {
-                                // Log.d(LOGTAG, "mTimeoutHandler: END_PROGRESS_DLG");
-                                mSearchProgressHandler.removeMessages(END_PROGRESS_DLG);
-                                mSearchProgressHandler.removeMessages(UPDATE_PROGRESS_DLG);
-                                mSearchProgressHandler.removeMessages(TIMEOUT_PROGRESS_DLG);
-                                removeDialog(DIALOG_PROGRESS_PROGRESS);
-                                mProgressDialog = null;
-                        } else if (msg.what == TIMEOUT_PROGRESS_DLG) {
-                                cancelSearch();
-                        }
-                }
-        };
-
-        private void tuneRadio(int frequency) {
-                if (mService != null) {
-                        try {
-                                // Set Tune Frequency
-                                mService.tune(frequency);
-                                updateStationInfoToUI();
-                        } catch (RemoteException e) {
-                                e.printStackTrace();
-                        }
-                }
-        }
-
-        private void resetFMStationInfoUI() {
-                mRadioTextTV.setText("");
-                mRadioTextScroller.stopScroll();
-                updateStationInfoToUI();
-        }
-
-
-        final Runnable mUpdateStationInfo = new Runnable() {
-                public void run() {
-                        updateSearchProgress();
-                        resetFMStationInfoUI();
-                }
-        };
-
-        final Runnable mSearchListComplete = new Runnable() {
-                public void run() {
-                        Log.d(LOGTAG, "mSearchListComplete: ");
-                        mIsSearching = false;
-
-                        /* Now get the list */
-                        if (mService != null) {
-                          try {
-                               if(mSearchingResultStatus) {
-                                  int[] searchList = mService.getSearchList();
-                                  if (searchList != null) {
-                                     for (int station = 0; (station < searchList.length)
-                                          && (station < MAX_PRESETS); station++) {
-                                          Log.d(LOGTAG, "mSearchListComplete: [" + station
-                                          + "] = " + searchList[station]);
-                                         mPresetFrequencies[station] = searchList[station];
-                                     }
-                                  }
-                               }
-                               /* Restart FM into Transmit mode */
-                               if(!mService.isHeadsetPlugged()) {
-                                  mService.fmRestart();
-                                  /* Tune to last tuned frequency */
-                                  tuneRadio(mTunedFrequency);
-                                  updateSearchProgress();
-                                  resetFMStationInfoUI();
-                                  setupPresetLayout();
-                                  SavePreferences();
-                               } else {
-                                  updateSearchProgress();
-                                  enableRadioHandler.removeCallbacks(enableRadioTask);
-                                  disableRadioHandler.removeCallbacks(disableRadioTask);
-                                  disableRadioHandler.postDelayed(disableRadioTask, 0);
-                               }
-                          } catch (RemoteException e) {
-                               e.printStackTrace();
-                          }
-                       }
-                }
-        };
-
-
-
-        final Runnable mUpdateRadioText = new Runnable() {
-                public void run() {
-                        String str = "";
-                        if ((mService != null) && isFmOn()) {
-                                try {
-                                        /* Get Radio Text and update the display */
-                                        str = mService.getRadioText();
-                                        if(null != mMetaData) {
-                                            Log.d(LOGTAG,"meta data is "+mMetaData);
-                                            str = str.concat(mMetaData);
-                                        } else {
-                                            str = str.concat("...");
-                                        }
-                                        /* Update only if all the characters are printable */
-                                        if (TextUtils.isGraphic(str))
-                                        {
-                                            Log.d(LOGTAG, "mUpdateRadioText: Updatable string: ["
-                                                            + str + "]");
-                                            mRadioTextTV.setText(str);
-                                        }
-                                        /* Rest the string to empty */
-                                        else if (TextUtils.isEmpty(str)) {
-                                                mRadioTextTV.setText("");
-                                        } else {
-                                            Log.d(LOGTAG, "RDS has non printable stuff");
-                                            mRadioTextTV.setText("");
-                                        }
-
-                                        mRadioTextScroller.startScroll();
-                                        String szRTStr = getString(R.string.transmit_msg_string);
-                                        mPSData = mService.getPSData();
-                                        if(null != mPSData ) {
-                                            szRTStr = mPSData.concat("\n").concat(szRTStr);
-                                        }
-                                        else
-                                            Log.d(LOGTAG, "mPSData is NULL");
-                                        mTransmitStaticMsgTV.setText(szRTStr);
-                                } catch (RemoteException e) {
-                                        e.printStackTrace();
-                                }
-                        }
-                }
-        };
-
-        private void DebugToasts(String str, int duration) {
-                Toast.makeText(this, str, duration).show();
-        }
-
-        /**
-         * This Handler will scroll the text view. On startScroll, the scrolling
-         * starts after SCROLLER_START_DELAY_MS The Text View is scrolled left one
-         * character after every SCROLLER_UPDATE_DELAY_MS When the entire text is
-         * scrolled, the scrolling will restart after SCROLLER_RESTART_DELAY_MS
-         */
-        private static final class ScrollerText extends Handler {
-
-                private static final byte SCROLLER_STOPPED = 0x51;
-                private static final byte SCROLLER_STARTING = 0x52;
-                private static final byte SCROLLER_RUNNING = 0x53;
-
-                private static final int SCROLLER_MSG_START = 0xF1;
-                private static final int SCROLLER_MSG_TICK = 0xF2;
-                private static final int SCROLLER_MSG_RESTART = 0xF3;
-
-                private static final int SCROLLER_START_DELAY_MS = 1000;
-                private static final int SCROLLER_RESTART_DELAY_MS = 3000;
-                private static final int SCROLLER_UPDATE_DELAY_MS = 200;
-
-                private final WeakReference<TextView> mView;
-
-                private byte mStatus = SCROLLER_STOPPED;
-                String mOriginalString;
-                int mStringlength = 0;
-                int mIteration = 0;
-
-                ScrollerText(TextView v) {
-                        mView = new WeakReference<TextView>(v);
-                }
-
-                /**
-                 * Scrolling Message Handler
-                 */
-                @Override
-                public void handleMessage(Message msg) {
-                        switch (msg.what) {
-                        case SCROLLER_MSG_START:
-                                mStatus = SCROLLER_RUNNING;
-                                updateText();
-                                break;
-                        case SCROLLER_MSG_TICK:
-                                updateText();
-                                break;
-                        case SCROLLER_MSG_RESTART:
-                                if (mStatus == SCROLLER_RUNNING) {
-                                        startScroll();
-                                }
-                                break;
-                        }
-                }
-
-                /**
-                 * Moves the text left by one character and posts a delayed message for
-                 * next update after SCROLLER_UPDATE_DELAY_MS. If the entire string is
-                 * scrolled, then it displays the entire string and waits for
-                 * SCROLLER_RESTART_DELAY_MS for scrolling restart
-                 */
-                void updateText() {
-                        if (mStatus != SCROLLER_RUNNING) {
-                                return;
-                        }
-
-                        removeMessages(SCROLLER_MSG_TICK);
-
-                        final TextView textView = mView.get();
-                        if (textView != null) {
-                                String szStr2 = "";
-                                if (mStringlength > 0) {
-                                        mIteration++;
-                                        if (mIteration >= mStringlength) {
-                                                mIteration = 0;
-                                                sendEmptyMessageDelayed(SCROLLER_MSG_RESTART,
-                                                                SCROLLER_RESTART_DELAY_MS);
-                                        } else {
-                                                sendEmptyMessageDelayed(SCROLLER_MSG_TICK,
-                                                                SCROLLER_UPDATE_DELAY_MS);
-                                        }
-                                        // String szStr1 = mOriginalString.substring(0, mTick);
-                                        szStr2 = mOriginalString.substring(mIteration);
-                                }
-                                // textView.setText(szStr2+"     "+szStr1);
-                                textView.setText(szStr2);
-                        }
-                }
-
-                /**
-                 * Stops the scrolling The textView will be set to the original string.
-                 */
-                void stopScroll() {
-                        mStatus = SCROLLER_STOPPED;
-                        removeMessages(SCROLLER_MSG_TICK);
-                        removeMessages(SCROLLER_MSG_RESTART);
-                        removeMessages(SCROLLER_MSG_START);
-                        resetScroll();
-                }
-
-                /**
-                 * Resets the scroll to display the original string.
-                 */
-                private void resetScroll() {
-                        mIteration = 0;
-                        final TextView textView = mView.get();
-                        if (textView != null) {
-                                textView.setText(mOriginalString);
-                        }
-                }
-
-                /**
-                 * Starts the Scrolling of the TextView after a delay of
-                 * SCROLLER_START_DELAY_MS Starts only if Length > 0
-                 */
-                void startScroll() {
-                        final TextView textView = mView.get();
-                        if (textView != null) {
-                                mOriginalString = (String) textView.getText();
-                                mStringlength = mOriginalString.length();
-                                if (mStringlength > 0) {
-                                        mStatus = SCROLLER_STARTING;
-                                        sendEmptyMessageDelayed(SCROLLER_MSG_START,
-                                                        SCROLLER_START_DELAY_MS);
-                                }
-                        }
-                }
-        }
-
-        public static IFMTransmitterService sService = null;
-        private static HashMap<Context, ServiceBinder> sConnectionMap = new HashMap<Context, ServiceBinder>();
-
-        public static boolean bindToService(Context context) {
-                Log.e(LOGTAG, "bindToService: Context");
-                return bindToService(context, null);
-        }
-
-        public static boolean bindToService(Context context,
-                        ServiceConnection callback) {
-                Log.e(LOGTAG, "bindToService: Context with serviceconnection callback");
-                context.startService(new Intent(context, FMTransmitterService.class));
-                ServiceBinder sb = new ServiceBinder(callback);
-                sConnectionMap.put(context, sb);
-                return context.bindService((new Intent()).setClass(context,
-                                FMTransmitterService.class), sb, 0);
-        }
-
-        public static void unbindFromService(Context context) {
-                ServiceBinder sb = (ServiceBinder) sConnectionMap.remove(context);
-                Log.e(LOGTAG, "unbindFromService: Context");
-                if (sb == null) {
-                        Log.e(LOGTAG, "Trying to unbind for unknown Context");
-                        return;
-                }
-                context.unbindService(sb);
-                if (sConnectionMap.isEmpty()) {
-                        // presumably there is nobody interested in the service at this
-                        // point,
-                        // so don't hang on to the ServiceConnection
-                        sService = null;
-                }
-        }
-
-        private static class ServiceBinder implements ServiceConnection {
-                ServiceConnection mCallback;
-
-                ServiceBinder(ServiceConnection callback) {
-                        mCallback = callback;
-                }
-
-                public void onServiceConnected(ComponentName className,
-                                android.os.IBinder service) {
-                        sService = IFMTransmitterService.Stub.asInterface(service);
-                        if (mCallback != null) {
-                                Log.e(LOGTAG, "onServiceConnected: mCallback");
-                                mCallback.onServiceConnected(className, service);
-                        }
-                }
-
-                public void onServiceDisconnected(ComponentName className) {
-                        if (mCallback != null) {
-                                mCallback.onServiceDisconnected(className);
-                        }
-                        sService = null;
-                }
-        }
-
-        private ServiceConnection osc = new ServiceConnection() {
-                public void onServiceConnected(ComponentName classname, IBinder obj) {
-                        mService = IFMTransmitterService.Stub.asInterface(obj);
-                        Log.e(LOGTAG, "ServiceConnection: onServiceConnected: ");
-                        if (mService != null) {
-                            try {
-                                  mService.registerCallbacks(mServiceCallbacks);
-                                  if(false == mService.isHeadsetPlugged()) {
-                                      Log.e(LOGTAG, "return for isHeadsetPlugged is false");
-                                      if (SavedDataAndState == null) {
-                                          enableRadioHandler.removeCallbacks(enableRadioTask);
-                                          disableRadioHandler.removeCallbacks(disableRadioTask);
-                                          enableRadioHandler.postDelayed(enableRadioTask, 0);
-                                      } else if (SavedDataAndState.onOrOff) {
-                                          enableRadioOnOffUI(true);
-                                      } else {
-                                          enableRadioOnOffUI(false);
-                                      }
-                                  } else {
-                                      enableRadioOnOffUI(false);
-                                  }
-                            } catch (RemoteException e) {
-                                  e.printStackTrace();
-                            }
-                            return;
-                        } else {
-                                Log.e(LOGTAG,
-                                        "IFMTransmitterService onServiceConnected failed");
-                        }
-                        // startPlayback();
-                        // Service is dead or not playing anything. If we got here as part
-                        // of a "play this file" Intent, exit. Otherwise go to the Music
-                        // app start screen.
-                        if (getIntent().getData() == null) {
-                            Intent intent = new Intent(Intent.ACTION_MAIN);
-                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                            intent.setClass(FMTransmitterActivity.this,
-                                                FMTransmitterActivity.class);
-                            startActivity(intent);
-                        }
-                        finish();
-                }
-
-                public void onServiceDisconnected(ComponentName classname) {
-                }
-        };
-
-        private IFMTransmitterServiceCallbacks.Stub mServiceCallbacks = new IFMTransmitterServiceCallbacks.Stub() {
-
-                public void onDisabled() throws RemoteException {
-                    mHandler.post(mRadioStateUpdated);
-                }
-
-                public void onRadioReset() throws RemoteException {
-                    mHandler.post(mRadioReset);
-                }
-
-                public void onEnabled(boolean status) throws RemoteException {
-                    mHandler.post(mRadioStateUpdated);
-                }
-
-                public void onRadioTextChanged() throws RemoteException {
-                }
-
-                public void onSearchListComplete(boolean status) throws RemoteException {
-                    mIsSearching = false;
-                    mSearchingResultStatus = status;
-                    mHandler.post(mSearchListComplete);
-                }
-
-                public void onTuneStatusChanged(int frequency) throws RemoteException {
-                        mTunedFrequency = frequency;
-                        Log.d(LOGTAG, "onTuneStatusChanged: Frequency : " + mTunedFrequency);
-                        FmSharedPreferences.setTunedFrequency(mTunedFrequency);
-                        SavePreferences();
-                        mHandler.post(mUpdateStationInfo);
-                }
-                public void onReconfigured() throws RemoteException {
-                    RestoreDefaults();
-                }
-                public void onMetaDataChanged(String metaStr)  throws RemoteException {
-                    Log.d(LOGTAG,"meta data is "+metaStr);
-                    mMetaData = new String (metaStr);
-                    mHandler.post(mUpdateRadioText);
-                }
-                public void onPSInfoSent(String psStr ) throws RemoteException {
-                    Log.d(LOGTAG,"PS String data is "+psStr);
-                    mPSData = new String (psStr);
-                    mHandler.post(mUpdateRadioText);
-                }
-        };
-        final Runnable mRadioStateUpdated = new Runnable() {
-            public void run() {
-                enableRadioOnOffButton();
-               /* Update UI to FM On State */
-                if(isFmOn()) {
-                    enableRadioOnOffUI(true);
-                    /* Tune to the last tuned frequency */
-                    LoadPreferences();
-                    tuneRadio(mTunedFrequency);
-                } else {
-                    /* Save the existing frequency */
-                    FmSharedPreferences.setTunedFrequency(mTunedFrequency);
-                    SavePreferences();
-                    removeDialog(DIALOG_PRESET_LIST_AUTO_SET);
-                    enableRadioOnOffUI(false);
-                }
-
-             }
-          };
-        final Runnable mRadioReset = new Runnable() {
-            public void run() {
-                    /* Save the existing frequency */
-                    resetSearchProgress();
-                    FmSharedPreferences.setTunedFrequency(mTunedFrequency);
-                    SavePreferences();
-                    enableRadioOnOffUI(false);
-             }
-          };
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMTransmitterConfigReceiver.java b/fmapp/src/com/codeaurora/fmradio/FMTransmitterConfigReceiver.java
deleted file mode 100644
index d64852a..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMTransmitterConfigReceiver.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2011-2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.content.Intent;
-import android.content.BroadcastReceiver;
-import android.content.pm.PackageManager;
-import android.content.Context;
-import android.content.ComponentName;
-import android.util.Log;
-import android.os.SystemProperties;
-import java.io.FileReader;
-import java.io.File;
-import java.lang.String;
-
-
-public class FMTransmitterConfigReceiver extends BroadcastReceiver {
-
-    private static FileReader socinfo_fd;
-    private static char[] socinfo = new char[20];
-    private static String build_id = "1";
-
-    private static final String TAG = "FMFolderConfigReceiver";
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
-        Log.d(TAG, "Received intent: " + action);
-        if((action != null) && action.equals("android.intent.action.BOOT_COMPLETED")) {
-            Log.d(TAG, "boot complete intent received");
-            boolean isFmTransmitterSupported = SystemProperties.getBoolean("ro.fm.transmitter",true);
-
-            if ("msm7630_surf".equals(SystemProperties.get("ro.board.platform"))) {
-                Log.d(TAG,"this is msm7630_surf");
-                try {
-                    File f = new File("/sys/devices/soc0/build_id");
-                    if (f.exists()) {
-                        socinfo_fd = new FileReader("/sys/devices/soc0/build_id");
-                    } else {
-                        socinfo_fd = new FileReader("/sys/devices/system/soc/soc0/build_id");
-                    }
-                    socinfo_fd.read(socinfo,0,20);
-                    socinfo_fd.close();
-                } catch(Exception e) {
-                    Log.e(TAG,"Exception in FileReader");
-                }
-                Log.d(TAG, "socinfo=" +socinfo);
-                build_id = new String(socinfo,17,1);
-                Log.d(TAG, "build_id=" +build_id);
-            }
-            if ((!isFmTransmitterSupported) || (build_id.equals("0"))) {
-            PackageManager pManager = context.getPackageManager();
-               if (pManager != null) {
-                   Log.d(TAG, "disableing the FM Transmitter");
-                   ComponentName fmTransmitter = new ComponentName("com.codeaurora.fmradio", "com.codeaurora.fmradio.FMTransmitterActivity");
-                   pManager.setComponentEnabledSetting(fmTransmitter, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                                                    PackageManager.DONT_KILL_APP);
-               }
-           }
-        }
-   }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FMTransmitterService.java b/fmapp/src/com/codeaurora/fmradio/FMTransmitterService.java
deleted file mode 100644
index bbe2b4a..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FMTransmitterService.java
+++ /dev/null
@@ -1,1243 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import java.lang.ref.WeakReference;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.media.AudioManager;
-import android.media.AudioSystem;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.PowerManager;
-import android.os.SystemProperties;
-import android.os.PowerManager.WakeLock;
-import android.os.RemoteException;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-import android.widget.RemoteViews;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-
-import qcom.fmradio.FmReceiver;
-import qcom.fmradio.FmTransmitter;
-import qcom.fmradio.FmRxEvCallbacksAdaptor;
-import qcom.fmradio.FmTransmitterCallbacksAdaptor;
-import qcom.fmradio.FmRxRdsData;
-import qcom.fmradio.FmConfig;
-import com.codeaurora.utils.A2dpDeviceStatus;
-
-import android.media.IRemoteControlDisplay;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.graphics.Bitmap;
-import android.media.IAudioService;
-import android.media.MediaMetadataRetriever;
-/**
- * Provides "background" FM Radio (that uses the hardware) capabilities,
- * allowing the user to switch between activities without stopping playback.
- */
-public class FMTransmitterService extends Service
-{
-   private static final int FMTRANSMITTERSERVICE_STATUS = 102;
-   private static final int FM_TX_PROGRAM_TYPE = 0;
-   private static final int FM_TX_PROGRAM_ID = 0x1234;
-   private static final int FM_TX_PS_REPEAT_COUNT = 1;
-
-   private static final String FMRADIO_DEVICE_FD_STRING = "/dev/radio0";
-   private static final String LOGTAG = "FMTxService";//FMRadio.LOGTAG;
-   private static final String QFM_STRING ="QFMRADIO";
-
-   private static FmReceiver mReceiver;
-   private static FmTransmitter mTransmitter;
-   private int mTunedFrequency = 0;
-
-   private static FmSharedPreferences mPrefs;
-   private IFMTransmitterServiceCallbacks mCallbacks;
-   private WakeLock mWakeLock;
-   private int mServiceStartId = -1;
-   private boolean mServiceInUse = false;
-   private boolean mMuted = false;
-   private boolean mResumeAfterCall = false;
-
-   private boolean mFMOn = false;
-   private int mFMSearchStations = 0;
-
-   private FmRxRdsData mFMRxRDSData=null;
-   final Handler mHandler = new Handler();
-   private BroadcastReceiver mHeadsetReceiver = null;
-   boolean mHeadsetPlugged = false;
-   // Track A2dp Device status changes
-   private A2dpDeviceStatus mA2dpDeviceState = null;
-   // interval after which we stop the service when idle
-   private static final int IDLE_DELAY = 60000;
-   private IAudioService mAudioService;
-   private AudioManager mAudioManager;
-   private Metadata mMetadata;
-   RdsDisplay mRds;
-
-   private static String RText = " ";
-
-   public FMTransmitterService() {
-   }
-
-   @Override
-   public void onCreate() {
-      super.onCreate();
-
-      mCallbacks = null;
-      mPrefs = new FmSharedPreferences(this);
-
-      PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
-      mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getName());
-      mWakeLock.setReferenceCounted(false);
-
-      // If the service was idle, but got killed before it stopped itself, the
-      // system will relaunch it. Make sure it gets stopped again in that case.
-
-      TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-      tmgr.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
-
-      //register for A2DP utility interface
-      mA2dpDeviceState = new A2dpDeviceStatus(getApplicationContext());
-      Message msg = mDelayedStopHandler.obtainMessage();
-      mDelayedStopHandler.sendMessageDelayed(msg, IDLE_DELAY);
-      mAudioManager = new AudioManager(getApplicationContext());
-      mMetadata = new Metadata();
-      registerHeadsetListener();
-      mRds = new RdsDisplay();
-      mAudioManager.registerRemoteControlDisplay(mRds);
-   }
-
-   @Override
-   public void onDestroy() {
-      Log.d(LOGTAG, "onDestroy");
-      if (isFmOn())
-      {
-         Log.e(LOGTAG, "Service being destroyed while still playing.");
-      }
-
-      // make sure there aren't any other messages coming
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-
-      mAudioManager.unregisterRemoteControlDisplay(mRds);
-      /* Unregister the headset Broadcase receiver */
-      if (mHeadsetReceiver != null) {
-          unregisterReceiver(mHeadsetReceiver);
-          mHeadsetReceiver = null;
-      }
-      /* Since the service is closing, disable the receiver */
-      fmOff();
-
-      TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-      tmgr.listen(mPhoneStateListener, 0);
-
-      mWakeLock.release();
-      super.onDestroy();
-   }
-
-   @Override
-   public IBinder onBind(Intent intent) {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      mServiceInUse = true;
-      /* Application/UI is attached, so get out of lower power mode */
-      setLowPowerMode(false);
-      Log.d(LOGTAG, "onBind");
-      return mBinder;
-   }
-
-   @Override
-   public void onRebind(Intent intent) {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      mServiceInUse = true;
-      /* Application/UI is attached, so get out of lower power mode */
-      setLowPowerMode(false);
-      Log.d(LOGTAG, "onRebind");
-   }
-
-   @Override
-   public void onStart(Intent intent, int startId) {
-      Log.d(LOGTAG, "onStart");
-      mServiceStartId = startId;
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-
-      // make sure the service will shut down on its own if it was
-      // just started but not bound to and nothing is playing
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      Message msg = mDelayedStopHandler.obtainMessage();
-      mDelayedStopHandler.sendMessageDelayed(msg, IDLE_DELAY);
-   }
-
-   @Override
-   public boolean onUnbind(Intent intent) {
-      mServiceInUse = false;
-      Log.d(LOGTAG, "onUnbind");
-
-      /* Application/UI is not attached, so go into lower power mode */
-      unregisterCallbacks();
-      setLowPowerMode(true);
-      if (isFmOn())
-      {
-         // something is currently playing, or will be playing once
-         // an in-progress call ends, so don't stop the service now.
-         return true;
-      }
-
-      stopSelf(mServiceStartId);
-      return true;
-   }
-
-   /* Handle Phone Call + FM Concurrency */
-   private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
-      @Override
-      public void onCallStateChanged(int state, String incomingNumber) {
-          Log.d(LOGTAG, "onCallStateChanged: State - " + state );
-          Log.d(LOGTAG, "onCallStateChanged: incomingNumber - " + incomingNumber );
-          fmActionOnCallState(state );
-      }
-
-      // NEED TO CHECK ACTION TO BE TAKEN ON DATA ACTIVITY
-   };
-   private void fmActionOnCallState( int state ) {
-       //if Call Status is non IDLE we need to Mute FM as well stop recording if
-       //any. Similarly once call is ended FM should be unmuted.
-           AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-           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;
-                   }
-               }
-               if( mFMOn == true) {
-                   Log.d(LOGTAG, "posting for call state change");
-                   mHandler.post(mChangeFMTxState);
-                   mResumeAfterCall = true;
-               }
-           }
-           else if (state == TelephonyManager.CALL_STATE_IDLE) {
-              // start playing again
-              if (mResumeAfterCall)
-              {
-                  Log.d(LOGTAG, "posting for call state change");
-                  mHandler.post(mChangeFMTxState);
-                  mResumeAfterCall = false;
-              }
-           }//idle
-       }
-
-   private Handler mDelayedStopHandler = new Handler() {
-      @Override
-      public void handleMessage(Message msg) {
-         // Check again to make sure nothing is playing right now
-         if (isFmOn() || mServiceInUse)
-         {
-            return;
-         }
-         Log.d(LOGTAG, "mDelayedStopHandler: stopSelf");
-         stopSelf(mServiceStartId);
-      }
-   };
-
-   /* Show the FM Notification */
-   public void startNotification() {
-      RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
-      views.setImageViewResource(R.id.icon, R.drawable.ic_status_fm_tx);
-      if (isFmOn())
-      {
-         views.setTextViewText(R.id.frequency, getTunedFrequencyString());
-      } else
-      {
-         views.setTextViewText(R.id.frequency, "");
-      }
-
-      Notification status = new Notification();
-      status.contentView = views;
-      status.flags |= Notification.FLAG_ONGOING_EVENT;
-      status.icon = R.drawable.ic_status_fm_tx;
-      status.contentIntent = PendingIntent.getActivity(this, 0,
-                                                       new Intent("com.codeaurora.fmradio.FMTRANSMITTER_ACTIVITY"), 0);
-      startForeground(FMTRANSMITTERSERVICE_STATUS, status);
-      //NotificationManager nm = (NotificationManager)
-      //                         getSystemService(Context.NOTIFICATION_SERVICE);
-      //nm.notify(FMTRANSMITTERSERVICE_STATUS, status);
-      //setForeground(true);
-      mFMOn = true;
-   }
-
-   private void stop() {
-      gotoIdleState();
-      mFMOn = false;
-   }
-
-   private void gotoIdleState() {
-      mDelayedStopHandler.removeCallbacksAndMessages(null);
-      Message msg = mDelayedStopHandler.obtainMessage();
-      mDelayedStopHandler.sendMessageDelayed(msg, IDLE_DELAY);
-      //NotificationManager nm =
-      //(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
-      //nm.cancel(FMTRANSMITTERSERVICE_STATUS);
-      //setForeground(false);
-      stopForeground(true);
-   }
-
-   /*
-    * By making this a static class with a WeakReference to the Service, we
-    * ensure that the Service can be GCd even when the system process still
-    * has a remote reference to the stub.
-    */
-   static class ServiceStub extends IFMTransmitterService.Stub
-   {
-      WeakReference<FMTransmitterService> mService;
-
-      ServiceStub(FMTransmitterService service)
-      {
-         mService = new WeakReference<FMTransmitterService>(service);
-      }
-
-      public boolean fmOn() throws RemoteException
-      {
-         return(mService.get().fmOn());
-      }
-
-      public boolean fmOff() throws RemoteException
-      {
-         return(mService.get().fmOff());
-      }
-      public boolean fmRadioReset() throws RemoteException
-      {
-         return(mService.get().fmRadioReset());
-      }
-      public boolean fmRestart() throws RemoteException
-      {
-         return(mService.get().fmRestart());
-      }
-
-      public boolean isFmOn()
-      {
-         return(mService.get().isFmOn());
-      }
-      public boolean fmReconfigure()
-      {
-         return(mService.get().fmReconfigure());
-      }
-
-      public void registerCallbacks(IFMTransmitterServiceCallbacks cb)
-      throws RemoteException {
-         mService.get().registerCallbacks(cb);
-      }
-
-      public boolean searchWeakStationList(int numStations)
-      throws RemoteException {
-         return(mService.get().searchWeakStationList(numStations));
-      }
-
-      public void unregisterCallbacks() throws RemoteException
-      {
-         mService.get().unregisterCallbacks();
-      }
-
-      public boolean tune(int frequency)
-      {
-         return(mService.get().tune(frequency));
-      }
-
-      public boolean cancelSearch()
-      {
-         return(mService.get().cancelSearch());
-      }
-
-      public String getRadioText()
-      {
-         return(mService.get().getRadioText());
-      }
-
-      public int[] getSearchList()
-      {
-         return(mService.get().getSearchList());
-      }
-
-      public boolean isInternalAntennaAvailable()
-      {
-         return(mService.get().isInternalAntennaAvailable());
-      }
-      public boolean isHeadsetPlugged()
-      {
-         return(mService.get().isHeadsetPlugged());
-      }
-      public boolean isCallActive()
-      {
-          return(mService.get().isCallActive());
-      }
-      public String getPSData()
-      {
-          return(mService.get().getPSData());
-      }
-   }
-
-   private final IBinder mBinder = new ServiceStub(this);
-   /*
-    * Turn ON FM: Powers up FM hardware, and initializes the FM module
-    *                                                                                 .
-    * @return true if fm Enable api was invoked successfully, false if the api failed.
-    */
-   private boolean fmOn() {
-      boolean bStatus=false;
-
-      Log.d(LOGTAG, "fmOn");
-      mWakeLock.acquire(10*1000);
-      if (mTransmitter == null) {
-          try {
-               mTransmitter = new FmTransmitter(FMRADIO_DEVICE_FD_STRING, transmitCallbacks);
-               Log.d(LOGTAG, "new transmitter created");
-          } catch (InstantiationException e) {
-               throw new RuntimeException("FmTx service not available!");
-          }
-      }
-      if (mTransmitter != null)
-      {
-         if (isFmOn())
-         {
-            /* FM Is already on,*/
-            bStatus = true;
-            try {
-                 if(mCallbacks != null) {
-                    mCallbacks.onEnabled(true);
-                 }
-            } catch(RemoteException e) {
-                 e.printStackTrace();
-            }
-            Log.d(LOGTAG, "mTransmitter is enabled");
-         }
-         else
-         {
-         // This sets up the FM radio device
-             FmConfig config = FmSharedPreferences.getFMConfiguration();
-             Log.d(LOGTAG, "fmOn: RadioBand   :"+ config.getRadioBand());
-             Log.d(LOGTAG, "fmOn: Emphasis    :"+ config.getEmphasis());
-             Log.d(LOGTAG, "fmOn: ChSpacing   :"+ config.getChSpacing());
-             Log.d(LOGTAG, "fmOn: RdsStd      :"+ config.getRdsStd());
-             Log.d(LOGTAG, "fmOn: LowerLimit  :"+ config.getLowerLimit());
-             Log.d(LOGTAG, "fmOn: UpperLimit  :"+ config.getUpperLimit());
-
-             boolean bFmRxEnabled = false;
-
-             if (!mA2dpDeviceState.isDeviceAvailable()) {
-                 bStatus = mTransmitter.enable(config);
-             }
-             if( false == bStatus ) {
-                Log.e(LOGTAG,"FM Enable failed");
-                return bStatus;
-             }
-             bStatus = mTransmitter.setTxPowerLevel(FmTransmitter.FM_TX_PWR_LEVEL_7);
-
-             if( false == bStatus ) {
-                Log.e(LOGTAG,"FM setPowerLevel failed");
-                return bStatus;
-             }
-
-             Log.e(LOGTAG, "FMTx is on: Requesting to start FM Tx");
-             AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_TX,
-                                       AudioSystem.DEVICE_STATE_AVAILABLE, "");
-
-         }
-
-         if(true == bStatus )
-         {
-                bStatus = mTransmitter.setRdsOn();
-                if( true != bStatus ) {
-                    Log.d(LOGTAG, "FMTx setRdsOn failed");
-                } else {
-                    if(false == mTransmitter.getInternalAntenna()) {
-                        Log.d(LOGTAG, "Setting internal antenna explicitly");
-                        mTransmitter.setInternalAntenna(true);
-                    }
-                    startNotification();
-                }
-         }
-         else
-         {
-             stop();
-         }
-      }
-      return(bStatus);
-   }
-
-  /*
-   * Turn OFF FM Operations: This disables all the current FM operations             .
-   */
-   private void fmOperationsOff() {
-
-      Log.d(LOGTAG, "fmOperationsOff" );
-
-      Log.e(LOGTAG, "FMTx is off: requesting to stop FM Tx");
-      AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_TX,
-                                  AudioSystem.DEVICE_STATE_UNAVAILABLE, "");
-   }
-   /*
-    * Turn OFF FM: Disable the FM Host and hardware                                  .
-    *                                                                                 .
-    * @return true if fm Disable api was invoked successfully, false if the api failed.
-    */
-   private boolean fmOff() {
-      boolean bStatus=false;
-      Log.d(LOGTAG, "fmOff");
-
-      fmOperationsOff();
-
-      // This will disable the FM radio device
-      if (mTransmitter != null)
-      {
-         bStatus = mTransmitter.disable();
-         mTransmitter = null;
-      }
-      /* Disable Receiver */
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.disable();
-         mReceiver = null;
-      }
-      RText = " ";
-      stop();
-      return(bStatus);
-   }
-  /*
-   * Turn OFF FM: Disable the FM Host when hardware resets asynchronously            .
-   *                                                                                 .
-   * @return true if fm Reset api was invoked successfully, false if the api failed  .
-   */
-   private boolean fmRadioReset() {
-      boolean bStatus=false;
-      Log.d(LOGTAG, "fmRadioReset");
-      fmOperationsOff();
-
-      // This will disable the FM radio device
-      if (mTransmitter != null)
-      {
-         bStatus = mTransmitter.reset();
-         mTransmitter = null;
-      }
-      /* Disable Receiver */
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.reset();
-         mReceiver = null;
-      }
-      stop();
-      return(bStatus);
-   }
-
-   /*
-    * Restart FM Transmitter: Disables FM receiver mode or transmitter is already active
-    * and Powers up FM hardware, and initializes the FM module
-    *
-    * @return true if fm Enable api was invoked successfully, false if the api failed.
-    */
-
-   private boolean fmRestart() {
-      boolean bStatus=false;
-      Log.d(LOGTAG, "fmRestart");
-
-      /* First Disable Transmitter, if enabled */
-      if (mTransmitter != null)
-      {
-         bStatus = mTransmitter.disable();
-         mTransmitter = null;
-         mFMOn = false;
-      }
-
-      /* Disable Receiver */
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.disable();
-         mReceiver = null;
-      }
-      try {
-          Thread.sleep(100);//sleep needed for SoC to switch mode
-      }
-      catch ( Exception ex ) {
-          Log.d( LOGTAG,  "RunningThread InterruptedException");
-      }
-      bStatus = fmOn();
-      return(bStatus);
-   }
-
-   /* Returns whether FM hardware is ON.
-    *
-    * @return true if FM was tuned, searching. (at the end of
-    * the search FM goes back to tuned).
-    *
-    */
-   public boolean isFmOn() {
-      return mFMOn;
-   }
-
-   /*
-    *  ReConfigure the FM Setup parameters
-    *  - Band
-    *  - Channel Spacing (50/100/200 KHz)
-    *  - Emphasis (50/75)
-    *  - Frequency limits
-    *  - RDS/RBDS standard
-    *
-    * @return true if configure api was invoked successfully, false if the api failed.
-    */
-   public boolean fmReconfigure() {
-      boolean bStatus=false;
-      Log.d(LOGTAG, "fmReconfigure");
-      if (mTransmitter != null)
-      {
-         // This sets up the FM radio device
-         FmConfig config = FmSharedPreferences.getFMConfiguration();
-         Log.d(LOGTAG, "RadioBand   :"+ config.getRadioBand());
-         Log.d(LOGTAG, "Emphasis    :"+ config.getEmphasis());
-         Log.d(LOGTAG, "ChSpacing   :"+ config.getChSpacing());
-         Log.d(LOGTAG, "RdsStd      :"+ config.getRdsStd());
-         Log.d(LOGTAG, "LowerLimit  :"+ config.getLowerLimit());
-         Log.d(LOGTAG, "UpperLimit  :"+ config.getUpperLimit());
-         bStatus = mTransmitter.configure(config);
-      }
-      if (mCallbacks != null)
-      {
-         try
-         {
-            mCallbacks.onReconfigured();
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-      return(bStatus);
-   }
-
-   /*
-    * Register UI/Activity Callbacks
-    */
-   public void registerCallbacks(IFMTransmitterServiceCallbacks cb)
-   {
-      mCallbacks = cb;
-   }
-
-   /*
-    *  unRegister UI/Activity Callbacks
-    */
-   public void unregisterCallbacks()
-   {
-      mCallbacks=null;
-   }
-
-   /* Tunes to the specified frequency
-    *
-    * @return true if Tune command was invoked successfully, false if not muted.
-    *  Note: Callback FmRxEvRadioTuneStatus will be called when the tune
-    *        is complete
-    */
-   public boolean tune(int frequency) {
-      boolean bCommandSent=false;
-      double doubleFrequency = frequency/1000.00;
-
-      Log.d(LOGTAG, "tune:  " + doubleFrequency);
-      if (mTransmitter != null)
-      {
-         mTransmitter.setStation(frequency);
-         mTunedFrequency = frequency;
-         bCommandSent = true;
-      }
-      return bCommandSent;
-   }
-
-   /* Search for the weakest 12 FM Stations in the current band.
-    *
-    * It searches in the forward direction relative to the current tuned station.
-    * int numStations: maximum number of stations to search.
-    *
-    * @return true if Search command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvSearchListComplete will be called when the Search
-    *        is complete
-    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to
-    *        the previously tuned station.
-    */
-   public boolean searchWeakStationList(int numStations)
-   {
-
-       boolean bStatus=false;
-       FmConfig config = FmSharedPreferences.getFMConfiguration();
-
-       if(null != mTransmitter) {
-           mTransmitter.disable();
-           mTransmitter = null;
-           mFMOn = false;
-       }
-       if(null != mReceiver) {
-           mReceiver.disable();
-           mReceiver = null;
-       }
-       try {
-           Thread.sleep(100);//SoC needs a delay to switch mode
-       } catch (Exception ex) {
-           Log.d( LOGTAG,  "RunningThread InterruptedException");
-       }
-
-
-       if(null == mReceiver) {
-           try {
-               mReceiver = new FmReceiver(FMRADIO_DEVICE_FD_STRING, fmCallbacks);
-           }
-           catch (InstantiationException e){
-            throw new RuntimeException("FmTx service not available!");
-           }
-           if (mReceiver.getFMState() == mReceiver.FMState_Turned_Off) {
-               bStatus = mReceiver.enable(config);
-           } else {
-               try {
-                   Thread.sleep(100);
-               } catch (Exception ex) {
-                   Log.d( LOGTAG,  "RunningThread InterruptedException");
-               }
-               bStatus = mReceiver.enable(config);
-           }
-           if (!bStatus) {
-               Log.e( LOGTAG,  "Search for weak station failed");
-               return false;
-           }
-       }
-
-       bStatus = mReceiver.setStation(config.getLowerLimit());
-
-       Log.d(LOGTAG, "mReceiver.setStation:  bStatus: " + bStatus);
-       bStatus = mReceiver.searchStationList( FmReceiver.FM_RX_SRCHLIST_MODE_WEAKEST,
-                                              FmReceiver.FM_RX_SEARCHDIR_UP,
-                                              numStations,
-                                              0);
-
-        mFMSearchStations = 0;//numStations;
-        if(bStatus == false)
-        {
-           try
-           {
-              if (mCallbacks != null)
-              {
-                 mCallbacks.onSearchListComplete(false);
-              }
-           } catch (RemoteException e)
-           {
-              e.printStackTrace();
-           }
-        }
-      return bStatus;
-   }
-
-   /* Cancel any ongoing Search (Seek/Scan/SearchStationList).
-    *
-    * @return true if Search command was invoked successfully, false if not muted.
-    *  Note: 1. Callback FmRxEvSearchComplete will be called when the Search
-    *        is complete/cancelled.
-    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to a station
-    *        at the end of the Search or if the seach was cancelled.
-    */
-   public boolean cancelSearch()
-   {
-      boolean bStatus=false;
-      if (mReceiver != null)
-      {
-         bStatus = mReceiver.cancelSearch();
-         Log.d(LOGTAG, "mReceiver.cancelSearch: bStatus: " + bStatus);
-         try
-         {
-            if (mCallbacks != null)
-            {
-               mCallbacks.onSearchListComplete(false);
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-
-      }
-      return bStatus;
-   }
-
-   /* Retrieves the basic String to be displayed on UI
-    * Other than this static string the RDS String will be
-    * queried by Tx Activity to update on UI
-    */
-   public String getRadioText() {
-      String str = "Radio Text: Transmitting ";
-      Log.d(LOGTAG, "Radio Text: [" + str + "]");
-      return str;
-   }
-
-   /* Retrieves the station list from the SearchStationlist.
-    *
-    * @return Array of integers that represents the station frequencies.
-    * Note: 1. This is a synchronous call that should typically called when
-    *           Callback onSearchListComplete.
-    */
-   public int[] getSearchList()
-   {
-      int[] frequencyList = null;
-      if (mReceiver != null)
-      {
-         Log.d(LOGTAG, "getSearchList: ");
-         frequencyList = mReceiver.getStationList();
-      }
-      return frequencyList;
-   }
-   /* Set the FM Power Mode on the FM hardware SoC.
-    * Typically used when UI/Activity is in the background, so the Host is interrupted less often.
-    *
-    * boolean bLowPower: true: Enable Low Power mode on FM hardware.
-    *                    false: Disable Low Power mode on FM hardware. (Put into normal power mode)
-    * @return true if set power mode api was invoked successfully, false if the api failed.
-    */
-   public boolean setLowPowerMode(boolean bLowPower)
-   {
-      boolean bCommandSent=false;
-      if (mTransmitter != null)
-      {
-         Log.d(LOGTAG, "setLowPowerMode: " + bLowPower);
-         if(bLowPower)
-         {
-            bCommandSent = mTransmitter.setPowerMode(FmTransmitter.FM_TX_LOW_POWER_MODE);
-         }
-         else
-         {
-            bCommandSent = mTransmitter.setPowerMode(FmTransmitter.FM_TX_NORMAL_POWER_MODE);
-         }
-      }
-      return bCommandSent;
-   }
-   /** Determines if an internal Antenna is available.
-    *
-    * @return true if internal antenna is available, false if
-    *         internal antenna is not available.
-    */
-   public boolean isInternalAntennaAvailable()
-   {
-      boolean bAvailable  = false;
-      /* Update this when the API is available */
-
-      if(null != mTransmitter ) {
-          bAvailable = mTransmitter.getInternalAntenna();
-          Log.d(LOGTAG, "internalAntennaAvailable: " + bAvailable);
-      } else if( null != mReceiver ) {
-          bAvailable = mReceiver.getInternalAntenna();
-          Log.d(LOGTAG, "internalAntennaAvailable: " + bAvailable);
-      }
-      return bAvailable;
-   }
-
-
-   private FmTransmitterCallbacksAdaptor transmitCallbacks = new  FmTransmitterCallbacksAdaptor() {
-      public void FmTxEvRDSGroupsAvailable() {
-         // Do nothing
-      }
-
-      public void FmTxEvRDSGroupsComplete() {
-         // Do nothing
-      }
-      public void FmTxEvContRDSGroupsComplete() {
-      }
-
-      public void FmTxEvTuneStatusChange(int freq) {
-
-        Log.d(LOGTAG, "onTuneStatusChange\n");
-        if (mCallbacks != null)
-        {
-           try
-           {
-              mCallbacks.onTuneStatusChanged(freq);
-           } catch (RemoteException e)
-           {
-              e.printStackTrace();
-           }
-        }
-        /* Update the frequency in the StatusBar's Notification */
-        startNotification();
-
-        String s = getPSData();
-        if( true == mTransmitter.startPSInfo(
-            s, FM_TX_PROGRAM_TYPE, FM_TX_PROGRAM_ID, FM_TX_PS_REPEAT_COUNT ) ) {
-            if (mCallbacks != null)
-            {
-               try
-               {
-                  mCallbacks.onPSInfoSent(s);
-               } catch (RemoteException e)
-               {
-                  e.printStackTrace();
-               }
-            }
-        }
-
-        if (mTransmitter != null ){
-            mTransmitter.startRTInfo(RText, FM_TX_PROGRAM_TYPE, FM_TX_PROGRAM_ID );
-        }
-
-        try {
-             if (mCallbacks != null ) {
-                 mCallbacks.onMetaDataChanged(RText);
-             } else {
-                 Log.d(LOGTAG, "callback is not there");
-             }
-        } catch (RemoteException ex){
-             ex.printStackTrace();
-        }
-
-      }
-
-      public void FmTxEvRadioDisabled() {
-         Log.d(LOGTAG, "onRadioDisabled");
-         mFMOn = false;
-         if((mServiceInUse) && (mCallbacks != null) ) {
-            try {
-                  mCallbacks.onDisabled();
-            } catch(RemoteException e) {
-                  e.printStackTrace();
-            }
-         }
-      }
-      public void FmTxEvRadioEnabled() {
-         mFMOn = true;
-         if((mServiceInUse) && (mCallbacks != null) ) {
-            try {
-                  mCallbacks.onEnabled(true);
-            } catch(RemoteException e) {
-                  e.printStackTrace();
-            }
-         }
-      }
-      public void FmTxEvRadioReset() {
-         if(isFmOn()) {
-            // Received Radio Disable event unexpectedly
-            Log.d(LOGTAG, "FM is ON, reset FM");
-            fmRadioReset();
-            try {
-                /* Notify the UI/Activity, only if the service is "bound"
-                   by an activity and if Callbacks are registered
-                */
-                if((mServiceInUse) && (mCallbacks != null)) {
-                    mCallbacks.onRadioReset();
-                }
-             }
-             catch (RemoteException e) {
-                e.printStackTrace();
-             }
-         }
-      }
-   };
-
-   /* Receiver callbacks back from the FM Stack */
-   FmRxEvCallbacksAdaptor fmCallbacks = new FmRxEvCallbacksAdaptor()
-   {
-      public void FmRxEvEnableReceiver()
-      {
-         Log.d(LOGTAG, "FmRxEvEnableReceiver");
-      }
-      public void FmRxEvDisableReceiver()
-      {
-         Log.d(LOGTAG, "FmRxEvDisableReceiver");
-      }
-      public void FmRxEvRadioReset()
-      {
-         Log.d(LOGTAG, "FmRxEvRadioReset");
-         if(isFmOn()) {
-             // Received Radio Reset event
-             Log.d(LOGTAG, "FM is ON, reset FM");
-             fmRadioReset();
-             try
-             {
-                /* Notify the UI/Activity, only if the service is "bound"
-                   by an activity and if Callbacks are registered
-                */
-                if((mServiceInUse) && (mCallbacks != null) )
-                {
-                    mCallbacks.onRadioReset();
-                }
-             }
-             catch (RemoteException e)
-             {
-                e.printStackTrace();
-             }
-         }
-      }
-
-      public void FmRxEvRadioTuneStatus(int frequency)
-      {
-         Log.d(LOGTAG, "FmRxEvRadioTuneStatus: Tuned Frequency: " +frequency);
-      }
-
-      public void FmRxEvSearchListComplete()
-      {
-         Log.d(LOGTAG, "FmRxEvSearchListComplete");
-         try
-         {
-            if (mCallbacks != null) {
-                mCallbacks.onSearchListComplete(true);
-            } else if(mReceiver != null) {
-                mReceiver.disable();
-            }
-         } catch (RemoteException e)
-         {
-            e.printStackTrace();
-         }
-      }
-   };
-
-
-   /*
-    *  Read the Tuned Frequency from the FM module.
-    */
-   private String getTunedFrequencyString() {
-      double frequency = mTunedFrequency / 1000.0;
-      String frequencyString = getString(R.string.stat_notif_tx_frequency, (""+frequency));
-      return frequencyString;
-   }
-   /**
-    * Registers an intent to listen for ACTION_HEADSET_PLUG
-    * notifications. This intent is called to know if the headset
-    * was plugged in/out
-    */
-   public void registerHeadsetListener() {
-       if (mHeadsetReceiver == null) {
-           mHeadsetReceiver = new BroadcastReceiver() {
-               @Override
-               public void onReceive(Context context, Intent intent) {
-                   String action = intent.getAction();
-                   if (action.equals(Intent.ACTION_HEADSET_PLUG)) {
-                      Log.d(LOGTAG, "ACTION_HEADSET_PLUG Intent received");
-                      // Listen for ACTION_HEADSET_PLUG broadcasts.
-                      Log.d(LOGTAG, "mTransmitter: ACTION_HEADSET_PLUG");
-                      Log.d(LOGTAG, "==> intent: " + intent);
-                      Log.d(LOGTAG, "    state: " + intent.getIntExtra("state", 0));
-                      Log.d(LOGTAG, "    name: " + intent.getStringExtra("name"));
-                      mHeadsetPlugged = (intent.getIntExtra("state", 0) == 1);
-                      mHandler.post(mChangeFMTxState);
-
-                   } else if (mA2dpDeviceState.isA2dpStateChange(action)) {
-                       if (mA2dpDeviceState.isConnected(intent)){
-                           Log.d(LOGTAG, " A2DP connected");
-                           mHeadsetPlugged = true;
-                           if( mFMOn == true)
-                           {
-                               mHandler.post(mChangeFMTxState);
-                           }
-                       } else if( !mA2dpDeviceState.isConnected(intent)) {
-                           Log.d(LOGTAG, "A2DP disconnected");
-                           mHeadsetPlugged = false;
-                           if( mFMOn == false) // when FM Tx App open, DISC BT
-                           {
-                               Log.d(LOGTAG, "posting for a2dp state change");
-                               mHandler.post(mChangeFMTxState);
-                           }
-                       }
-                   } else if (action.equals("HDMI_CONNECTED")) {
-                       if( mFMOn == true) {
-                           Log.d(LOGTAG, "posting for hdmi state change");
-                           mHandler.post(mChangeFMTxState);
-                       }
-                   }
-               }
-           };
-           IntentFilter iFilter = new IntentFilter();
-           iFilter.addAction(Intent.ACTION_HEADSET_PLUG);
-           iFilter.addAction(mA2dpDeviceState.getActionSinkStateChangedString());
-           iFilter.addAction(mA2dpDeviceState.getActionPlayStateChangedString());
-           iFilter.addAction("HDMI_CONNECTED");
-           iFilter.addCategory(Intent.CATEGORY_DEFAULT);
-           registerReceiver(mHeadsetReceiver, iFilter);
-       }
-   }
-   final Runnable    mChangeFMTxState = new Runnable() {
-       public void run() {
-           boolean bStatus = false;
-
-           Log.d(LOGTAG, "Enter change FM Tx State");
-           /* Update the UI based on the state change of the headset/antenna*/
-           if(mHeadsetPlugged) {
-              bStatus =  cancelSearch();
-              if(bStatus == false)
-                 Log.e(LOGTAG, "Error in cancelling the search");
-              if(isFmOn()) {
-                 Log.d(LOGTAG, "disable called from headset handler");
-                 bStatus = fmOff();
-                 if(mServiceInUse && (mCallbacks != null) && (bStatus == true)) {
-                    try {
-                        mCallbacks.onDisabled();
-                    } catch(RemoteException e) {
-                        e.printStackTrace();
-                    }
-                 } else if(bStatus == false) {
-                    Log.e(LOGTAG, "Error in turning off the FM TX ");
-                 }
-              } else if(mReceiver != null) {
-                 bStatus = mReceiver.disable();
-                 if(bStatus == true)
-                    mReceiver = null;
-                 else
-                    Log.e(LOGTAG, "Error in disabling the FM RX");
-              }
-           }else {
-              if(!isFmOn()) {
-                 bStatus = fmOn();
-                 if(mServiceInUse && (mCallbacks != null) && (bStatus == true)) {
-                    try {
-                        mCallbacks.onEnabled(true);
-                    } catch(RemoteException e) {
-                        e.printStackTrace();
-                    }
-                 } else if(bStatus == false) {
-                    Log.e(LOGTAG, "Error in enabling the FM TX");
-                 }
-              }
-           }
-       }
-   };
-
-   private class RdsDisplay extends IRemoteControlDisplay.Stub {
-        RdsDisplay() {
-        }
-
-        @Override
-        public void setPlaybackState(int generationId, int state, long stateChangeTimeMs,
-                  long currentPosMs, float speed) {
-        }
-
-        @Override
-        public void setMetadata(int generationId, Bundle metadata) {
-            updateMetadata(metadata);
-        }
-
-        @Override
-        public void setTransportControlInfo(int generationId, int flags, int posCapabilities) {
-        }
-
-        @Override
-        public void setArtwork(int generationId, Bitmap bitmap) {
-        }
-
-        @Override
-        public void setAllMetadata(int generationId, Bundle metadata, Bitmap bitmap) {
-         }
-
-        @Override
-        public void setCurrentClientId(int clientGeneration, PendingIntent clientMediaIntent,
-                boolean clearing) {
-        }
-
-        @Override
-        public void setEnabled(boolean enabled) {
-        }
-
-        @Override
-        public void updateFolderInfoBrowsedPlayer(String stringUri) {
-        }
-
-        @Override
-        public void updateNowPlayingContentChange() {
-        }
-
-        @Override
-        public void playItemResponse(boolean success) {
-        }
-
-        @Override
-        public void updateNowPlayingEntries(long[] playList) {
-        }
-   }
-
-   class Metadata {
-        private String artist;
-        private String trackTitle;
-        private String albumTitle;
-
-        public Metadata() {
-            artist = null;
-            trackTitle = null;
-            albumTitle = null;
-        }
-
-        public String toString() {
-            return "Metadata[artist=" + artist + " trackTitle=" + trackTitle + " albumTitle=" +
-                   albumTitle + "]";
-        }
-   }
-
-   private String getMdString(Bundle data, int id) {
-        return data.getString(Integer.toString(id));
-   }
-
-   private void updateMetadata(Bundle data) {
-        String oldMetadata = mMetadata.toString();
-        mMetadata.artist = getMdString(data, MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST);
-        mMetadata.trackTitle = getMdString(data, MediaMetadataRetriever.METADATA_KEY_TITLE);
-        mMetadata.albumTitle = getMdString(data, MediaMetadataRetriever.METADATA_KEY_ALBUM);
-        Log.v(LOGTAG, "mMetadata=" + mMetadata.toString());
-        if (mTransmitter != null ){
-            RText = mMetadata.albumTitle  +":" + mMetadata.trackTitle +":"+ mMetadata.artist;
-            Log.d(LOGTAG,"RT string size is "+RText.length());
-            mTransmitter.startRTInfo(RText, FM_TX_PROGRAM_TYPE, FM_TX_PROGRAM_ID );
-        }
-
-        try {
-             if (mCallbacks != null ) {
-                 mCallbacks.onMetaDataChanged(RText);
-             } else {
-                 Log.d(LOGTAG, "callback is not there");
-             }
-        } catch (RemoteException ex){
-             ex.printStackTrace();
-        }
-   }
-   public boolean isHeadsetPlugged() {
-       if (mA2dpDeviceState.isDeviceAvailable())
-          mHeadsetPlugged = true;
-       return mHeadsetPlugged;
-   }
-   public boolean isCallActive() {
-       TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-       if( TelephonyManager.CALL_STATE_IDLE !=tmgr.getCallState() )
-           return true;
-       return false;
-   }
-   public String getPSData(){
-       return QFM_STRING;
-   }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FmSharedPreferences.java b/fmapp/src/com/codeaurora/fmradio/FmSharedPreferences.java
deleted file mode 100644
index 7fcb6a5..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FmSharedPreferences.java
+++ /dev/null
@@ -1,1158 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.codeaurora.fmradio;
-
-import java.util.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.Map;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import qcom.fmradio.FmReceiver;
-import qcom.fmradio.FmConfig;
-import android.util.Log;
-
-public class FmSharedPreferences
-{
-   public static final int REGIONAL_BAND_NORTH_AMERICA   = 0;
-   public static final int REGIONAL_BAND_EUROPE          = 1;
-   public static final int REGIONAL_BAND_JAPAN           = 2;
-   public static final int REGIONAL_BAND_JAPAN_WIDE      = 3;
-   public static final int REGIONAL_BAND_AUSTRALIA       = 4;
-   public static final int REGIONAL_BAND_AUSTRIA         = 5;
-   public static final int REGIONAL_BAND_BELGIUM         = 6;
-   public static final int REGIONAL_BAND_BRAZIL          = 7;
-   public static final int REGIONAL_BAND_CHINA           = 8;
-   public static final int REGIONAL_BAND_CZECH           = 9;
-   public static final int REGIONAL_BAND_DENMARK         = 10;
-   public static final int REGIONAL_BAND_FINLAND         = 11;
-   public static final int REGIONAL_BAND_FRANCE          = 12;
-   public static final int REGIONAL_BAND_GERMANY         = 13;
-   public static final int REGIONAL_BAND_GREECE          = 14;
-   public static final int REGIONAL_BAND_HONGKONG        = 15;
-   public static final int REGIONAL_BAND_INDIA           = 16;
-   public static final int REGIONAL_BAND_IRELAND         = 17;
-   public static final int REGIONAL_BAND_ITALY           = 18;
-   public static final int REGIONAL_BAND_KOREA           = 19;
-   public static final int REGIONAL_BAND_MEXICO          = 20;
-   public static final int REGIONAL_BAND_NETHERLANDS     = 21;
-   public static final int REGIONAL_BAND_NEWZEALAND      = 22;
-   public static final int REGIONAL_BAND_NORWAY          = 23;
-   public static final int REGIONAL_BAND_POLAND          = 24;
-   public static final int REGIONAL_BAND_PORTUGAL        = 25;
-   public static final int REGIONAL_BAND_RUSSIA          = 26;
-   public static final int REGIONAL_BAND_SINGAPORE       = 27;
-   public static final int REGIONAL_BAND_SLOVAKIA        = 28;
-   public static final int REGIONAL_BAND_SPAIN           = 29;
-   public static final int REGIONAL_BAND_SWITZERLAND     = 30;
-   public static final int REGIONAL_BAND_SWEDEN          = 31;
-   public static final int REGIONAL_BAND_TAIWAN          = 32;
-   public static final int REGIONAL_BAND_TURKEY          = 33;
-   public static final int REGIONAL_BAND_UNITEDKINGDOM   = 34;
-   public static final int REGIONAL_BAND_UNITED_STATES   = 35;
-   public static final int REGIONAL_BAND_USER_DEFINED    = 36;
-
-   public static final int RECORD_DUR_INDEX_0_VAL        = 5;
-   public static final int RECORD_DUR_INDEX_1_VAL       = 15;
-   public static final int RECORD_DUR_INDEX_2_VAL       = 30;
-   public static final int RECORD_DUR_INDEX_3_VAL       = -1;
-
-   private static final String LOGTAG = FMRadio.LOGTAG;
-
-   private static final String SHARED_PREFS = "fmradio_prefs";
-   private static final String LIST_NUM = "list_number";
-   private static final String LIST_NAME = "list_name";
-   private static final String STATION_NAME = "station_name";
-   private static final String STATION_FREQUENCY = "station_freq";
-   private static final String STATION_ID = "station_id";
-   private static final String STATION_PTY = "station_pty";
-   private static final String STATION_RDS = "station_rds";
-   private static final String STATION_NUM = "preset_number";
-
-   private static final String FMCONFIG_COUNTRY = "fmconfig_country";
-   //private static final String FMCONFIG_BAND = "fmconfig_band";
-   private static final String FMCONFIG_MIN = "fmconfig_min";
-   private static final String FMCONFIG_MAX = "fmconfig_max";
-   private static final String FMCONFIG_STEP = "fmconfig_step";
-   //private static final String FMCONFIG_EMPH = "fmconfig_emphasis";
-   //private static final String FMCONFIG_RDSSTD = "fmconfig_rdsstd";
-   /* Storage key String */
-   private static final String LAST_LIST_INDEX = "last_list_index";
-   public static final int MAX_NUM_TAG_TYPES = 64;
-   public static final int NUM_TAG_CATEGORY = 8;
-   public static final String []TAG_CATEGORIES = { "DUMMY", "ITEM", "INFO", "PROGRAMME",
-                                                      "INTERACTIVITY", "RFU", "PRIVATE_CLASSES",
-                                                      "DESCRIPTOR" };
-   public static final int [][]TAG_CATEGORY_RANGE  = { {0, 0}, {1, 11}, {12, 30},
-                                                         {31, 40}, {41, 53}, {54, 55},
-                                                         {56, 58}, {59, 63} };
-   public static final String []TAG_NAMES = { "DUMMY", "ITEM.TITLE", "ITEM.ALBUM", "ITEM.TRACKNUM",
-                                                  "ITEM.ARTIST", "ITEM.COMPOSITION", "ITEM.MOVEMENT",
-                                                  "ITEM.CONDUCTOR", "ITEM.COMPOSER", "ITEM.BAND", "ITEM.COMMENT",
-                                                  "ITEM.GENERE", "INFO.NEWS", "INFO.NEWS_LOCAL", "INFO.STOCK",
-                                                  "INFO.SPORT", "INFO.LOTTERY", "INFO.HOROSCOPE",
-                                                  "INFO.DAILY_DIVERSION", "INFO.HEALTH", "INFO.EVENT",
-                                                  "INFO.SCENE", "INFO.CINEMA", "INFO.TV", "INFO.DATE_TIME",
-                                                  "INFO.WEATHER", "INFO.TRAFFIC", "INFO.ALARM", "INFO.ADS",
-                                                  "INFO.URL", "INFO.OTHER", "PROGRAMME.STATIONNAME_SHORT",
-                                                  "PROGRAMME.NOW", "PROGRAMME.NEXT", "PROGRAMME.PART",
-                                                  "PROGRAMME.HOST", "PROGRAMME.EDITORIAL_STAFF",
-                                                  "PROGRAMME.FREQUENCY", "PROGRAMME.HOMEPAGE",
-                                                  "PROGRAMME.SUBCHANNEL", "PHONE.HOTLINE", "PHONE.STUDIO",
-                                                  "PHONE.OTHER", "SMS.STUDIO", "SMS.OTHER", "EMAIL.HOTLINE",
-                                                  "EMAIL.STUDIO", "EMAIL.OTHER", "MMS.OTHER", "CHAT",
-                                                  "CHAT.CENTRE", "VOTE.QUESTION", "VOTE.CENTRE", "RFU.1",
-                                                  "RFU.2", "PRIVATE.1", "PRIVATE.2", "PRIVATE.3",
-                                                  "PLACE", "APPOINTMENT", "IDENTIFIER", "PURCHASE", "GET_DATA" };
-
-   private static final String PREF_LAST_TUNED_FREQUENCY = "last_frequency";
-   private static final String LAST_RECORD_DURATION = "last_record_duration";
-   private static String  LAST_AF_JUMP_VALUE = "last_af_jump_value";
-
-   private static Map<String, String> mNameMap = new HashMap<String, String>();
-   private static List<PresetList> mListOfPlists = new ArrayList<PresetList>();
-   public static Set[] tagList = new TreeSet[FmSharedPreferences.MAX_NUM_TAG_TYPES];
-   public static int num_tags = 0;
-   private static FmConfig mFMConfiguration;
-
-   private static final String DEFAULT_NO_NAME = "";
-   private static final int DEFAULT_NO_FREQUENCY = 98100;
-   private static final int DEFAULT_NO_PTY = 0;
-   private static final int DEFAULT_NO_STATIONID = 0;
-   private static final int DEFAULT_NO_RDSSUP = 0;
-   private static CharSequence[] mListEntries;
-   private static CharSequence[] mListValues;
-   private static int mListIndex;
-   private Context mContext;
-   private static int mTunedFrequency = 98100;
-   private static int mBandMinFreq = 76000;
-   private static int mBandMaxFreq = 108000;
-   private static int mChanSpacing = 0;
-   private static int mFrequencyBand_Stepsize = 200;
-
-   private static int mCountry = 0;
-   /* true = Stereo and false = "force Mono" even if Station is transmitting a
-    * Stereo signal
-    */
-   private static boolean mAudioOutputMode=true;
-   private static boolean mAFAutoSwitch=true;
-   private static int mRecordDuration=0;
-
-   FmSharedPreferences(Context context){
-      mContext = context.getApplicationContext();
-      mFMConfiguration = new FmConfig();
-      Load();
-   }
-
-   public static void removeStation(int listIndex, int stationIndex){
-      if (listIndex < getNumList())
-      {
-         mListOfPlists.get(listIndex).removeStation(stationIndex);
-      }
-   }
-   public static void removeStation(int listIndex, PresetStation station){
-      if (listIndex < getNumList())
-      {
-         mListOfPlists.get(listIndex).removeStation(station);
-      }
-   }
-
-   public static void setListName(int listIndex, String name){
-      if (listIndex < getNumList())
-      {
-         mListOfPlists.get(listIndex).setName(name);
-      }
-   }
-
-   public static void setStationName(int listIndex, int stationIndex, String name){
-      if (listIndex < getNumList())
-      {
-         mListOfPlists.get(listIndex).setStationName(stationIndex, name);
-      }
-   }
-
-   public static String getListName(int listIndex){
-      String name = "";
-      addListIfEmpty(listIndex);
-      if (listIndex < getNumList())
-      {
-         name= mListOfPlists.get(listIndex).getName();
-      }
-      return name;
-   }
-
-   public static String getStationName(int listIndex, int stationIndex){
-      String name = "";
-      if (listIndex < getNumList())
-      {
-         name = mListOfPlists.get(listIndex).getStationName(stationIndex);
-      }
-      return name;
-   }
-
-   public static double getStationFrequency(int listIndex, int stationIndex){
-      double frequency = 0;
-      if (listIndex < getNumList())
-      {
-         frequency =  mListOfPlists.get(listIndex).getStationFrequency(stationIndex);
-      }
-      return frequency;
-   }
-
-   public static PresetList getStationList(int listIndex){
-      if (listIndex < getNumList())
-      {
-         return mListOfPlists.get(listIndex);
-      }
-      return null;
-   }
-
-   public static PresetStation getselectedStation(){
-      int listIndex = getCurrentListIndex();
-      PresetStation station = null;
-      if (listIndex < getNumList())
-      {
-         station = mListOfPlists.get(listIndex).getSelectedStation();
-      }
-      return station;
-   }
-
-   public static PresetStation getStationInList(int index){
-      int listIndex = getCurrentListIndex();
-      PresetStation station = null;
-      if (listIndex < getNumList())
-      {
-         station = mListOfPlists.get(listIndex).getStationFromIndex(index);
-      }
-      return station;
-   }
-   public static PresetStation getStationFromFrequency(int frequency){
-      int listIndex = getCurrentListIndex();
-      PresetStation station = null;
-      if (listIndex < getNumList())
-      {
-         station = mListOfPlists.get(listIndex).getStationFromFrequency(frequency);
-      }
-      return station;
-   }
-
-   public static PresetStation selectNextStation(){
-      int listIndex = getCurrentListIndex();
-      PresetStation station = null;
-      if (listIndex < getNumList())
-      {
-         station = mListOfPlists.get(listIndex).selectNextStation();
-      }
-      return station;
-   }
-
-   public static PresetStation selectPrevStation(){
-      int listIndex = getCurrentListIndex();
-      PresetStation station = null;
-      if (listIndex < getNumList())
-      {
-         station = mListOfPlists.get(listIndex).selectPrevStation();
-      }
-      return station;
-   }
-
-   public static void selectStation(PresetStation station){
-      int listIndex = getCurrentListIndex();
-      if (listIndex < getNumList())
-      {
-         mListOfPlists.get(listIndex).selectStation(station);
-      }
-   }
-
-   public static int getNumList(){
-      return mListOfPlists.size();
-   }
-
-   public static int getCurrentListIndex(){
-      return mListIndex;
-   }
-
-   public static void setListIndex(int index){
-      mListIndex = index;
-   }
-
-   public static Map<String, String> getNameMap(){
-      return mNameMap;
-   }
-
-   private static void addListIfEmpty(int listIndex){
-      if ( (listIndex < 1) && (getNumList() == 0))
-      {
-         createPresetList("FM");
-      }
-   }
-
-   public static void addStation(String name, int freq, int listIndex){
-      /* If no lists exists and a new station is added, add a new Preset List
-       * if "listIndex" requested was "0"
-       */
-      addListIfEmpty(listIndex);
-      if (getNumList() > listIndex)
-      {
-         mListOfPlists.get(listIndex).addStation(name, freq);
-      }
-   }
-
-   /** Add "station" into the Preset List indexed by "listIndex" */
-   public static void addStation(int listIndex, PresetStation station){
-      /* If no lists exists and a new station is added, add a new Preset List
-       * if "listIndex" requested was "0"
-       */
-      addListIfEmpty(listIndex);
-      if (getNumList() > listIndex)
-      {
-         mListOfPlists.get(listIndex).addStation(station);
-      }
-   }
-   public static void addTags(int index, String s) {
-     if ((index >= 0) && (index <FmSharedPreferences.MAX_NUM_TAG_TYPES)) {
-          if(tagList[index] == null) {
-             tagList[index] = new TreeSet<String>();
-          }
-          if (tagList[index].add(s))
-              num_tags++;
-     }
-   }
-   public static void clearTags() {
-       for(int i = 0; i <FmSharedPreferences.MAX_NUM_TAG_TYPES; i++) {
-           if(tagList[i] != null) {
-              tagList[i].clear();
-              Log.d(LOGTAG, "cleared tags of type" + i);
-           }
-       }
-       num_tags = 0;
-   }
-
-   /** Does "station" already exist in the Preset List indexed by "listIndex" */
-   public static boolean sameStationExists(int listIndex, PresetStation station){
-      boolean exists = false;
-      if (getNumList() > listIndex)
-      {
-         exists = mListOfPlists.get(listIndex).sameStationExists(station);
-      }
-      return exists;
-   }
-
-   /** Does "station" already exist in the current Preset List*/
-   public static boolean sameStationExists( PresetStation station){
-      int listIndex = getCurrentListIndex();
-      boolean exists = false;
-      if (getNumList() > listIndex)
-      {
-         exists = mListOfPlists.get(listIndex).sameStationExists(station);
-      }
-      return exists;
-   }
-
-   /** Does "station" already exist in the current Preset List*/
-   public static int getListStationCount( ){
-      int listIndex = getCurrentListIndex();
-      int numStations = 0;
-      if (getNumList() > listIndex)
-      {
-         numStations = mListOfPlists.get(listIndex).getStationCount();
-      }
-      return numStations;
-   }
-
-   public static void renamePresetList(String newName, int listIndex){
-      PresetList curList =    mListOfPlists.get(listIndex);
-      if (curList != null)
-      {
-         String oldListName = curList.getName();
-         curList.setName(newName);
-         String index = mNameMap.get(oldListName);
-         mNameMap.remove(oldListName);
-         mNameMap.put((String) newName, index);
-         repopulateEntryValueLists();
-      }
-   }
-
-   /* Returns the index of the list just created */
-   public static int createPresetList(String name) {
-      int numLists = mListOfPlists.size();
-      mListOfPlists.add(new PresetList(name));
-      String index = String.valueOf(numLists);
-      mNameMap.put(name, index);
-      repopulateEntryValueLists();
-      return numLists;
-   }
-
-
-   public static void createFirstPresetList(String name) {
-      mListIndex = 0;
-      createPresetList(name);
-   }
-
-   public static CharSequence[] repopulateEntryValueLists() {
-      ListIterator<PresetList> presetIter;
-      presetIter = mListOfPlists.listIterator();
-      int numLists = mListOfPlists.size();
-
-      mListEntries = new CharSequence[numLists];
-      mListValues = new CharSequence[numLists];
-      for (int i = 0; i < numLists; i++)
-      {
-         PresetList temp = presetIter.next();
-         mListEntries[i] = temp.getName();
-         mListValues[i] = temp.getName();
-      }
-      return mListEntries;
-   }
-
-   public static List<PresetList> getPresetLists() {
-      return mListOfPlists;
-   }
-
-
-   public void  Load(){
-      Log.d(LOGTAG, "Load preferences ");
-      if(mContext == null)
-      {
-         return;
-      }
-      SharedPreferences sp = mContext.getSharedPreferences(SHARED_PREFS, Context.MODE_PRIVATE);
-      mTunedFrequency = sp.getInt(PREF_LAST_TUNED_FREQUENCY, DEFAULT_NO_FREQUENCY);
-      mRecordDuration = sp.getInt(LAST_RECORD_DURATION, RECORD_DUR_INDEX_0_VAL);
-      mAFAutoSwitch = sp.getBoolean(LAST_AF_JUMP_VALUE, true);
-      if(sp.getInt(FMCONFIG_COUNTRY, 0) == REGIONAL_BAND_USER_DEFINED) {
-         mBandMinFreq = sp.getInt(FMCONFIG_MIN, mBandMinFreq);
-         mBandMaxFreq = sp.getInt(FMCONFIG_MAX, mBandMaxFreq);
-         mChanSpacing = sp.getInt(FMCONFIG_STEP, mChanSpacing);
-      }
-      int num_lists = sp.getInt(LIST_NUM, 1);
-      if (mListOfPlists.size() == 0) {
-
-         for (int listIter = 0; listIter < num_lists; listIter++)
-         {
-             String listName = sp.getString(LIST_NAME + listIter, "FM - " + (listIter+1));
-             int numStations = sp.getInt(STATION_NUM + listIter, 1);
-             if (listIter == 0)
-             {
-                 createFirstPresetList(listName);
-             } else
-             {
-                 createPresetList(listName);
-             }
-
-             PresetList curList = mListOfPlists.get(listIter);
-             for (int stationIter = 0; stationIter < numStations; stationIter++)
-             {
-                  String stationName = sp.getString(STATION_NAME + listIter + "x" + stationIter,
-                                                      DEFAULT_NO_NAME);
-                  int stationFreq = sp.getInt(STATION_FREQUENCY + listIter + "x" + stationIter,
-                                                   DEFAULT_NO_FREQUENCY);
-                  PresetStation station = curList.addStation(stationName, stationFreq);
-
-                  int stationId = sp.getInt(STATION_ID + listIter + "x" + stationIter,
-                                              DEFAULT_NO_STATIONID);
-                  station.setPI(stationId);
-
-                  int pty = sp.getInt(STATION_PTY + listIter + "x" + stationIter, DEFAULT_NO_PTY);
-                  station.setPty(pty);
-
-                  int rdsSupported = sp.getInt(STATION_RDS + listIter + "x" + stationIter,
-                                                 DEFAULT_NO_RDSSUP);
-                  if (rdsSupported != 0)
-                  {
-                      station.setRDSSupported(true);
-                  } else
-                  {
-                      station.setRDSSupported(false);
-                  }
-             }
-         }
-      }
-      /* Load Configuration */
-      if (Locale.getDefault().equals(Locale.CHINA)) {
-          setCountry(sp.getInt(FMCONFIG_COUNTRY, REGIONAL_BAND_CHINA));
-      } else {
-          setCountry(sp.getInt(FMCONFIG_COUNTRY, REGIONAL_BAND_NORTH_AMERICA));
-      }
-      /* Last list the user was navigating */
-      mListIndex = sp.getInt(LAST_LIST_INDEX, 0);
-      if(mListIndex >= num_lists)
-      {
-         mListIndex=0;
-      }
-   }
-
-   public void Save() {
-      if(mContext == null)
-      {
-         return;
-      }
-      Log.d(LOGTAG, "Save preferences ");
-
-      int numLists = mListOfPlists.size();
-      SharedPreferences sp = mContext.getSharedPreferences(SHARED_PREFS, Context.MODE_PRIVATE);
-      SharedPreferences.Editor ed = sp.edit();
-
-      ed.putInt(PREF_LAST_TUNED_FREQUENCY, mTunedFrequency);
-
-      ed.putInt(LIST_NUM, numLists);
-      /* Last list the user was navigating */
-      ed.putInt(LAST_LIST_INDEX, mListIndex);
-
-      for (int listIter = 0; listIter < numLists; listIter++)
-      {
-         PresetList curList = mListOfPlists.get(listIter);
-         ed.putString(LIST_NAME + listIter, curList.getName());
-         int numStations = curList.getStationCount();
-         ed.putInt(STATION_NUM + listIter, numStations);
-         int numStation = 0;
-         for (int stationIter = 0; stationIter < numStations; stationIter++)
-         {
-            PresetStation station = curList.getStationFromIndex(stationIter);
-            if (station != null)
-            {
-               ed.putString(STATION_NAME + listIter + "x" + numStation,
-                            station.getName());
-               ed.putInt(STATION_FREQUENCY + listIter + "x" + numStation,
-                         station.getFrequency());
-               ed.putInt(STATION_ID + listIter + "x" + numStation,
-                         station.getPI());
-               ed.putInt(STATION_PTY + listIter + "x" + numStation,
-                         station.getPty());
-               ed.putInt(STATION_RDS + listIter + "x" + numStation,
-                         (station.getRDSSupported() == true? 1:0));
-               numStation ++;
-            }
-         }
-      }
-
-      /* Save Configuration */
-      ed.putInt(FMCONFIG_COUNTRY, mCountry);
-      if(mCountry == REGIONAL_BAND_USER_DEFINED) {
-         ed.putInt(FMCONFIG_MIN, mBandMinFreq);
-         ed.putInt(FMCONFIG_MAX, mBandMaxFreq);
-         ed.putInt(FMCONFIG_STEP, mChanSpacing);
-      }
-      ed.putInt(LAST_RECORD_DURATION, mRecordDuration);
-      ed.putBoolean(LAST_AF_JUMP_VALUE, mAFAutoSwitch);
-      ed.commit();
-   }
-
-   public static void SetDefaults() {
-      mListIndex=0;
-      mListOfPlists.clear();
-      if (Locale.getDefault().equals(Locale.CHINA)){
-          setCountry(REGIONAL_BAND_CHINA);
-          //Others set north America.
-      } else {
-          setCountry(REGIONAL_BAND_NORTH_AMERICA);
-      }
-   }
-
-   public static void removeStationList(int listIndex) {
-      mListIndex = listIndex;
-      PresetList toRemove = mListOfPlists.get(mListIndex);
-
-      mNameMap.remove(toRemove.getName());
-      mListOfPlists.remove(mListIndex);
-      int numLists = mListOfPlists.size();
-
-      /* Remove for others */
-      for (int i = mListIndex; i < numLists; i++)
-      {
-         PresetList curList = mListOfPlists.get(i);
-         if (curList!=null)
-         {
-            String listName = curList.getName();
-            /* Removals */
-            mNameMap.remove(listName);
-            mNameMap.put(listName, String.valueOf(i));
-         }
-      }
-      mListIndex = 0;
-      repopulateEntryValueLists();
-   }
-
-
-   public static void setTunedFrequency(int frequency) {
-      mTunedFrequency = frequency;
-   }
-
-   public static int getTunedFrequency() {
-      return mTunedFrequency;
-   }
-
-   public static int getNextTuneFrequency(int frequency) {
-              int nextFrequency = (frequency + mFrequencyBand_Stepsize);
-              if (nextFrequency > getUpperLimit())
-              {
-                 nextFrequency = getLowerLimit();
-              }
-              return nextFrequency;
-           }
-
-   public static int getNextTuneFrequency() {
-      int nextFrequency = (mTunedFrequency + mFrequencyBand_Stepsize);
-      if (nextFrequency > getUpperLimit())
-      {
-         nextFrequency = getLowerLimit();
-      }
-      return nextFrequency;
-   }
-
-   public static int getPrevTuneFrequency(int frequency) {
-              int prevFrequency = (frequency - mFrequencyBand_Stepsize);
-              if (prevFrequency < getLowerLimit())
-              {
-                 prevFrequency = getUpperLimit();
-              }
-              return prevFrequency;
-           }
-
-   public static int getPrevTuneFrequency() {
-      int prevFrequency = (mTunedFrequency - mFrequencyBand_Stepsize);
-      if (prevFrequency < getLowerLimit())
-      {
-         prevFrequency = getUpperLimit();
-      }
-      return prevFrequency;
-   }
-
-   /**
-    * @param mFMConfiguration the mFMConfiguration to set
-    */
-   public static void setFMConfiguration(FmConfig mFMConfig) {
-      FmSharedPreferences.mFMConfiguration = mFMConfig;
-   }
-
-   /**
-    * @return the mFMConfiguration
-    */
-   public static FmConfig getFMConfiguration() {
-      return mFMConfiguration;
-   }
-
-   public static void setRadioBand(int band)
-   {
-      switch (band)
-      {
-      case FmReceiver.FM_JAPAN_WIDE_BAND:
-         {
-            mFrequencyBand_Stepsize = 50;
-            mFMConfiguration.setLowerLimit(76000);
-            mFMConfiguration.setUpperLimit(108000);
-            break;
-         }
-      case FmReceiver.FM_JAPAN_STANDARD_BAND:
-         {
-            mFrequencyBand_Stepsize = 100;
-            mFMConfiguration.setLowerLimit(76000);
-            mFMConfiguration.setUpperLimit(90000);
-            break;
-         }
-      case FmReceiver.FM_USER_DEFINED_BAND:
-         {
-            break;
-         }
-      case FmReceiver.FM_US_BAND:
-      case FmReceiver.FM_EU_BAND:
-      default:
-         {
-            band =  FmReceiver.FM_US_BAND;
-            mFMConfiguration.setLowerLimit(87500);
-            mFMConfiguration.setUpperLimit(107900);
-            mFrequencyBand_Stepsize = 100;
-         }
-      }
-      mFMConfiguration.setRadioBand(band);
-   }
-
-   public static int getRadioBand()
-   {
-      return mFMConfiguration.getRadioBand();
-   }
-
-   public static void setChSpacing(int spacing)
-   {
-      if( (spacing >= FmReceiver.FM_CHSPACE_200_KHZ)
-          && (spacing <= FmReceiver.FM_CHSPACE_50_KHZ))
-      {
-         mFrequencyBand_Stepsize = 200;
-         switch (spacing)
-         {
-         case FmReceiver.FM_CHSPACE_100_KHZ:
-            {
-               mFrequencyBand_Stepsize = 100;
-               break;
-            }
-         case FmReceiver.FM_CHSPACE_50_KHZ:
-            {
-               mFrequencyBand_Stepsize = 50;
-               break;
-            }
-         }
-         mChanSpacing = spacing;
-         mFMConfiguration.setChSpacing(spacing);
-      }
-   }
-
-   public static int getChSpacing()
-   {
-      return mFMConfiguration.getChSpacing();
-   }
-
-   public static void setRdsStd(int std)
-   {
-      if( (std>=FmReceiver.FM_RDS_STD_RBDS)
-          && (std<=FmReceiver.FM_RDS_STD_NONE))
-      {
-         mFMConfiguration.setRdsStd(std);
-      }
-   }
-
-   public static int getRdsStd()
-   {
-      return mFMConfiguration.getRdsStd();
-   }
-
-   /* North America */
-   public static boolean isRDSStd()
-   {
-      return(FmReceiver.FM_RDS_STD_RDS == mFMConfiguration.getRdsStd());
-   }
-
-   public static boolean isRBDSStd()
-   {
-      return(FmReceiver.FM_RDS_STD_RBDS == mFMConfiguration.getRdsStd());
-   }
-
-   public static void setEmphasis(int emph)
-   {
-      if( (emph>=FmReceiver.FM_DE_EMP75)
-          && (emph<=FmReceiver.FM_DE_EMP50))
-      {
-         mFMConfiguration.setEmphasis(emph);
-      }
-   }
-
-   public static int getEmphasis()
-   {
-      return mFMConfiguration.getEmphasis();
-   }
-
-   public static int getUpperLimit()
-   {
-      return mFMConfiguration.getUpperLimit();
-   }
-
-   public static int getLowerLimit()
-   {
-      return mFMConfiguration.getLowerLimit();
-   }
-
-   public static void setLowerLimit(int lowLimit) {
-      mFMConfiguration.setLowerLimit(lowLimit);
-      if(mCountry == REGIONAL_BAND_USER_DEFINED) {
-         mBandMinFreq = lowLimit;
-      }
-   }
-
-   public static void setUpperLimit(int upLimit){
-      mFMConfiguration.setUpperLimit(upLimit);
-      if(mCountry == REGIONAL_BAND_USER_DEFINED) {
-         mBandMaxFreq = upLimit;
-      }
-   }
-
-   public static void setCountry(int nCountryCode){
-
-      // Default: 87500  TO 10800 IN 100 KHZ STEPS
-      mFMConfiguration.setRadioBand(FmReceiver.FM_USER_DEFINED_BAND);
-      mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_100_KHZ);
-      mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP50);
-      mFMConfiguration.setRdsStd(FmReceiver.FM_RDS_STD_RDS);
-      mFMConfiguration.setLowerLimit(87500);
-      mFMConfiguration.setUpperLimit(108000);
-
-      switch(nCountryCode)
-      {
-        case REGIONAL_BAND_NORTH_AMERICA:
-        {
-          /*NORTH_AMERICA : 87500 TO 108000 IN 200 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_US_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_200_KHZ);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setRdsStd(FmReceiver.FM_RDS_STD_RBDS);
-          mFMConfiguration.setLowerLimit(87500);
-          mFMConfiguration.setUpperLimit(107900);
-          mFrequencyBand_Stepsize = 200;
-          break;
-        }
-        case REGIONAL_BAND_EUROPE:
-        {
-          /*EUROPE/Default : 87500 TO 10800 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-
-        case REGIONAL_BAND_JAPAN:
-        {
-          /*JAPAN : 76000  TO 90000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_JAPAN_STANDARD_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_100_KHZ);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setLowerLimit(76000);
-          mFMConfiguration.setUpperLimit(90000);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_JAPAN_WIDE:
-        {
-          /*JAPAN_WB : 90000 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_JAPAN_WIDE_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setLowerLimit(90000);
-          mFMConfiguration.setUpperLimit(108000);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-
-        /* Country specific */
-        case REGIONAL_BAND_AUSTRALIA:
-        {
-          /*AUSTRALIA : 87700 TO 108000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setLowerLimit(87700);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_AUSTRIA:
-        {
-          /*AUSTRIA : 87500 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP50);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_BELGIUM:
-       {
-         /*BELGIUM : 87500 TO 108000 IN 100 KHZ STEPS*/
-         mFrequencyBand_Stepsize = 100;
-         break;
-       }
-       case REGIONAL_BAND_BRAZIL:
-       {
-         /*BRAZIL : 87500 TO 108000 IN 200 KHZ STEP*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_US_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_200_KHZ);
-          mFMConfiguration.setLowerLimit(87500);
-          mFMConfiguration.setUpperLimit(107900);
-          mFrequencyBand_Stepsize = 200;
-          break;
-        }
-        case REGIONAL_BAND_CHINA:
-        {
-          /*CHINA : 87000 TO 108000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setLowerLimit(87000);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_CZECH:
-        {
-          /*CZECH : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_DENMARK:
-        {
-          /*DENMARK : 87500 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_FINLAND:
-        {
-          /*FINLAND : 87500  TO 108000  IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_FRANCE:
-        {
-          /* FRANCE : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_GERMANY:
-          /*GERMANY : 87500 TO 108000 IN 50 KHZ STEPS*/
-        case REGIONAL_BAND_GREECE:
-          /*GREECE : 87500 TO 108000 IN 50 KHZ STEPS*/
-        {
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_HONGKONG:
-        {
-          /*HONG KONG : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_INDIA:
-        {
-          /*INDIA : 91000 TO 106400 IN 100 KHZ STEPS*/
-          mFMConfiguration.setLowerLimit(91000);
-          mFMConfiguration.setUpperLimit(106400);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_IRELAND:
-        {
-          /*IRELAND : 87500 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_ITALY:
-        {
-          /*ITALY : 87500 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_KOREA:
-        {
-          /*KOREA : 87500 TO 108000 IN 200 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_US_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_200_KHZ);
-          mFMConfiguration.setUpperLimit(107900);
-          mFrequencyBand_Stepsize = 200;
-          break;
-        }
-        case REGIONAL_BAND_MEXICO:
-        {
-          /*MEXICO : 88100 TO 107900 IN 200 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_US_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_200_KHZ);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setRdsStd(FmReceiver.FM_RDS_STD_RBDS);
-          mFMConfiguration.setLowerLimit(88100);
-          mFMConfiguration.setUpperLimit(107900);
-          mFrequencyBand_Stepsize = 200;
-          break;
-        }
-        case REGIONAL_BAND_NETHERLANDS:
-        {
-          /*NETHERLANDS : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_NEWZEALAND:
-        {
-          /*NEW ZEALAND : 88000 TO 107000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setLowerLimit(88000);
-          mFMConfiguration.setUpperLimit(107000);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_NORWAY:
-        {
-          /*NORWAY : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_POLAND:
-        {
-          /*POLAND : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_100_KHZ);
-          mFMConfiguration.setLowerLimit(87500);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_PORTUGAL:
-        {
-          /*PORTUGAL : 87500 TO 108000 IN 50 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_EU_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_50_KHZ);
-          mFrequencyBand_Stepsize = 50;
-          break;
-        }
-        case REGIONAL_BAND_RUSSIA:
-        {
-          /*RUSSIA : 87500 TO 108000  IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_SINGAPORE:
-        {
-          /*SINGAPORE : 88000 TO 108000 IN 100 KHZ STEPS*/
-          mFMConfiguration.setLowerLimit(88000);
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_SLOVAKIA:
-        {
-          /*SLOVAKIA : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_SPAIN:
-        {
-          /*SPAIN : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_SWITZERLAND:
-        {
-          /*SWITZERLAND : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_SWEDEN:
-        {
-          /*SWEDEN : 87500 TO 108000  IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_TAIWAN:
-        {
-          /*TAIWAN : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_TURKEY:
-        {
-          /*TURKEY : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_UNITEDKINGDOM:
-        {
-          /*UNITED KINGDOM : 87500 TO 108000 IN 100 KHZ STEPS*/
-          mFrequencyBand_Stepsize = 100;
-          break;
-        }
-        case REGIONAL_BAND_UNITED_STATES:
-        {
-          /*UNITED STATES : 88100 TO 107900 IN 200 KHZ STEPS*/
-          mFMConfiguration.setRadioBand(FmReceiver.FM_US_BAND);
-          mFMConfiguration.setChSpacing(FmReceiver.FM_CHSPACE_200_KHZ);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setRdsStd(FmReceiver.FM_RDS_STD_RBDS);
-          mFMConfiguration.setLowerLimit(88100);
-          mFMConfiguration.setUpperLimit(107900);
-          mFrequencyBand_Stepsize = 200;
-          break;
-        }
-        case REGIONAL_BAND_USER_DEFINED:
-        {
-          mFMConfiguration.setRadioBand(FmReceiver.FM_USER_DEFINED_BAND);
-          mFMConfiguration.setChSpacing(mChanSpacing);
-          mFMConfiguration.setEmphasis(FmReceiver.FM_DE_EMP75);
-          mFMConfiguration.setRdsStd(FmReceiver.FM_RDS_STD_RDS);
-          mFMConfiguration.setLowerLimit(mBandMinFreq);
-          mFMConfiguration.setUpperLimit(mBandMaxFreq);
-          if(mChanSpacing == 0) {
-             mFrequencyBand_Stepsize = 200;
-          }else if(mChanSpacing == 1) {
-             mFrequencyBand_Stepsize = 100;
-          }else {
-             mFrequencyBand_Stepsize = 50;
-          }
-          break;
-        }
-        default:
-        {
-          Log.d(LOGTAG, "Invalid: countryCode: "+nCountryCode);
-          nCountryCode=0;
-        }
-      }
-    mCountry = nCountryCode;
-    Log.d(LOGTAG, "=====================================================");
-    Log.d(LOGTAG, "Country     :"+nCountryCode);
-    Log.d(LOGTAG, "RadioBand   :"+ mFMConfiguration.getRadioBand());
-    Log.d(LOGTAG, "Emphasis    :"+ mFMConfiguration.getEmphasis());
-    Log.d(LOGTAG, "ChSpacing   :"+ mFMConfiguration.getChSpacing());
-    Log.d(LOGTAG, "RdsStd      :"+ mFMConfiguration.getRdsStd());
-    Log.d(LOGTAG, "LowerLimit  :"+ mFMConfiguration.getLowerLimit());
-    Log.d(LOGTAG, "UpperLimit  :"+ mFMConfiguration.getUpperLimit());
-    Log.d(LOGTAG, "=====================================================");
-   }
-
-
-   public static int getCountry() {
-      return mCountry;
-   }
-
-
-   public static void setAudioOutputMode(boolean bStereo) {
-      mAudioOutputMode = bStereo;
-   }
-
-   public static boolean getAudioOutputMode() {
-      return mAudioOutputMode;
-   }
-
-   public static void setRecordDuration(int durationIndex) {
-
-      Log.d(LOGTAG, "setRecordDuration "+durationIndex);
-      switch( durationIndex ) {
-
-      case 0: mRecordDuration = RECORD_DUR_INDEX_0_VAL; break;
-      case 1: mRecordDuration = RECORD_DUR_INDEX_1_VAL; break;
-      case 2: mRecordDuration = RECORD_DUR_INDEX_2_VAL; break;
-      case 3: mRecordDuration = RECORD_DUR_INDEX_3_VAL; break;
-      default:
-        {
-           Log.d(LOGTAG, "Invalid: durationIndex "+durationIndex);
-        }
-
-      }
-      return;
-   }
-
-   public static int getRecordDuration() {
-      return mRecordDuration;
-   }
-
-
-   public static void setAutoAFSwitch(boolean bAFAutoSwitch) {
-      mAFAutoSwitch = bAFAutoSwitch;
-   }
-
-   public static boolean getAutoAFSwitch() {
-      return mAFAutoSwitch;
-   }
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/FmTags.java b/fmapp/src/com/codeaurora/fmradio/FmTags.java
deleted file mode 100644
index c54196a..0000000
--- a/fmapp/src/com/codeaurora/fmradio/FmTags.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import java.util.*;
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Handler;
-import android.os.Message;
-import android.os.RemoteException;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.View;
-import android.view.ViewGroup.LayoutParams;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.Spinner;
-import android.widget.TableLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-import android.widget.ListView;
-
-
-public class FmTags extends Activity {
-      private ListView la;
-      private ArrayAdapter<String> adapter;
-      private final Handler mHandler = new Handler();
-      private Iterator itr;
-
-      @Override
-       public void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-            setContentView(R.layout.fmtags);
-            la = (ListView)findViewById(R.id.TagListView);
-       }
-       @Override
-       public void onStart() {
-            super.onStart();
-       }
-       @Override
-       public void onResume() {
-            super.onResume();
-            mHandler.post(mDisplayTagList);
-       }
-       final Runnable mDisplayTagList = new Runnable() {
-            public void run() {
-                   String[] tags;
-                   int l = 0;
-
-                   tags = new String[FmSharedPreferences.num_tags];
-                   for(int i = 0; i < FmSharedPreferences.MAX_NUM_TAG_TYPES; i++) {
-                       if (FmSharedPreferences.tagList[i] != null) {
-                          itr = FmSharedPreferences.tagList[i].iterator();
-                          while(itr.hasNext())
-                                tags[l++] = ((FmSharedPreferences.TAG_NAMES[i]) + "\n" +
-                                              "\t" + (String)itr.next());
-                       }
-                   }
-                   adapter = new ArrayAdapter(la.getContext(), android.R.layout.simple_list_item_1, tags);
-                   la.setAdapter(adapter);
-            }
-       };
-}
-
-
diff --git a/fmapp/src/com/codeaurora/fmradio/GetNextFreqInterface.java b/fmapp/src/com/codeaurora/fmradio/GetNextFreqInterface.java
deleted file mode 100644
index 3330887..0000000
--- a/fmapp/src/com/codeaurora/fmradio/GetNextFreqInterface.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-public interface GetNextFreqInterface {
-   public int getNextFreq();
-   public void Stop();
-   public boolean errorOccured();
-}
-
diff --git a/fmapp/src/com/codeaurora/fmradio/IFMRadioService.aidl b/fmapp/src/com/codeaurora/fmradio/IFMRadioService.aidl
deleted file mode 100644
index 317a176..0000000
--- a/fmapp/src/com/codeaurora/fmradio/IFMRadioService.aidl
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import com.codeaurora.fmradio.IFMRadioServiceCallbacks;
-
-interface IFMRadioService
-{
-    boolean fmOn();
-    boolean fmOff();
-    boolean fmRadioReset();
-    boolean isFmOn();
-    boolean isAnalogModeEnabled();
-    boolean isFmRecordingOn();
-    boolean isSpeakerEnabled();
-    boolean fmReconfigure();
-    void registerCallbacks(IFMRadioServiceCallbacks cb);
-    void unregisterCallbacks();
-    boolean mute();
-    boolean routeAudio(int device);
-    boolean unMute();
-    boolean isMuted();
-    void startRecording();
-    void stopRecording();
-    boolean tune(int frequency);
-    boolean seek(boolean up);
-    void enableSpeaker(boolean speakerOn);
-    boolean scan(int pty);
-    boolean seekPI(int piCode);
-    boolean searchStrongStationList(int numStations);
-    int[]   getSearchList();
-    boolean cancelSearch();
-    String getProgramService();
-    String getRadioText();
-    int getProgramType();
-    int getProgramID();
-    boolean setLowPowerMode(boolean bLowPower);
-    int getPowerMode();
-    boolean enableAutoAF(boolean bEnable);
-    boolean enableStereo(boolean bEnable);
-    boolean isAntennaAvailable();
-    boolean isWiredHeadsetAvailable();
-    boolean isCallActive();
-    int getRssi();
-    int getIoC();
-    int getMpxDcc();
-    int getIntDet();
-    int getSINR();
-    void setHiLoInj(int inj);
-    void delayedStop(long nDuration, int nType);
-    void cancelDelayedStop (int nType);
-    void requestFocus();
-    boolean setSinrSamplesCnt(int samplesCnt);
-    boolean setSinrTh(int sinr);
-    boolean setIntfDetLowTh(int intfLowTh);
-    boolean setIntfDetHighTh(int intfHighTh);
-    String getExtenRadioText();
-    int getSinrSamplesCnt();
-    int getSinrTh();
-    int getSearchAlgoType();
-    boolean setSearchAlgoType(int searchType);
-    int getSinrFirstStage();
-    boolean setSinrFirstStage(int sinr);
-    int getRmssiFirstStage();
-    boolean setRmssiFirstStage(int rmssi);
-    int getCFOMeanTh();
-    boolean setCFOMeanTh(int cf0);
-    boolean setAfJmpRmssiTh(int afJmpRmssiTh);
-    boolean setGoodChRmssiTh(int gdChRmssiTh);
-    boolean setAfJmpRmssiSamplesCnt(int afJmpRmssiSmplsCnt);
-    int getAfJmpRmssiTh();
-    int getGoodChRmssiTh();
-    int getAfJmpRmssiSamplesCnt();
-    boolean setRxRepeatCount(int count);
-    long getRecordingStartTime();
-}
-
diff --git a/fmapp/src/com/codeaurora/fmradio/IFMRadioServiceCallbacks.aidl b/fmapp/src/com/codeaurora/fmradio/IFMRadioServiceCallbacks.aidl
deleted file mode 100644
index 4d116ec..0000000
--- a/fmapp/src/com/codeaurora/fmradio/IFMRadioServiceCallbacks.aidl
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-interface IFMRadioServiceCallbacks
-{
-  void onEnabled();
-  void onDisabled();
-  void onRadioReset();
-  void onTuneStatusChanged();
-  void onProgramServiceChanged();
-  void onRadioTextChanged();
-  void onAlternateFrequencyChanged();
-  void onSignalStrengthChanged();
-  void onSearchComplete();
-  void onSearchListComplete();
-  void onMute(boolean bMuted);
-  void onAudioUpdate(boolean bStereo);
-  void onStationRDSSupported(boolean bRDSSupported);
-  void onRecordingStopped();
-  void onExtenRadioTextChanged();
-  void onRecordingStarted();
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/IFMTransmitterService.aidl b/fmapp/src/com/codeaurora/fmradio/IFMTransmitterService.aidl
deleted file mode 100644
index 39bc70b..0000000
--- a/fmapp/src/com/codeaurora/fmradio/IFMTransmitterService.aidl
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import com.codeaurora.fmradio.IFMTransmitterServiceCallbacks;
-interface IFMTransmitterService
-{
-    boolean fmOn();
-    boolean fmOff();
-    boolean fmRestart();
-    boolean isFmOn();
-    boolean fmReconfigure();
-    void registerCallbacks(IFMTransmitterServiceCallbacks cb);
-    void unregisterCallbacks();
-    boolean tune(int frequency);
-    boolean searchWeakStationList(int numStations);
-    int[]   getSearchList();
-    boolean cancelSearch();
-    String getRadioText();
-    boolean isInternalAntennaAvailable();
-    boolean isHeadsetPlugged();
-    boolean isCallActive();
-    String  getPSData();
-}
-
diff --git a/fmapp/src/com/codeaurora/fmradio/IFMTransmitterServiceCallbacks.aidl b/fmapp/src/com/codeaurora/fmradio/IFMTransmitterServiceCallbacks.aidl
deleted file mode 100644
index 27a7249..0000000
--- a/fmapp/src/com/codeaurora/fmradio/IFMTransmitterServiceCallbacks.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2009,2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * Neither the name of The Linux Foundation nor
- *      the names of its contributors may be used to endorse or promote
- *      products derived from this software without specific prior written
- *      permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-interface IFMTransmitterServiceCallbacks
-{
-  void onEnabled(boolean bStatus);
-  void onDisabled();
-  void onRadioReset();
-  void onTuneStatusChanged(int frequency);
-  void onRadioTextChanged();
-  void onSearchListComplete(boolean bStatus);
-  void onReconfigured();
-  void onMetaDataChanged(String str);
-  void onPSInfoSent(String str);
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/PresetList.java b/fmapp/src/com/codeaurora/fmradio/PresetList.java
deleted file mode 100644
index a2fd1a9..0000000
--- a/fmapp/src/com/codeaurora/fmradio/PresetList.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 2009-2013 The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class PresetList{
-    private    List<PresetStation> mPresetList = new ArrayList<PresetStation>();
-    private    int mCurrentStation = 0;
-    private    String mListName = "";
-
-    public PresetList(String name) {
-        mListName = name;
-    }
-
-    public String getName(){
-        return mListName;
-    }
-
-    public String toString(){
-        return mListName;
-    }
-
-    public synchronized int getStationCount(){
-        return mPresetList.size();
-    }
-
-    public synchronized String getStationName(int stationNum){
-        String name = "";
-        if (mPresetList.size() > stationNum){
-            name = mPresetList.get(stationNum).getName();
-        }
-        return name;
-    }
-
-    public synchronized int getStationFrequency(int stationNum){
-        int frequency = 102100;
-        if (mPresetList.size() > stationNum){
-            frequency = mPresetList.get(stationNum).getFrequency();
-        }
-        return frequency;
-    }
-
-    public void setName(String name){
-        mListName = name;
-    }
-
-    public synchronized void setStationFrequency(int stationNum, int frequency){
-        PresetStation mStation = mPresetList.get(stationNum);
-        mStation.setFrequency(frequency);
-    }
-
-    public synchronized void setStationName(int stationNum, String name){
-        PresetStation mStation = mPresetList.get(stationNum);
-        mStation.setName(name);
-    }
-
-    public synchronized PresetStation getStationFromIndex(int index){
-        int totalPresets = mPresetList.size();
-        PresetStation station = null;
-        if (index < totalPresets) {
-            station = mPresetList.get(index);
-        }
-        return station;
-    }
-
-    public synchronized PresetStation getStationFromFrequency(int frequency){
-        int totalPresets = mPresetList.size();
-        for (int presetNum = 0; presetNum < totalPresets; presetNum++ ) {
-            PresetStation station = mPresetList.get(presetNum);
-            if (station != null) {
-                if(frequency == station.getFrequency()) {
-                    return station;
-                }
-            }
-        }
-        return null;
-    }
-
-    public synchronized PresetStation addStation(String name, int freq){
-        PresetStation addStation = new PresetStation(name, freq);
-        if(addStation != null) {
-            mPresetList.add(addStation);
-        }
-        return addStation;
-    }
-
-    public synchronized PresetStation addStation(PresetStation station){
-        PresetStation addStation = null;
-        if(station != null) {
-            addStation = new PresetStation (station);
-            mPresetList.add(addStation);
-        }
-        return addStation;
-    }
-
-    public synchronized void removeStation(int index){
-       int totalPresets = mPresetList.size();
-       if((index >= 0) && (index < totalPresets))
-       {
-          mPresetList.remove(index);
-       }
-    }
-
-    public synchronized void removeStation(PresetStation station){
-       int index = mPresetList.indexOf(station);
-       int totalPresets = mPresetList.size();
-       if((index >= 0) && (index < totalPresets))
-       {
-          mPresetList.remove(index);
-       }
-    }
-    public synchronized void clear(){
-        mPresetList.clear();
-    }
-
-    /* If a user selects a new station in this list, this routine will be called to
-     * to update the list.
-     */
-    public synchronized boolean setSelectedStation(PresetStation selectStation){
-        int totalPresets = mPresetList.size();
-        if (selectStation != null) {
-            for (int presetNum = 0; presetNum < totalPresets; presetNum++ ) {
-                PresetStation station = mPresetList.get(presetNum);
-                if (station != null) {
-                    if(selectStation.getFrequency() == station.getFrequency()) {
-                        if(selectStation.getName().equalsIgnoreCase(station.getName())) {
-                            mCurrentStation = presetNum;
-                            return true;
-                        }
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /* Check if the same station already exists in a List
-     * to update the list.
-     */
-    public synchronized boolean sameStationExists(PresetStation compareStation){
-        int totalPresets = mPresetList.size();
-        if (compareStation != null) {
-            for (int presetNum = 0; presetNum < totalPresets; presetNum++ ) {
-                PresetStation station = mPresetList.get(presetNum);
-                if (station != null) {
-                    if(compareStation.getFrequency() == station.getFrequency()) {
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /* If a user selects a new station in this list, this routine will be called to
-     * to update the list.
-     */
-    public synchronized boolean setSelectedStation(int stationIndex){
-        boolean foundStation = false;
-        int totalPresets = mPresetList.size();
-        if (stationIndex < totalPresets) {
-            mCurrentStation = stationIndex;
-            foundStation = true;
-        }
-        return foundStation;
-    }
-
-    public synchronized PresetStation getSelectedStation(){
-        int totalPresets = mPresetList.size();
-        PresetStation station = null;
-        if (mCurrentStation < totalPresets) {
-            station = mPresetList.get(mCurrentStation);
-        }
-        return station;
-    }
-
-    public synchronized PresetStation selectNextStation(){
-        int totalPresets = mPresetList.size();
-        PresetStation station = null;
-        if(totalPresets > 0) {
-            mCurrentStation ++;
-            if ( (mCurrentStation) >= totalPresets) {
-                mCurrentStation =0;
-            }
-            station = mPresetList.get(mCurrentStation);
-        }
-        return station;
-    }
-
-    public synchronized PresetStation selectPrevStation(){
-        int totalPresets = mPresetList.size();
-        PresetStation station = null;
-        if(totalPresets > 0) {
-            mCurrentStation --;
-            if ( mCurrentStation < 0) {
-                mCurrentStation = totalPresets-1;
-            }
-            station = mPresetList.get(mCurrentStation);
-        }
-        return station;
-    }
-
-    public synchronized void selectStation(PresetStation selectStation){
-        int totalPresets = mPresetList.size();
-        if (selectStation != null) {
-            for (int presetNum = 0; presetNum < totalPresets; presetNum++ ) {
-                PresetStation station = mPresetList.get(presetNum);
-                if (station != null) {
-                    if(selectStation.getFrequency() == station.getFrequency()) {
-                        mCurrentStation    = presetNum;
-                        return;
-                    }
-                }
-            }
-        }
-    }
-
-    /* Test Code */
-    public void addDummyStations() {
-        PresetStation station;
-        int freq;
-        String name ;
-        int pty ;
-
-        mPresetList.clear();
-        freq = 89500;
-        name = "KPBS";
-        pty = 22; //public
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(false);
-        }
-
-        freq = 96500;
-        name = "KYXY";
-        //pty = "Soft Rock";
-        pty = 8;
-
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(false);
-        }
-
-        freq = 98100;
-        name = "KIFM";
-        //pty = "Smooth Jazz";
-        pty = 14;
-
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(false);
-        }
-
-        freq = 101500;
-        name = "KGB";
-        //pty = "Classic Rock";
-        pty = 6;
-
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(false);
-        }
-
-        freq = 102100;
-        name = "KPRI";
-        //pty = "Rock";
-        pty = 5;
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(true);
-        }
-
-        freq = 105300;
-        name = "KIOZ";
-        //pty = "Rock";
-        pty = 5;
-        station = addStation(name, freq);
-        if(station != null) {
-            station.setPty(pty);
-            station.setPI(0);
-            station.setRDSSupported(true);
-        }
-    }
-
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/PresetStation.java b/fmapp/src/com/codeaurora/fmradio/PresetStation.java
deleted file mode 100644
index 01a3ba0..0000000
--- a/fmapp/src/com/codeaurora/fmradio/PresetStation.java
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import qcom.fmradio.FmReceiver;
-
-import android.text.TextUtils;
-//import android.util.Log;
-
-public class PresetStation
-{
-   private String mName = "";
-   private int mFrequency = 102100;
-   private int mPty = 0;
-   private int mPI = 0;
-   private String mPtyStr = "";
-   private String mPIStr = "";
-   private boolean  mRDSSupported = false;
-
-   public PresetStation(String name, int frequency) {
-           mName = name;
-      /*
-       *  setFrequency set the name to
-       *  "Frequency" String if Name is empty
-       */
-      setFrequency(frequency);
-   }
-
-   public PresetStation(PresetStation station) {
-      Copy(station);
-      /*
-       *  setFrequency set the name to
-       *  "Frequency" String if Name is empty
-       */
-      setFrequency(station.getFrequency());
-   }
-
-   public void Copy(PresetStation station) {
-      /* Let copy just do a copy
-       * without any manipulation
-       */
-      mName = station.getName();
-      mFrequency = station.getFrequency();
-      mPI = station.getPI();
-      mPty = station.getPty();
-      mRDSSupported = station.getRDSSupported();
-
-      mPtyStr = station.getPtyString();
-      mPIStr = station.getPIString();
-   }
-
-   public boolean equals(PresetStation station) {
-      boolean equal = false;
-      if (mFrequency == station.getFrequency())
-      {
-         if (mPty == (station.getPty()))
-         {
-            if (mPI == (station.getPI()))
-            {
-               if (mRDSSupported == (station.getRDSSupported()))
-               {
-                  equal = true;
-               }
-            }
-         }
-      }
-      return equal;
-   }
-
-   public void setName(String name){
-      if (!TextUtils.isEmpty(name))
-      {
-         mName = name;
-      } else
-      {
-         mName = ""+mFrequency/1000.0;
-      }
-   }
-
-   public void setFrequency(int freq){
-      mFrequency = freq;
-      /* If no name set it to the frequency */
-      if (TextUtils.isEmpty(mName))
-      {
-         mName = ""+mFrequency/1000.0;
-      }
-      return;
-   }
-
-   public void setPty(int pty){
-      mPty = pty;
-      mPtyStr = PresetStation.parsePTY(mPty);
-   }
-
-   public void setPI(int pi){
-      mPI = pi;
-      mPIStr = PresetStation.parsePI(mPI);
-   }
-
-   public void setRDSSupported(boolean rds){
-      mRDSSupported = rds;
-   }
-
-   public String getName(){
-      return mName;
-   }
-
-   public int getFrequency(){
-      return mFrequency;
-   }
-
-   /**
-    * Routine to get the Frequency in String from an integer
-    *
-    * @param frequency : Frequency to be converted (ex: 96500)
-    *
-    * @return String : Frequency in String form (ex: 96.5)
-    */
-   public static String getFrequencyString(int frequency) {
-          double frequencyDbl = frequency / 1000.0;
-      String frequencyString =""+frequencyDbl;
-      return frequencyString;
-   }
-
-   public int getPty(){
-      return mPty;
-   }
-
-   public String getPtyString(){
-      return mPtyStr;
-   }
-
-   public int getPI(){
-      return mPI;
-   }
-
-   public String getPIString(){
-      return mPIStr;
-   }
-
-   public boolean getRDSSupported(){
-      return mRDSSupported;
-   }
-
-   /** Routine parses the PI Code from Integer to Call Sign String
-    *  Example: 0x54A6 -> KZZY
-    */
-   public static String parsePI(int piCode)
-   {
-      String callSign = "";
-      if ( (piCode >> 8) == 0xAF)
-      {//CALL LETTERS THAT MAP TO PI CODES = _ _ 0 0.
-         piCode = ((piCode & 0xFF) << 8);
-      }
-      /* Run the second exception
-         NOTE: For 9 special cases 1000,2000,..,9000 a double mapping
-         occurs utilizing exceptions 1 and 2:
-         1000->A100->AFA1;2000->A200->AFA2; ... ;
-         8000->A800->AFA8;9000->A900->AFA9
-      */
-      if ( (piCode >> 12) == 0xA)
-      {//CALL LETTERS THAT MAP TO PI CODES = _ 0 _ _.
-         piCode = ((piCode & 0xF00) << 4) + (piCode & 0xFF);
-      }
-      if ( (piCode >= 0x1000) && (piCode <= 0x994E))
-      {
-         String ShartChar;
-         /* KAAA - KZZZ */
-         if ( (piCode >= 0x1000) && (piCode <= 0x54A7))
-         {
-            piCode -= 0x1000;
-            ShartChar = "K";
-         } else
-         { /* WAAA - WZZZ*/
-            piCode -= 0x54A8;
-            ShartChar = "W";
-         }
-         int CharDiv = piCode / 26;
-         int CharPos = piCode - (CharDiv * 26);
-         char c3 = (char)('A'+CharPos);
-
-         piCode = CharDiv;
-         CharDiv = piCode / 26;
-         CharPos = piCode - (CharDiv * 26);
-         char c2 = (char)('A'+CharPos);
-
-         piCode = CharDiv;
-         CharDiv = piCode / 26;
-         CharPos = piCode - (CharDiv * 26);
-         char c1 = (char)('A'+CharPos);
-         callSign = ShartChar + c1+ c2+ c3;
-      } else if ( (piCode >= 0x9950) && (piCode <= 0x9EFF))
-      {//3-LETTER-ONLY CALL LETTERS
-         callSign = get3LetterCallSign(piCode);
-      } else
-      {//NATIONALLY-LINKED RADIO STATIONS CARRYING DIFFERENT CALL LETTERS
-         callSign = getOtherCallSign(piCode);
-      }
-      return callSign;
-   }
-
-   private static String getOtherCallSign(int piCode)
-   {
-      String callSign = "";
-      if ( (piCode >= 0xB001) && (piCode <= 0xBF01))
-      {
-         callSign = "NPR";
-      } else if ( (piCode >= 0xB002) && (piCode <= 0xBF02))
-      {
-         callSign = "CBC English";
-      } else if ( (piCode >= 0xB003) && (piCode <= 0xBF03))
-      {
-         callSign = "CBC French";
-      }
-      return callSign;
-   }
-
-   private static String get3LetterCallSign(int piCode)
-   {
-      String callSign = "";
-      switch (piCode)
-      {
-      case 0x99A5:
-         {
-            callSign = "KBW";
-            break;
-         }
-      case 0x9992:
-         {
-            callSign = "KOY";
-            break;
-         }
-      case 0x9978:
-         {
-            callSign = "WHO";
-            break;
-         }
-      case 0x99A6:
-         {
-            callSign = "KCY";
-            break;
-         }
-      case 0x9993:
-         {
-            callSign = "KPQ";
-            break;
-         }
-      case 0x999C:
-         {
-            callSign = "WHP";
-            break;
-         }
-      case 0x9990:
-         {
-            callSign = "KDB";
-            break;
-         }
-      case 0x9964:
-         {
-            callSign = "KQV";
-            break;
-         }
-      case 0x999D:
-         {
-            callSign = "WIL";
-            break;
-         }
-      case 0x99A7:
-         {
-            callSign = "KDF";
-            break;
-         }
-      case 0x9994:
-         {
-            callSign = "KSD";
-            break;
-         }
-      case 0x997A:
-         {
-            callSign = "WIP";
-            break;
-         }
-      case 0x9950:
-         {
-            callSign = "KEX";
-            break;
-         }
-      case 0x9965:
-         {
-            callSign = "KSL";
-            break;
-         }
-      case 0x99B3:
-         {
-            callSign = "WIS";
-            break;
-         }
-      case 0x9951:
-         {
-            callSign = "KFH";
-            break;
-         }
-      case 0x9966:
-         {
-            callSign = "KUJ";
-            break;
-         }
-      case 0x997B:
-         {
-            callSign = "WJR";
-            break;
-         }
-      case 0x9952:
-         {
-            callSign = "KFI";
-            break;
-         }
-      case 0x9995:
-         {
-            callSign = "KUT";
-            break;
-         }
-      case 0x99B4:
-         {
-            callSign = "WJW";
-            break;
-         }
-      case 0x9953:
-         {
-            callSign = "KGA";
-            break;
-         }
-      case 0x9967:
-         {
-            callSign = "KVI";
-            break;
-         }
-      case 0x99B5:
-         {
-            callSign = "WJZ";
-            break;
-         }
-      case 0x9991:
-         {
-            callSign = "KGB";
-            break;
-         }
-      case 0x9968:
-         {
-            callSign = "KWG";
-            break;
-         }
-      case 0x997C:
-         {
-            callSign = "WKY";
-            break;
-         }
-      case 0x9954:
-         {
-            callSign = "KGO";
-            break;
-         }
-      case 0x9996:
-         {
-            callSign = "KXL";
-            break;
-         }
-      case 0x997D:
-         {
-            callSign = "WLS";
-            break;
-         }
-      case 0x9955:
-         {
-            callSign = "KGU";
-            break;
-         }
-      case 0x9997:
-         {
-            callSign = "KXO";
-            break;
-         }
-      case 0x997E:
-         {
-            callSign = "WLW";
-            break;
-         }
-      case 0x9956:
-         {
-            callSign = "KGW";
-            break;
-         }
-      case 0x996B:
-         {
-            callSign = "KYW";
-            break;
-         }
-      case 0x999E:
-         {
-            callSign = "WMC";
-            break;
-         }
-      case 0x9957:
-         {
-            callSign = "KGY";
-            break;
-         }
-      case 0x9999:
-         {
-            callSign = "WBT";
-            break;
-         }
-      case 0x999F:
-         {
-            callSign = "WMT";
-            break;
-         }
-      case 0x99AA:
-         {
-            callSign = "KHQ";
-            break;
-         }
-      case 0x996D:
-         {
-            callSign = "WBZ";
-            break;
-         }
-      case 0x9981:
-         {
-            callSign = "WOC";
-            break;
-         }
-      case 0x9958:
-         {
-            callSign = "KID";
-            break;
-         }
-      case 0x996E:
-         {
-            callSign = "WDZ";
-            break;
-         }
-      case 0x99A0:
-         {
-            callSign = "WOI";
-            break;
-         }
-      case 0x9959:
-         {
-            callSign = "KIT";
-            break;
-         }
-      case 0x996F:
-         {
-            callSign = "WEW";
-            break;
-         }
-      case 0x9983:
-         {
-            callSign = "WOL";
-            break;
-         }
-      case 0x995A:
-         {
-            callSign = "KJR";
-            break;
-         }
-      case 0x999A:
-         {
-            callSign = "WGH";
-            break;
-         }
-      case 0x9984:
-         {
-            callSign = "WOR";
-            break;
-         }
-      case 0x995B:
-         {
-            callSign = "KLO";
-            break;
-         }
-      case 0x9971:
-         {
-            callSign = "WGL";
-            break;
-         }
-      case 0x99A1:
-         {
-            callSign = "WOW";
-            break;
-         }
-      case 0x995C:
-         {
-            callSign = "KLZ";
-            break;
-         }
-      case 0x9972:
-         {
-            callSign = "WGN";
-            break;
-         }
-      case 0x99B9:
-         {
-            callSign = "WRC";
-            break;
-         }
-      case 0x995D:
-         {
-            callSign = "KMA";
-            break;
-         }
-      case 0x9973:
-         {
-            callSign = "WGR";
-            break;
-         }
-      case 0x99A2:
-         {
-            callSign = "WRR";
-            break;
-         }
-      case 0x995E:
-         {
-            callSign = "KMJ";
-            break;
-         }
-      case 0x999B:
-         {
-            callSign = "WGY";
-            break;
-         }
-      case 0x99A3:
-         {
-            callSign = "WSB";
-            break;
-         }
-      case 0x995F:
-         {
-            callSign = "KNX";
-            break;
-         }
-      case 0x9975:
-         {
-            callSign = "WHA";
-            break;
-         }
-      case 0x99A4:
-         {
-            callSign = "WSM";
-            break;
-         }
-      case 0x9960:
-         {
-            callSign = "KOA";
-            break;
-         }
-      case 0x9976:
-         {
-            callSign = "WHB";
-            break;
-         }
-      case 0x9988:
-         {
-            callSign = "WWJ";
-            break;
-         }
-      case 0x99AB:
-         {
-            callSign = "KOB";
-            break;
-         }
-      case 0x9977:
-         {
-            callSign = "WHK";
-            break;
-         }
-      case 0x9989:
-         {
-            callSign = "WWL";
-            break;
-         }
-      }
-      return callSign;
-   }
-
-   /**
-    *  Get the Text String for the Program type Code
-    */
-   public static String parsePTY(int pty)
-   {
-      String ptyStr="";
-      int rdsStd = FmSharedPreferences.getFMConfiguration().getRdsStd();
-      if(rdsStd ==  FmReceiver.FM_RDS_STD_RBDS)
-      {
-         ptyStr = getRBDSPtyString(pty);
-      }
-      else if(rdsStd ==  FmReceiver.FM_RDS_STD_RDS)
-      {
-         ptyStr = getRDSPtyString(pty);
-      }
-      return (ptyStr);
-   }
-
-   /**
-    *  get the Text String for the RBDS Program type Code
-    */
-   public static String getRBDSPtyString(int pty)
-   {
-      String ptyStr = "";
-      switch (pty)
-      {
-         case 1:
-         {
-            ptyStr = "News";
-            break;
-         }
-         case 2:
-         {
-            ptyStr = "Information";
-            break;
-         }
-         case 3:
-         {
-            ptyStr = "Sports";
-            break;
-         }
-         case 4:
-         {
-            ptyStr = "Talk";
-            break;
-         }
-         case 5:
-         {
-            ptyStr = "Rock";
-            break;
-         }
-         case 6:
-         {
-            ptyStr = "Classic Rock";
-            break;
-         }
-         case 7:
-         {
-            ptyStr = "Adult Hits";
-            break;
-         }
-         case 8:
-         {
-            ptyStr = "Soft Rock";
-            break;
-         }
-         case 9:
-         {
-            ptyStr = "Top 40";
-            break;
-         }
-         case 10:
-         {
-            ptyStr = "Country";
-            break;
-         }
-         case 11:
-         {
-            ptyStr = "Oldies";
-            break;
-         }
-         case 12:
-         {
-            ptyStr = "Soft";
-            break;
-         }
-         case 13:
-         {
-            ptyStr = "Nostalgia";
-            break;
-         }
-         case 14:
-         {
-            ptyStr = "Jazz";
-            break;
-         }
-         case 15:
-         {
-            ptyStr = "Classical";
-            break;
-         }
-         case 16:
-         {
-            ptyStr = "Rhythm and Blues";
-            break;
-         }
-         case 17:
-         {
-            ptyStr = "Soft Rhythm and Blues";
-            break;
-         }
-         case 18:
-         {
-            ptyStr = "Foreign Language";
-            break;
-         }
-         case 19:
-         {
-            ptyStr = "Religious Music";
-            break;
-         }
-         case 20:
-         {
-            ptyStr = "Religious Talk";
-            break;
-         }
-         case 21:
-         {
-            ptyStr = "Personality";
-            break;
-         }
-         case 22:
-         {
-            ptyStr = "Public";
-            break;
-         }
-         case 23:
-         {
-            ptyStr = "College";
-            break;
-         }
-         case 29:
-         {
-            ptyStr = "Weather";
-            break;
-         }
-         case 30:
-         {
-            ptyStr = "Emergency Test";
-            break;
-         }
-         case 31:
-         {
-            ptyStr = "Emergency";
-            break;
-         }
-         default:
-         {
-            ptyStr = "";
-            //Log.e(FMRadio.LOGTAG, "Unknown RBDS ProgramType [" + pty + "]");
-            break;
-         }
-      }
-      return ptyStr;
-   }
-
-   /** get the Text String for the Program type Code */
-   public static String getRDSPtyString(int pty)
-   {
-      String ptyStr = "";
-      switch (pty)
-      {
-         case 1:
-         {
-            ptyStr = "News";
-            break;
-         }
-         case 2:
-         {
-            ptyStr = "Current Affairs";
-            break;
-         }
-         case 3:
-         {
-            ptyStr = "Information";
-            break;
-         }
-         case 4:
-         {
-            ptyStr = "Sport";
-            break;
-         }
-         case 5:
-         {
-            ptyStr = "Education";
-            break;
-         }
-         case 6:
-         {
-            ptyStr = "Drama";
-            break;
-         }
-         case 7:
-         {
-            ptyStr = "Culture";
-            break;
-         }
-         case 8:
-         {
-            ptyStr = "Science";
-            break;
-         }
-         case 9:
-         {
-            ptyStr = "Varied";
-            break;
-         }
-         case 10:
-         {
-            ptyStr = "Pop Music";
-            break;
-         }
-         case 11:
-         {
-            ptyStr = "Rock Music";
-            break;
-         }
-         case 12:
-         {
-            ptyStr = "Easy Listening Music";
-            break;
-         }
-         case 13:
-         {
-            ptyStr = "Light classical";
-            break;
-         }
-         case 14:
-         {
-            ptyStr = "Serious classical";
-            break;
-         }
-         case 15:
-         {
-            ptyStr = "Other Music";
-            break;
-         }
-         case 16:
-         {
-            ptyStr = "Weather";
-            break;
-         }
-         case 17:
-         {
-            ptyStr = "Finance";
-            break;
-         }
-         case 18:
-         {
-            ptyStr = "Children programs";
-            break;
-         }
-         case 19:
-         {
-            ptyStr = "Social Affairs";
-            break;
-         }
-         case 20:
-         {
-            ptyStr = "Religion";
-            break;
-         }
-         case 21:
-         {
-            ptyStr = "Phone In";
-            break;
-         }
-         case 22:
-         {
-            ptyStr = "Travel";
-            break;
-         }
-         case 23:
-         {
-            ptyStr = "Leisure";
-            break;
-         }
-         case 24:
-         {
-            ptyStr = "Jazz Music";
-            break;
-         }
-         case 25:
-         {
-            ptyStr = "Country Music";
-            break;
-         }
-         case 26:
-         {
-            ptyStr = "National Music";
-            break;
-         }
-         case 27:
-         {
-            ptyStr = "Oldies Music";
-            break;
-         }
-         case 28:
-         {
-            ptyStr = "Folk Music";
-            break;
-         }
-         case 29:
-         {
-            ptyStr = "Documentary";
-            break;
-         }
-         case 30:
-         {
-            ptyStr = "Emergency Test";
-            break;
-         }
-         case 31:
-         {
-            ptyStr = "Emergency";
-            break;
-         }
-         default:
-         {
-            ptyStr = "";
-            //Log.e(FMRadio.LOGTAG, "Unknown RDS ProgramType [" + pty + "]");
-            break;
-         }
-      }
-      return ptyStr;
-   }
-
-
-}
diff --git a/fmapp/src/com/codeaurora/fmradio/Settings.java b/fmapp/src/com/codeaurora/fmradio/Settings.java
deleted file mode 100644
index f29c3df..0000000
--- a/fmapp/src/com/codeaurora/fmradio/Settings.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.fmradio;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
-import android.preference.ListPreference;
-import android.preference.CheckBoxPreference;
-import android.preference.PreferenceCategory;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.EditTextPreference;
-import android.text.InputType;
-import android.widget.Toast;
-
-import android.util.Log;
-
-public class Settings extends PreferenceActivity implements
-                OnSharedPreferenceChangeListener, OnPreferenceClickListener {
-        public static final String RX_MODE = "rx_mode";
-
-
-        public static final String REGIONAL_BAND_KEY = "regional_band";
-        public static final String AUDIO_OUTPUT_KEY = "audio_output_mode";
-        public static final String RECORD_DURATION_KEY = "record_duration";
-        public static final String AUTO_AF = "af_checkbox_preference";
-        public static final String RESTORE_FACTORY_DEFAULT = "revert_to_fac";
-        public static final int RESTORE_FACTORY_DEFAULT_INT = 1;
-        public static final String USER_DEFINED_BAND_MIN_KEY = "user_defined_band_min";
-        public static final String USER_DEFINED_BAND_MAX_KEY = "user_defined_band_max";
-        public static final String CHAN_SPACING_KEY = "chanl_spacing";
-        public static final String RESTORE_FACTORY_DEFAULT_ACTION = "com.codeaurora.fmradio.settings.revert_to_defaults";
-
-        private static final String LOGTAG = FMRadio.LOGTAG;
-        private static final String USR_BAND_MSG = "Enter Freq from range 76.0 - 108.0";
-
-        private ListPreference mBandPreference;
-        private ListPreference mAudioPreference;
-        private ListPreference mRecordDurPreference;
-        private CheckBoxPreference mAfPref;
-        private EditTextPreference mUserBandMinPref;
-        private EditTextPreference mUserBandMaxPref;
-        private ListPreference mChannelSpacingPref;
-        private Preference mRestoreDefaultPreference;
-
-        private FmSharedPreferences mPrefs = null;
-        private boolean mRxMode = false;
-
-        private int min_freq;
-        private int max_freq;
-        private int chan_spacing;
-        private String[] summaryBandItems;
-        private String[] chSpacingItems;
-        private String[] summaryAudioModeItems;
-        private String[] summaryRecordItems;
-
-        @Override
-        protected void onCreate(Bundle savedInstanceState) {
-           super.onCreate(savedInstanceState);
-           Intent intent = getIntent();
-           if (intent != null) {
-               mRxMode = intent.getBooleanExtra(RX_MODE, false);
-           }
-           mPrefs = new FmSharedPreferences(this);
-           if (mPrefs != null) {
-               setPreferenceScreen(createPreferenceHierarchy());
-           }
-        }
-        private PreferenceScreen createPreferenceHierarchy() {
-           int index = 0;
-           if (mPrefs == null) {
-               return null;
-           }
-                // Root
-           PreferenceScreen root = getPreferenceManager().createPreferenceScreen(
-                                this);
-
-           summaryBandItems = getResources().getStringArray(
-                                R.array.regional_band_summary);
-           chSpacingItems = getResources().getStringArray(
-                                R.array.channel_spacing_entries);
-           mBandPreference = new ListPreference(this);
-           mBandPreference.setEntries(R.array.regional_band_entries);
-           mBandPreference.setEntryValues(R.array.regional_band_values);
-           mBandPreference.setDialogTitle(R.string.sel_band_menu);
-           mBandPreference.setKey(REGIONAL_BAND_KEY);
-           mBandPreference.setTitle(R.string.regional_band);
-           index = FmSharedPreferences.getCountry();
-           Log.d(LOGTAG, "createPreferenceHierarchy: Country: " + index);
-           // Get the preference and list the value.
-           if ((index < 0) || (index >= summaryBandItems.length)) {
-                index = 0;
-           }
-           mBandPreference.setValueIndex(index);
-           root.addPreference(mBandPreference);
-
-           mChannelSpacingPref = new ListPreference(this);
-           mChannelSpacingPref.setEntries(R.array.channel_spacing_entries);
-           mChannelSpacingPref.setEntryValues(R.array.channel_spacing_val);
-           mChannelSpacingPref.setDialogTitle(R.string.sel_chanl_spacing);
-           mChannelSpacingPref.setTitle(R.string.chanl_spacing);
-           mChannelSpacingPref.setKey(CHAN_SPACING_KEY);
-
-           mUserBandMinPref = new EditTextPreference(this);
-           mUserBandMinPref.setKey(USER_DEFINED_BAND_MIN_KEY);
-           mUserBandMinPref.setTitle(R.string.usr_def_band_min);
-           mUserBandMinPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER |
-                                                        InputType.TYPE_NUMBER_FLAG_DECIMAL);
-           mUserBandMinPref.setDialogTitle(R.string.usr_def_band_min);
-
-           mUserBandMaxPref = new EditTextPreference(this);
-           mUserBandMaxPref.setKey(USER_DEFINED_BAND_MAX_KEY);
-           mUserBandMaxPref.setTitle(R.string.usr_def_band_max);
-           mUserBandMaxPref.setDialogTitle(R.string.usr_def_band_max);
-           mUserBandMaxPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER |
-                                                        InputType.TYPE_NUMBER_FLAG_DECIMAL);
-
-           setBandSummary(index);
-
-           root.addPreference(mChannelSpacingPref);
-           root.addPreference(mUserBandMinPref);
-           root.addPreference(mUserBandMaxPref);
-
-           if (mRxMode) {
-               // Audio Output (Stereo or Mono)
-               summaryAudioModeItems = getResources().getStringArray(
-                                        R.array.ster_mon_entries);
-               mAudioPreference = new ListPreference(this);
-               mAudioPreference.setEntries(R.array.ster_mon_entries);
-               mAudioPreference.setEntryValues(R.array.ster_mon_values);
-               mAudioPreference.setDialogTitle(R.string.sel_audio_output);
-               mAudioPreference.setKey(AUDIO_OUTPUT_KEY);
-               mAudioPreference.setTitle(R.string.aud_output_mode);
-               boolean audiomode = FmSharedPreferences.getAudioOutputMode();
-               if (audiomode) {
-                   index = 0;
-               } else {
-                   index = 1;
-               }
-               Log.d(LOGTAG, "createPreferenceHierarchy: audiomode: " + audiomode);
-               mAudioPreference.setSummary(summaryAudioModeItems[index]);
-               mAudioPreference.setValueIndex(index);
-               root.addPreference(mAudioPreference);
-
-               // AF Auto Enable (Checkbox)
-               mAfPref = new CheckBoxPreference(this);
-               mAfPref.setKey(AUTO_AF);
-               mAfPref.setTitle(R.string.auto_select_af);
-               mAfPref.setSummaryOn(R.string.auto_select_af_enabled);
-               mAfPref.setSummaryOff(R.string.auto_select_af_disabled);
-               boolean bAFAutoSwitch = FmSharedPreferences.getAutoAFSwitch();
-               Log.d(LOGTAG, "createPreferenceHierarchy: bAFAutoSwitch: "
-                              + bAFAutoSwitch);
-               mAfPref.setChecked(bAFAutoSwitch);
-               root.addPreference(mAfPref);
-
-
-               if(FMRadio.RECORDING_ENABLE) {
-                  summaryRecordItems = getResources().getStringArray(
-                                        R.array.record_durations_entries);
-                  int nRecordDuration = 0;
-                  mRecordDurPreference = new ListPreference(this);
-                  mRecordDurPreference.setEntries(R.array.record_durations_entries);
-                  mRecordDurPreference.setEntryValues(R.array.record_duration_values);
-                  mRecordDurPreference.setDialogTitle(R.string.sel_rec_dur);
-                  mRecordDurPreference.setKey(RECORD_DURATION_KEY);
-                  mRecordDurPreference.setTitle(R.string.record_dur);
-                  nRecordDuration = FmSharedPreferences.getRecordDuration();
-                  Log.d(LOGTAG, "createPreferenceHierarchy: recordDuration: "
-                        + nRecordDuration);
-                  switch( nRecordDuration ) {
-                  case FmSharedPreferences.RECORD_DUR_INDEX_0_VAL:
-                       index = 0;
-                       break;
-                  case FmSharedPreferences.RECORD_DUR_INDEX_1_VAL:
-                       index = 1;
-                       break;
-                  case FmSharedPreferences.RECORD_DUR_INDEX_2_VAL:
-                       index = 2;
-                       break;
-                  case FmSharedPreferences.RECORD_DUR_INDEX_3_VAL:
-                       index = 3;
-                       break;
-                  }
-                  // Get the preference and list the value.
-                  if ((index < 0) || (index >= summaryRecordItems.length)) {
-                       index = 0;
-                  }
-                  Log.d(LOGTAG, "createPreferenceHierarchy: recordDurationSummary: "
-                              + summaryRecordItems[index]);
-                  mRecordDurPreference.setSummary(summaryRecordItems[index]);
-                  mRecordDurPreference.setValueIndex(index);
-                  root.addPreference(mRecordDurPreference);
-               }
-           }
-
-           // Add a new category
-           PreferenceCategory prefCat = new PreferenceCategory(this);
-           root.addPreference(prefCat);
-
-           mRestoreDefaultPreference = new Preference(this);
-           mRestoreDefaultPreference
-                                .setTitle(R.string.settings_revert_defaults_title);
-           mRestoreDefaultPreference.setKey(RESTORE_FACTORY_DEFAULT);
-           mRestoreDefaultPreference
-                                .setSummary(R.string.settings_revert_defaults_summary);
-           mRestoreDefaultPreference.setOnPreferenceClickListener(this);
-           root.addPreference(mRestoreDefaultPreference);
-           return root;
-        }
-
-        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
-                        String key) {
-           int mTunedFreq = 0;
-           boolean bStatus = false;
-           if (key.equals(REGIONAL_BAND_KEY)) {
-	       int curListIndex = FmSharedPreferences.getCurrentListIndex();
-	       PresetList curList = FmSharedPreferences.getStationList(curListIndex);
-               String valueStr = sharedPreferences.getString(key, "");
-               int index = 0;
-               if (valueStr != null) {
-                   index = mBandPreference.findIndexOfValue(valueStr);
-               }
-               if ((index < 0) || (index >= summaryBandItems.length)) {
-                   index = 0;
-                   mBandPreference.setValueIndex(0);
-               }else if((index + 1) == summaryBandItems.length) {
-                   mChannelSpacingPref.setEnabled(true);
-               }else {
-                   mChannelSpacingPref.setEnabled(false);
-               }
-               Log.d(LOGTAG, "onSharedPreferenceChanged: Country Change: "
-                                  + index);
-               FmSharedPreferences.setCountry(index);
-               setBandSummary(index);
-               bStatus = FMRadio.fmConfigure();
-               FMTransmitterActivity.fmConfigure();
-               if (curList != null) {
-                   curList.clear();
-               }
-           }else if(key.equals(CHAN_SPACING_KEY)) {
-               int curListIndex = FmSharedPreferences.getCurrentListIndex();
-               PresetList curList = FmSharedPreferences.getStationList(curListIndex);
-               String valStr = mChannelSpacingPref.getValue();
-               int index = 0;
-               if(valStr != null) {
-                  index  = mChannelSpacingPref.findIndexOfValue(valStr);
-               }
-               if ((index < 0) || (index >= summaryRecordItems.length)) {
-                   index = 0;
-                   mChannelSpacingPref.setValueIndex(0);
-               }
-               mChannelSpacingPref.setSummary(chSpacingItems[index]);
-               FmSharedPreferences.setChSpacing(2 - index);
-               FMRadio.fmConfigure();
-               FMTransmitterActivity.fmConfigure();
-               if(curList != null) {
-                  curList.clear();
-               }
-           }else if(key.equals(USER_DEFINED_BAND_MIN_KEY)) {
-               String valStr = mUserBandMinPref.getText();
-               double freq = 0;
-               try {
-                    freq = Double.parseDouble(valStr) * 1000;
-               }catch(NumberFormatException e) {
-                    e.printStackTrace();
-                    return;
-               }
-               max_freq = FmSharedPreferences.getUpperLimit();
-               min_freq = FmSharedPreferences.getLowerLimit();
-               if((freq > 0) && (freq < max_freq) && (freq >= 76000)) {
-                  FmSharedPreferences.setLowerLimit((int)freq);
-                  FMRadio.fmConfigure();
-                  FMTransmitterActivity.fmConfigure();
-                  setBandSummary(summaryBandItems.length - 1);
-               }else {
-                  displayToast(USR_BAND_MSG);
-               }
-           }else if(key.equals(USER_DEFINED_BAND_MAX_KEY)) {
-               String valStr = mUserBandMaxPref.getText();
-               double freq = 0;
-               try {
-                    freq = Double.parseDouble(valStr) * 1000;
-               }catch(NumberFormatException e) {
-                    e.printStackTrace();
-                    return;
-               }
-               min_freq = FmSharedPreferences.getLowerLimit();
-               max_freq = FmSharedPreferences.getUpperLimit();
-               if((freq > 0) && (freq > min_freq) && (freq <= 108000)) {
-                  FmSharedPreferences.setUpperLimit((int)freq);
-                  FMRadio.fmConfigure();
-                  FMTransmitterActivity.fmConfigure();
-                  setBandSummary(summaryBandItems.length - 1);
-               }else {
-                  displayToast(USR_BAND_MSG);
-               }
-           }else {
-               if (mRxMode) {
-                   if (key.equals(AUTO_AF)) {
-                       boolean bAFAutoSwitch = mAfPref.isChecked();
-                       Log.d(LOGTAG, "onSharedPreferenceChanged: Auto AF Enable: "
-                                     + bAFAutoSwitch);
-                       FmSharedPreferences.setAutoAFSwitch(bAFAutoSwitch);
-                       FMRadio.fmAutoAFSwitch();
-                       mPrefs.Save();
-                   } else if (key.equals(RECORD_DURATION_KEY)) {
-                       if(FMRadio.RECORDING_ENABLE) {
-                          String valueStr = mRecordDurPreference.getValue();
-                          int index = 0;
-                          if (valueStr != null) {
-                              index = mRecordDurPreference.findIndexOfValue(valueStr);
-                          }
-                          if ((index < 0) || (index >= summaryRecordItems.length)) {
-                               index = 0;
-                               mRecordDurPreference.setValueIndex(index);
-                          }
-                          Log.d(LOGTAG, "onSharedPreferenceChanged: recorddur: "
-                                     + summaryRecordItems[index]);
-                          mRecordDurPreference.setSummary(summaryRecordItems[index]);
-                          FmSharedPreferences.setRecordDuration(index);
-                       }
-                   } else if (key.equals(AUDIO_OUTPUT_KEY)) {
-                       String valueStr = mAudioPreference.getValue();
-                       int index = 0;
-                       if (valueStr != null) {
-                           index = mAudioPreference.findIndexOfValue(valueStr);
-                       }
-                       if (index != 1) {
-                          if (index != 0) {
-                              index = 0;
-                              /* It shud be 0(Stereo) or 1(Mono) */
-                              mAudioPreference.setValueIndex(index);
-                          }
-                       }
-                       Log.d(LOGTAG, "onSharedPreferenceChanged: audiomode: "
-                                      + summaryAudioModeItems[index]);
-                       mAudioPreference.setSummary(summaryAudioModeItems[index]);
-                       if (index == 0) {
-                           // Stereo
-                           FmSharedPreferences.setAudioOutputMode(true);
-                       } else {
-                           // Mono
-                           FmSharedPreferences.setAudioOutputMode(false);
-                       }
-                       FMRadio.fmAudioOutputMode();
-                   }
-               }
-           }
-           if (mPrefs != null) {
-               if(bStatus) {
-                  mPrefs.Save();
-               }else {
-                  mTunedFreq = FmSharedPreferences.getTunedFrequency();
-                  if ((mTunedFreq > FmSharedPreferences.getUpperLimit())
-                      || mTunedFreq < FmSharedPreferences.getLowerLimit()) {
-
-                      FmSharedPreferences.setTunedFrequency(FmSharedPreferences.getLowerLimit());
-                  }
-                  mPrefs.Save();
-               }
-           }
-        }
-
-        public boolean onPreferenceClick(Preference preference) {
-           boolean handled = false;
-           if (preference == mRestoreDefaultPreference) {
-               showDialog(RESTORE_FACTORY_DEFAULT_INT);
-           }
-           return handled;
-        }
-
-        @Override
-        protected Dialog onCreateDialog(int id) {
-           switch (id) {
-           case RESTORE_FACTORY_DEFAULT_INT:
-                return new AlertDialog.Builder(this).setIcon(
-                       R.drawable.alert_dialog_icon).setTitle(
-                       R.string.settings_revert_confirm_title).setMessage(
-                       R.string.settings_revert_confirm_msg).setPositiveButton(
-                       R.string.alert_dialog_ok,
-                       new DialogInterface.OnClickListener() {
-                           public void onClick(DialogInterface dialog,
-                                                 int whichButton) {
-                              Intent data = new Intent(
-                                                 RESTORE_FACTORY_DEFAULT_ACTION);
-                              setResult(RESULT_OK, data);
-                              restoreSettingsDefault();
-                              finish();
-                           }
-
-                        }).setNegativeButton(R.string.alert_dialog_cancel,
-                                new DialogInterface.OnClickListener() {
-                                     public void onClick(DialogInterface dialog,
-                                                          int whichButton) {
-                                     }
-                                }).create();
-           default:
-                break;
-           }
-           return null;
-        }
-
-        private void restoreSettingsDefault() {
-           if (mPrefs != null) {
-               mBandPreference.setValueIndex(0);
-               if (mRxMode) {
-                   mAudioPreference.setValueIndex(0);
-                   if(FMRadio.RECORDING_ENABLE) {
-                      mRecordDurPreference.setValueIndex(0);
-                   }
-                   mAfPref.setChecked(false);
-                   FmSharedPreferences.SetDefaults();
-               } else {
-                   FmSharedPreferences.setCountry(FmSharedPreferences.REGIONAL_BAND_NORTH_AMERICA);
-               }
-               mPrefs.Save();
-           }
-        }
-
-        @Override
-        protected void onResume() {
-           super.onResume();
-           PreferenceScreen preferenceScreen = getPreferenceScreen();
-           SharedPreferences sharedPreferences = null;
-           if (preferenceScreen != null) {
-               sharedPreferences = preferenceScreen.getSharedPreferences();
-           }
-           if (sharedPreferences != null) {
-               sharedPreferences.registerOnSharedPreferenceChangeListener(this);
-           }
-        }
-
-        @Override
-        protected void onPause() {
-           super.onPause();
-           PreferenceScreen preferenceScreen = getPreferenceScreen();
-           SharedPreferences sharedPreferences = null;
-           if (preferenceScreen != null) {
-                sharedPreferences = preferenceScreen.getSharedPreferences();
-           }
-           if (sharedPreferences != null) {
-                sharedPreferences.unregisterOnSharedPreferenceChangeListener(this);
-           }
-        }
-        private void setBandSummary(int index) {
-           if((index + 1) == summaryBandItems.length) {
-              min_freq = FmSharedPreferences.getLowerLimit();
-              max_freq = FmSharedPreferences.getUpperLimit();
-              chan_spacing = FmSharedPreferences.getChSpacing();
-              if(chan_spacing < 0) {
-                 chan_spacing = 0;
-              }
-              mBandPreference.setSummary(summaryBandItems[index] + "( "
-                       + (min_freq / 1000.0) +"Mhz To " + (max_freq / 1000.0) +
-                       "Mhz)");
-              mChannelSpacingPref.setValueIndex(2 - chan_spacing);
-              mChannelSpacingPref.setSummary(chSpacingItems[2 - chan_spacing]);
-              mChannelSpacingPref.setEnabled(true);
-              mUserBandMinPref.setEnabled(true);
-              mUserBandMaxPref.setEnabled(true);
-              mUserBandMinPref.setSummary((min_freq / 1000.0) + "Mhz");
-              mUserBandMaxPref.setSummary((max_freq / 1000.0) + "Mhz");
-           }else {
-              mBandPreference.setSummary(summaryBandItems[index]);
-              mChannelSpacingPref.setEnabled(false);
-              mUserBandMinPref.setEnabled(false);
-              mUserBandMaxPref.setEnabled(false);
-           }
-        }
-
-        private void displayToast(String msg) {
-           Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
-        }
-}
diff --git a/fmapp/src/com/codeaurora/hc_utils/A2dpDeviceStatus.java b/fmapp/src/com/codeaurora/hc_utils/A2dpDeviceStatus.java
deleted file mode 100644
index 46bcecd..0000000
--- a/fmapp/src/com/codeaurora/hc_utils/A2dpDeviceStatus.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.utils;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
-import android.content.Intent;
-import android.content.Context;
-
-public class A2dpDeviceStatus {
-    private BluetoothAdapter mAdapter;
-    private BluetoothA2dp mA2dp = null;
-    public String getActionSinkStateChangedString (){
-        return BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED;
-    }
-    public String getActionPlayStateChangedString (){
-        return BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED;
-    }
-    public boolean  isA2dpStateChange( String action) {
-        if(action.equals(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED) ) {
-           return true;
-        }
-        return false;
-    }
-    public boolean  isA2dpPlayStateChange( String action) {
-        if(action.equals(BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED) ) {
-           return true;
-        }
-        return false;
-    }
-    public boolean isConnected(Intent intent) {
-        boolean isConnected = false;
-        int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE,
-                                BluetoothA2dp.STATE_DISCONNECTED);
-        if((state == BluetoothA2dp.STATE_CONNECTED) || (state == BluetoothProfile.STATE_CONNECTED)) {
-            isConnected = true;
-        }
-        return isConnected;
-    }
-    public boolean isPlaying(Intent intent) {
-        boolean isPlaying = false;
-        int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE,
-                                BluetoothA2dp.STATE_DISCONNECTED);
-        if(state == BluetoothA2dp.STATE_PLAYING ) {
-            isPlaying = true;
-        }
-        return isPlaying;
-    }
-    public boolean isDeviceAvailable() {
-        if(null != mA2dp) {
-            if( 0 != mA2dp.getConnectedDevices().size() ) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public A2dpDeviceStatus(Context mContext) {
-        mAdapter = BluetoothAdapter.getDefaultAdapter();
-        mAdapter.getProfileProxy(mContext, mProfileListener,
-                BluetoothProfile.A2DP);
-    }
-    private BluetoothProfile.ServiceListener mProfileListener =
-        new BluetoothProfile.ServiceListener() {
-    public void onServiceConnected(int profile, BluetoothProfile proxy) {
-        if (profile == BluetoothProfile.A2DP) {
-            mA2dp = (BluetoothA2dp) proxy;
-        }
-    }
-    public void onServiceDisconnected(int profile) {
-        if (profile == BluetoothProfile.A2DP) {
-            mA2dp = null;
-        }
-    }
-};
-}
-
diff --git a/fmapp/src/com/codeaurora/hc_utils/FrequencyPicker.java b/fmapp/src/com/codeaurora/hc_utils/FrequencyPicker.java
deleted file mode 100644
index 8a1deaa..0000000
--- a/fmapp/src/com/codeaurora/hc_utils/FrequencyPicker.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- * Not a Contribution.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.codeaurora.utils;
-
-
-import android.content.Context;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.widget.FrameLayout;
-
-import com.codeaurora.fmradio.R;
-import android.widget.NumberPicker;
-import android.widget.NumberPicker.OnValueChangeListener;
-
-/**
- * A view for selecting the frequency
- *
- * For a dialog using this view, see {FrequencyPickerDialog}.
- */
-
-public class FrequencyPicker extends FrameLayout {
-
-    /* UI Components */
-    private final NumberPicker mMHzPicker;
-    private final NumberPicker mKHzPicker;
-
-    /**
-     * How we notify users the Frequency has changed.
-     */
-    private OnFrequencyChangedListener mOnFrequencyChangedListener;
-
-    private int mFrequency;
-    private int mMin;
-    private int mMax;
-    private int mStep;
-    private int mMhz;
-    private int mKhz;
-
-    /**
-     * The callback used to indicate the user changes the Frequency.
-     */
-    public interface OnFrequencyChangedListener {
-
-        /**
-         * @param view The view associated with this listener.
-         * @param frequency The Frequency that was set.
-         */
-        void onFrequencyChanged(FrequencyPicker view, int frequency);
-    }
-
-    public FrequencyPicker(Context context) {
-        this(context, null);
-    }
-
-    public FrequencyPicker(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public FrequencyPicker(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-
-        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        inflater.inflate(R.layout.frequency_picker, this, true);
-
-        mMHzPicker = (NumberPicker) findViewById(R.id.mhz);
-        if (mMHzPicker != null) {
-           mMHzPicker.setOnLongPressUpdateInterval(100);
-
-           mMHzPicker.setOnValueChangedListener(new OnValueChangeListener() {
-              public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
-                  mMhz = newVal;
-                  mFrequency = (mMhz*1000) + (getFrequencyKHz(mKhz, mMin, mStep));
-                  validateFrequencyRange();
-                  if (mOnFrequencyChangedListener != null) {
-                        mOnFrequencyChangedListener.onFrequencyChanged(FrequencyPicker.this, mFrequency);
-                  }
-              }
-           });
-        }
-        mKHzPicker = (NumberPicker) findViewById(R.id.khz);
-        if (mKHzPicker != null) {
-           mKHzPicker.setOnLongPressUpdateInterval(100);
-           mKHzPicker.setOnValueChangedListener(new OnValueChangeListener() {
-              public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
-                  mKhz = newVal;
-                  mFrequency = (mMhz*1000) + (getFrequencyKHz(mKhz, mMin, mStep));
-
-                  validateFrequencyRange();
-
-                  if (mOnFrequencyChangedListener != null) {
-                        mOnFrequencyChangedListener.onFrequencyChanged(FrequencyPicker.this, mFrequency);
-                  }
-              }
-           });
-        }
-
-        updateSpinnerRange();
-
-        if (!isEnabled()) {
-            setEnabled(false);
-        }
-    }
-
-    @Override
-    public void setEnabled(boolean enabled) {
-        super.setEnabled(enabled);
-        mMHzPicker.setEnabled(enabled);
-        mKHzPicker.setEnabled(enabled);
-    }
-
-
-    public void updateFrequency(int frequency) {
-        mFrequency = frequency;
-        updateSpinners();
-    }
-
-    private static class SavedState extends BaseSavedState {
-
-        private final int mMHZ;
-        private final int mKHZ;
-
-        /**
-         * Constructor called from {@link FrequencyPicker#onSaveInstanceState()}
-         */
-        private SavedState(Parcelable superState, int mhz, int khz) {
-            super(superState);
-            mMHZ = mhz;
-            mKHZ = khz;
-        }
-
-        /**
-         * Constructor called from {@link #CREATOR}
-         */
-        private SavedState(Parcel in) {
-            super(in);
-            mMHZ = in.readInt();
-            mKHZ = in.readInt();
-        }
-
-        public int getMHz() {
-            return mMHZ;
-        }
-
-        public int getKHz() {
-            return mKHZ;
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-            dest.writeInt(mMHZ);
-            dest.writeInt(mKHZ);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR =
-                new Creator<SavedState>() {
-
-                    public SavedState createFromParcel(Parcel in) {
-                        return new SavedState(in);
-                    }
-
-                    public SavedState[] newArray(int size) {
-                        return new SavedState[size];
-                    }
-                };
-    }
-
-
-    /**
-     * Override so we are in complete control of save / restore for this widget.
-     */
-    @Override
-    protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
-        dispatchThawSelfOnly(container);
-    }
-
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-
-        return new SavedState(superState, mMhz, mKhz);
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-        mMhz = ss.getMHz();
-        mKhz = ss.getKHz();
-    }
-
-    private String[] getKHzStrings(int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (get100KHzStrings());
-            }
-            else if(stepSize == 50)
-            {
-                    return (get50KHzStrings());
-            }
-                   return (get200KHzStrings(min));
-    }
-
-    private int getKHzCount(int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (10);
-            }
-            else if(stepSize == 50)
-            {
-                    return (20);
-            }
-                   return (5);
-    }
-    private int getCurrentKHz(int frequency, int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (getCurrent100KHz(frequency));
-            }
-            else if(stepSize == 50)
-            {
-                    return (getCurrent50KHz(frequency));
-            }
-                   return (getCurrent200KHz(frequency, min));
-    }
-
-    private int getFrequencyKHz(int kHz, int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (getFrequency100KHz(kHz));
-            }
-            else if(stepSize == 50)
-            {
-                    return (getFrequency50KHz(kHz));
-            }
-                   return (getFrequency200KHz(kHz, min));
-    }
-
-    private int getFrequency100KHz(int kHz)
-    {
-            int frequencykhz = ((kHz-1)*100) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getFrequency50KHz(int kHz)
-    {
-            int frequencykhz = ((kHz-1)*50) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getFrequency200KHz(int kHz, int min)
-    {
-            int frequencykhz = ((kHz-1)*200) ;
-            if(min%200 != 0)
-            {
-                    frequencykhz = ((kHz-1)*200)+100 ;
-            }
-            //Log.d("FMRadio", "FP: getCurrent200KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getCurrent100KHz(int frequency)
-    {
-            int khz = ((frequency%1000)/100) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private int getCurrent50KHz(int frequency)
-    {
-            int khz = ((frequency%1000)/50)  ;
-        //Log.d("FMRadio", "FP: getCurrent50KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private int getCurrent200KHz(int frequency, int min)
-    {
-            int khz = ((frequency%1000)/200);
-        //Log.d("FMRadio", "FP: getCurrent200KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private String[] get50KHzStrings()
-    {
-                   String[] khzStrings= {"00","05","10","15","20","25","30","35","40","45",
-                                                 "50","55","60","65","70","75","80","85","90","95"};
-        //Log.d("FMRadio", "FP: get50KHzStrings");
-            return khzStrings;
-    }
-
-    private String[] get100KHzStrings()
-    {
-                   String[] khzStrings= {"0","1","2","3","4","5",
-                                         "6","7","8","9"};
-        //Log.d("FMRadio", "FP: get100KHzStrings");
-            return khzStrings;
-    }
-
-    private String[] get200KHzStrings(int min)
-    {
-            if(min%200 == 0)
-            {
-                    return (getEven200KHzStrings());
-            }
-                   return (getOdd200KHzStrings());
-    }
-
-    private String[] getEven200KHzStrings()
-    {
-                   String[] khzStrings= {"0","2","4","6","8"};
-        //Log.d("FMRadio", "FP: getEven200KHzStrings");
-            return khzStrings;
-    }
-    private String[] getOdd200KHzStrings()
-    {
-                   String[] khzStrings= {"1","3","5","7","9"};
-        //Log.d("FMRadio", "FP: getOdd200KHzStrings");
-            return khzStrings;
-    }
-    public void updateSteps(int steps)
-    {
-       mStep = steps;
-    }
-    public void updateMinFreq(int freq)
-    {
-       mMin = freq;
-    }
-    public void updateMaxFreq(int freq)
-    {
-       mMax = freq;
-    }
-    /**
-     * Initialize the state.
-     * @param year The initial year.
-     * @param monthOfYear The initial month.
-     * @param dayOfMonth The initial day of the month.
-     * @param onDateChangedListener How user is notified date is changed by user, can be null.
-     */
-    public void init(int min, int max, int step, int frequency,
-            OnFrequencyChangedListener onFrequencyChangedListener) {
-
-            mMin = min;
-            mMax = max;
-            mStep = step;
-        mFrequency = frequency;
-        mOnFrequencyChangedListener = onFrequencyChangedListener;
-
-        updateSpinners();
-    }
-    private void updateSpinnerRange() {
-        String[] khzStrings = getKHzStrings(mMin, mStep);
-        int khzNumSteps = getKHzCount(mStep);
-
-        if (mMHzPicker != null) {
-           mMHzPicker.setMinValue(mMin/1000);
-           mMHzPicker.setMaxValue(mMax/1000);
-        }
-        if (mKHzPicker != null) {
-           mKHzPicker.setDisplayedValues(get50KHzStrings());
-           mKHzPicker.setMinValue(1);
-           mKHzPicker.setMaxValue(khzNumSteps);
-           mKHzPicker.setDisplayedValues(khzStrings);
-        }
-    }
-
-    private void updateSpinners() {
-        int khzNumSteps = getKHzCount(mStep);
-        updateSpinnerRange();
-        mMhz = (int)(mFrequency/1000);
-            mKhz = getCurrentKHz(mFrequency, mMin, mStep) ;
-        if((mMin/1000 <=mMhz) && (mMax/1000 >=mMhz))
-        {
-            mMHzPicker.setValue(mMhz);
-        }
-        if(mKhz <= khzNumSteps)
-        {
-            mKHzPicker.setValue(mKhz);
-        }
-    }
-    private void validateFrequencyRange()
-    {
-            boolean bUpdateSpinner=false;
-        if(mFrequency < mMin)
-        {
-                mFrequency = mMin;
-                bUpdateSpinner = true;
-        }
-        if(mFrequency > mMax)
-        {
-                mFrequency = mMax;
-                bUpdateSpinner = true;
-        }
-        if(bUpdateSpinner == true)
-        {
-                updateSpinners();
-        }
-    }
-
-    public int getFrequency() {
-        return (mFrequency);
-    }
-}
diff --git a/fmapp/src/com/codeaurora/hc_utils/FrequencyPickerDialog.java b/fmapp/src/com/codeaurora/hc_utils/FrequencyPickerDialog.java
deleted file mode 100644
index 06ac7b3..0000000
--- a/fmapp/src/com/codeaurora/hc_utils/FrequencyPickerDialog.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
- * Not a Contribution.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.codeaurora.utils;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import qcom.fmradio.FmConfig;
-import qcom.fmradio.FmReceiver;
-
-import com.codeaurora.fmradio.R;
-import com.codeaurora.utils.FrequencyPicker.OnFrequencyChangedListener;
-
-/**
- * A simple dialog containing an FrequencyPicker.
- */
-public class FrequencyPickerDialog extends AlertDialog implements OnClickListener,
-OnFrequencyChangedListener {
-
-    private static final String FREQUENCY = "FREQUENCY";
-    private static final String FREQ_MIN = "FREQ_MIN";
-    private static final String FREQ_MAX = "FREQ_MAX";
-    private static final String FREQ_STEP = "FREQ_STEP";
-
-    private final FrequencyPicker mFrequencyPicker;
-    private final OnFrequencySetListener mCallBack;
-    private int mMinFrequency;
-    private int mMaxFrequency;
-    private int mChannelSpacing;
-
-    /**
-     * The callback used to indicate the user is done filling in the date.
-     */
-    public interface OnFrequencySetListener {
-
-        void onFrequencySet(FrequencyPicker view, int frequency);
-    }
-    /**
-     */
-    public FrequencyPickerDialog(Context context,
-                                                            FmConfig fmConfig,
-                                                            int frequency,
-                                 OnFrequencySetListener callback) {
-        //this(context, android.R.style.Theme_Dialog, fmConfig, frequency, callback);
-       this(context, com.android.internal.R.style.Theme_Dialog_Alert, fmConfig, frequency, callback);
-    }
-
-    /**
-     */
-    public FrequencyPickerDialog(Context context,
-            int theme,
-            FmConfig fmConfig,
-                        int frequency,
-                        OnFrequencySetListener callback) {
-        super(context, theme);
-        mMinFrequency = fmConfig.getLowerLimit();
-        mMaxFrequency = fmConfig.getUpperLimit();
-        mChannelSpacing = 200;
-        if(FmReceiver.FM_CHSPACE_200_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 200;
-        }
-        else if(FmReceiver.FM_CHSPACE_100_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 100;
-        }
-        else if(FmReceiver.FM_CHSPACE_50_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 50;
-        }
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-        mCallBack = callback;
-
-        setButton("Set", this);
-        setButton2("Cancel", (OnClickListener) null);
-        setIcon(R.drawable.alert_dialog_icon);
-
-        LayoutInflater inflater =
-                (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        View view = inflater.inflate(R.layout.frequency_picker_dialog, null);
-        setView(view);
-        mFrequencyPicker = (FrequencyPicker) view.findViewById(R.id.frequencyPicker);
-        if(mFrequencyPicker != null)
-        {
-                mFrequencyPicker.init(mMinFrequency, mMaxFrequency, mChannelSpacing, frequency, this);
-        }
-        else
-        {
-            Log.e("fmRadio", "Failed to find ID: R.id.frequencyPicker");
-        }
-    }
-
-    public void UpdateFrequency(int frequency)
-    {
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-            mFrequencyPicker.updateFrequency(frequency);
-    }
-
-    public void onClick(DialogInterface dialog, int which) {
-        if (mCallBack != null) {
-            mFrequencyPicker.clearFocus();
-            int frequency = mFrequencyPicker.getFrequency();
-            mCallBack.onFrequencySet(mFrequencyPicker, frequency);
-        }
-    }
-
-    public void onFrequencyChanged(FrequencyPicker view, int frequency) {
-            UpdateFrequency(frequency);
-    }
-
-    @Override
-    public Bundle onSaveInstanceState() {
-        Bundle state = super.onSaveInstanceState();
-        state.putInt(FREQUENCY, mFrequencyPicker.getFrequency());
-        state.putInt(FREQ_MIN, mMinFrequency);
-        state.putInt(FREQ_MAX, mMaxFrequency);
-        state.putInt(FREQ_STEP, mChannelSpacing);
-        return state;
-    }
-
-    @Override
-    public void onRestoreInstanceState(Bundle savedInstanceState) {
-        super.onRestoreInstanceState(savedInstanceState);
-        int frequency = savedInstanceState.getInt(FREQUENCY);
-        mMinFrequency = savedInstanceState.getInt(FREQ_MIN);
-        mMaxFrequency = savedInstanceState.getInt(FREQ_MAX );
-        mChannelSpacing = savedInstanceState.getInt(FREQ_STEP);
-        mFrequencyPicker.init(mMinFrequency, mMaxFrequency, mChannelSpacing, frequency, this);
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-    }
-    public void updateSteps(int steps)
-    {
-        mChannelSpacing = 200;
-        if(FmReceiver.FM_CHSPACE_200_KHZ == steps)
-        {
-                mChannelSpacing = 200;
-        }
-        else if(FmReceiver.FM_CHSPACE_100_KHZ == steps)
-        {
-                mChannelSpacing = 100;
-        }
-        else if(FmReceiver.FM_CHSPACE_50_KHZ == steps)
-        {
-                mChannelSpacing = 50;
-        }
-        mFrequencyPicker.updateSteps(mChannelSpacing);
-    }
-    public void updateMinFreq(int freq)
-    {
-       mMinFrequency = freq;
-       mFrequencyPicker.updateMinFreq(mMinFrequency);
-    }
-    public void updateMaxFreq(int freq)
-    {
-       mMaxFrequency = freq;
-       mFrequencyPicker.updateMaxFreq(mMaxFrequency);
-    }
-}
diff --git a/fmapp/src/com/codeaurora/utils/A2dpDeviceStatus.java b/fmapp/src/com/codeaurora/utils/A2dpDeviceStatus.java
deleted file mode 100644
index b6d5a88..0000000
--- a/fmapp/src/com/codeaurora/utils/A2dpDeviceStatus.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above copyright
- *            notice, this list of conditions and the following disclaimer in the
- *            documentation and/or other materials provided with the distribution.
- *        * Neither the name of The Linux Foundation nor
- *            the names of its contributors may be used to endorse or promote
- *            products derived from this software without specific prior written
- *            permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.    IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.codeaurora.utils;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothDevice;
-import android.content.Context;
-import android.content.Intent;
-
-import java.util.Set;
-
-
-public class A2dpDeviceStatus {
-    private BluetoothA2dp mA2dp = null;
-    public String getActionSinkStateChangedString (){
-        return BluetoothA2dp.ACTION_SINK_STATE_CHANGED;
-    }
-    public String getActionPlayStateChangedString (){
-        return BluetoothA2dp.ACTION_SINK_STATE_CHANGED;
-    }
-    public boolean  isA2dpStateChange( String action) {
-        if(action.equals(BluetoothA2dp.ACTION_SINK_STATE_CHANGED) ) {
-           return true;
-        }
-        return false;
-    }
-    public boolean  isA2dpPlayStateChange( String action) {
-        return isA2dpStateChange(action);
-    }
-    public boolean isConnected(Intent intent) {
-        boolean isConnected = false;
-        int state = intent.getIntExtra(BluetoothA2dp.EXTRA_SINK_STATE,
-                                BluetoothA2dp.STATE_DISCONNECTED);
-        if (state == BluetoothA2dp.STATE_CONNECTED ||
-                state == BluetoothA2dp.STATE_PLAYING){
-            isConnected = true;
-        }
-        return isConnected;
-    }
-    public boolean isPlaying(Intent intent) {
-        boolean isPlaying = false;
-        int state = intent.getIntExtra(BluetoothA2dp.EXTRA_SINK_STATE,
-                                BluetoothA2dp.STATE_DISCONNECTED);
-        if(state == BluetoothA2dp.STATE_PLAYING){
-            isPlaying = true;
-        }
-        return isPlaying;
-    }
-    public boolean isDeviceAvailable() {
-        if(null == mA2dp) return false;
-        Set<BluetoothDevice> sinks = mA2dp.getConnectedSinks();
-        if (sinks != null && sinks.size() != 0) {
-           return true;
-        }
-        return false;
-    }
-
-    public A2dpDeviceStatus(Context mContext) {
-        mA2dp = new BluetoothA2dp(mContext);
-    }
-
-}
diff --git a/fmapp/src/com/codeaurora/utils/FrequencyPicker.java b/fmapp/src/com/codeaurora/utils/FrequencyPicker.java
deleted file mode 100644
index 845ed90..0000000
--- a/fmapp/src/com/codeaurora/utils/FrequencyPicker.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.codeaurora.utils;
-
-
-import android.content.Context;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-//import android.util.Log;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.widget.FrameLayout;
-
-import com.codeaurora.fmradio.R;
-import android.widget.NumberPicker;
-import android.widget.NumberPicker.OnChangedListener;
-
-/**
- * A view for selecting the frequency
- *
- * For a dialog using this view, see {FrequencyPickerDialog}.
- */
-
-public class FrequencyPicker extends FrameLayout {
-
-    /* UI Components */
-    private final NumberPicker mMHzPicker;
-    private final NumberPicker mKHzPicker;
-
-    /**
-     * How we notify users the Frequency has changed.
-     */
-    private OnFrequencyChangedListener mOnFrequencyChangedListener;
-
-    private int mFrequency;
-    private int mMin;
-    private int mMax;
-    private int mStep;
-    private int mMhz;
-    private int mKhz;
-
-    /**
-     * The callback used to indicate the user changes the Frequency.
-     */
-    public interface OnFrequencyChangedListener {
-
-        /**
-         * @param view The view associated with this listener.
-         * @param frequency The Frequency that was set.
-         */
-        void onFrequencyChanged(FrequencyPicker view, int frequency);
-    }
-
-    public FrequencyPicker(Context context) {
-        this(context, null);
-    }
-
-    public FrequencyPicker(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public FrequencyPicker(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-
-        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        inflater.inflate(R.layout.frequency_picker, this, true);
-
-        mMHzPicker = (NumberPicker) findViewById(R.id.mhz);
-        if (mMHzPicker != null) {
-           mMHzPicker.setSpeed(100);
-           mMHzPicker.setOnChangeListener(new OnChangedListener() {
-              public void onChanged(NumberPicker picker, int oldVal, int newVal) {
-                 mMhz = newVal;
-                 mFrequency = (mMhz*1000) + (getFrequencyKHz(mKhz, mMin, mStep));
-                 validateFrequencyRange();
-                 if (mOnFrequencyChangedListener != null) {
-                    mOnFrequencyChangedListener.onFrequencyChanged(FrequencyPicker.this, mFrequency);
-                 }
-              }
-           });
-        }
-        mKHzPicker = (NumberPicker) findViewById(R.id.khz);
-        if (mKHzPicker != null) {
-           mKHzPicker.setSpeed(100);
-           mKHzPicker.setOnChangeListener(new OnChangedListener() {
-              public void onChanged(NumberPicker picker, int oldVal, int newVal) {
-                 mKhz = newVal;
-                 mFrequency = (mMhz*1000) + (getFrequencyKHz(mKhz, mMin, mStep));
-
-                 validateFrequencyRange();
-
-                 if (mOnFrequencyChangedListener != null) {
-                    mOnFrequencyChangedListener.onFrequencyChanged(FrequencyPicker.this, mFrequency);
-                 }
-              }
-           });
-        }
-
-        updateSpinnerRange();
-
-        if (!isEnabled()) {
-            setEnabled(false);
-        }
-    }
-
-    @Override
-    public void setEnabled(boolean enabled) {
-        super.setEnabled(enabled);
-        if (mMHzPicker != null) {
-           mMHzPicker.setEnabled(enabled);
-        }
-        if (mKHzPicker != null) {
-           mKHzPicker.setEnabled(enabled);
-        }
-    }
-
-
-    public void updateFrequency(int frequency) {
-        mFrequency = frequency;
-        updateSpinners();
-    }
-
-    private static class SavedState extends BaseSavedState {
-
-        private final int mMHZ;
-        private final int mKHZ;
-
-        /**
-         * Constructor called from {@link FrequencyPicker#onSaveInstanceState()}
-         */
-        private SavedState(Parcelable superState, int mhz, int khz) {
-            super(superState);
-            mMHZ = mhz;
-            mKHZ = khz;
-        }
-
-        /**
-         * Constructor called from {@link #CREATOR}
-         */
-        private SavedState(Parcel in) {
-            super(in);
-            mMHZ = in.readInt();
-            mKHZ = in.readInt();
-        }
-
-        public int getMHz() {
-            return mMHZ;
-        }
-
-        public int getKHz() {
-            return mKHZ;
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-            dest.writeInt(mMHZ);
-            dest.writeInt(mKHZ);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR =
-                new Creator<SavedState>() {
-
-                    public SavedState createFromParcel(Parcel in) {
-                        return new SavedState(in);
-                    }
-
-                    public SavedState[] newArray(int size) {
-                        return new SavedState[size];
-                    }
-                };
-    }
-
-
-    /**
-     * Override so we are in complete control of save / restore for this widget.
-     */
-    @Override
-    protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
-        dispatchThawSelfOnly(container);
-    }
-
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-
-        return new SavedState(superState, mMhz, mKhz);
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-        mMhz = ss.getMHz();
-        mKhz = ss.getKHz();
-    }
-
-    private String[] getKHzStrings(int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (get100KHzStrings());
-            }
-            else if(stepSize == 50)
-            {
-                    return (get50KHzStrings());
-            }
-                   return (get200KHzStrings(min));
-    }
-
-    private int getKHzCount(int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (10);
-            }
-            else if(stepSize == 50)
-            {
-                    return (20);
-            }
-                   return (5);
-    }
-    private int getCurrentKHz(int frequency, int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (getCurrent100KHz(frequency));
-            }
-            else if(stepSize == 50)
-            {
-                    return (getCurrent50KHz(frequency));
-            }
-                   return (getCurrent200KHz(frequency, min));
-    }
-
-    private int getFrequencyKHz(int kHz, int min, int stepSize)
-    {
-            if(stepSize == 100)
-            {
-                    return (getFrequency100KHz(kHz));
-            }
-            else if(stepSize == 50)
-            {
-                    return (getFrequency50KHz(kHz));
-            }
-                   return (getFrequency200KHz(kHz, min));
-    }
-
-    private int getFrequency100KHz(int kHz)
-    {
-            int frequencykhz = ((kHz-1)*100) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getFrequency50KHz(int kHz)
-    {
-            int frequencykhz = ((kHz-1)*50) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getFrequency200KHz(int kHz, int min)
-    {
-            int frequencykhz = ((kHz-1)*200) ;
-            if(min%200 != 0)
-            {
-                    frequencykhz = ((kHz-1)*200)+100 ;
-            }
-            //Log.d("FMRadio", "FP: getCurrent200KHz: " + frequencykhz);
-                   return (frequencykhz);
-    }
-
-    private int getCurrent100KHz(int frequency)
-    {
-            int khz = ((frequency%1000)/100) ;
-        //Log.d("FMRadio", "FP: getCurrent100KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private int getCurrent50KHz(int frequency)
-    {
-            int khz = ((frequency%1000)/50)  ;
-        //Log.d("FMRadio", "FP: getCurrent50KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private int getCurrent200KHz(int frequency, int min)
-    {
-            int khz = ((frequency%1000)/200);
-        //Log.d("FMRadio", "FP: getCurrent200KHz: " + khz);
-                   return (khz+1);
-    }
-
-    private String[] get50KHzStrings()
-    {
-                   String[] khzStrings= {"00","05","10","15","20","25","30","35","40","45",
-                                                 "50","55","60","65","70","75","80","85","90","95"};
-        //Log.d("FMRadio", "FP: get50KHzStrings");
-            return khzStrings;
-    }
-
-    private String[] get100KHzStrings()
-    {
-                   String[] khzStrings= {"0","1","2","3","4","5",
-                                         "6","7","8","9"};
-        //Log.d("FMRadio", "FP: get100KHzStrings");
-            return khzStrings;
-    }
-
-    private String[] get200KHzStrings(int min)
-    {
-            if(min%200 == 0)
-            {
-                    return (getEven200KHzStrings());
-            }
-                   return (getOdd200KHzStrings());
-    }
-
-    private String[] getEven200KHzStrings()
-    {
-                   String[] khzStrings= {"0","2","4","6","8"};
-        //Log.d("FMRadio", "FP: getEven200KHzStrings");
-            return khzStrings;
-    }
-    private String[] getOdd200KHzStrings()
-    {
-                   String[] khzStrings= {"1","3","5","7","9"};
-        //Log.d("FMRadio", "FP: getOdd200KHzStrings");
-            return khzStrings;
-    }
-
-    /**
-     * Initialize the state.
-     * @param year The initial year.
-     * @param monthOfYear The initial month.
-     * @param dayOfMonth The initial day of the month.
-     * @param onDateChangedListener How user is notified date is changed by user, can be null.
-     */
-    public void init(int min, int max, int step, int frequency,
-            OnFrequencyChangedListener onFrequencyChangedListener) {
-
-            mMin = min;
-            mMax = max;
-            mStep = step;
-        mFrequency = frequency;
-        mOnFrequencyChangedListener = onFrequencyChangedListener;
-
-        updateSpinners();
-    }
-    private void updateSpinnerRange() {
-        String[] khzStrings = getKHzStrings(mMin, mStep);
-        int khzNumSteps = getKHzCount(mStep);
-
-        if (mMHzPicker != null) {
-           mMHzPicker.setRange(mMin/1000, mMax/1000);
-        }
-        if (mKHzPicker != null) {
-           mKHzPicker.setRange(1, khzNumSteps, khzStrings);
-        }
-    }
-
-    private void updateSpinners() {
-        int khzNumSteps = getKHzCount(mStep);
-            updateSpinnerRange();
-        mMhz = (int)(mFrequency/1000);
-            mKhz = getCurrentKHz(mFrequency, mMin, mStep) ;
-        if((mMin/1000 <=mMhz) && (mMax/1000 >=mMhz))
-        {
-            mMHzPicker.setCurrent(mMhz);
-        }
-        if(mKhz <= khzNumSteps)
-        {
-            mKHzPicker.setCurrent(mKhz);
-        }
-    }
-    private void validateFrequencyRange()
-    {
-            boolean bUpdateSpinner=false;
-        if(mFrequency < mMin)
-        {
-                mFrequency = mMin;
-                bUpdateSpinner = true;
-        }
-        if(mFrequency > mMax)
-        {
-                mFrequency = mMax;
-                bUpdateSpinner = true;
-        }
-        if(bUpdateSpinner == true)
-        {
-                updateSpinners();
-        }
-    }
-
-    public int getFrequency() {
-        return (mFrequency);
-    }
-}
diff --git a/fmapp/src/com/codeaurora/utils/FrequencyPickerDialog.java b/fmapp/src/com/codeaurora/utils/FrequencyPickerDialog.java
deleted file mode 100644
index 6078208..0000000
--- a/fmapp/src/com/codeaurora/utils/FrequencyPickerDialog.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.codeaurora.utils;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import qcom.fmradio.FmConfig;
-import qcom.fmradio.FmReceiver;
-
-import com.codeaurora.fmradio.R;
-import com.codeaurora.utils.FrequencyPicker.OnFrequencyChangedListener;
-
-/**
- * A simple dialog containing an FrequencyPicker.
- */
-public class FrequencyPickerDialog extends AlertDialog implements OnClickListener,
-OnFrequencyChangedListener {
-
-    private static final String FREQUENCY = "FREQUENCY";
-    private static final String FREQ_MIN = "FREQ_MIN";
-    private static final String FREQ_MAX = "FREQ_MAX";
-    private static final String FREQ_STEP = "FREQ_STEP";
-
-    private final FrequencyPicker mFrequencyPicker;
-    private final OnFrequencySetListener mCallBack;
-    private int mMinFrequency;
-    private int mMaxFrequency;
-    private int mChannelSpacing;
-
-    /**
-     * The callback used to indicate the user is done filling in the date.
-     */
-    public interface OnFrequencySetListener {
-
-        void onFrequencySet(FrequencyPicker view, int frequency);
-    }
-    /**
-     */
-    public FrequencyPickerDialog(Context context,
-                                                            FmConfig fmConfig,
-                                                            int frequency,
-                                 OnFrequencySetListener callback) {
-        //this(context, android.R.style.Theme_Dialog, fmConfig, frequency, callback);
-       this(context, com.android.internal.R.style.Theme_Dialog_Alert, fmConfig, frequency, callback);
-    }
-
-    /**
-     */
-    public FrequencyPickerDialog(Context context,
-            int theme,
-            FmConfig fmConfig,
-                        int frequency,
-                        OnFrequencySetListener callback) {
-        super(context, theme);
-        mMinFrequency = fmConfig.getLowerLimit();
-        mMaxFrequency = fmConfig.getUpperLimit();
-        mChannelSpacing = 200;
-        if(FmReceiver.FM_CHSPACE_200_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 200;
-        }
-        else if(FmReceiver.FM_CHSPACE_100_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 100;
-        }
-        else if(FmReceiver.FM_CHSPACE_50_KHZ == fmConfig.getChSpacing())
-        {
-                mChannelSpacing = 50;
-        }
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-        mCallBack = callback;
-
-        setButton("Set", this);
-        setButton2("Cancel", (OnClickListener) null);
-        setIcon(R.drawable.alert_dialog_icon);
-
-        LayoutInflater inflater =
-                (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        View view = inflater.inflate(R.layout.frequency_picker_dialog, null);
-        setView(view);
-        mFrequencyPicker = (FrequencyPicker) view.findViewById(R.id.frequencyPicker);
-        if(mFrequencyPicker != null)
-        {
-                mFrequencyPicker.init(mMinFrequency, mMaxFrequency, mChannelSpacing, frequency, this);
-        }
-        else
-        {
-            Log.e("fmRadio", "Failed to find ID: R.id.frequencyPicker");
-        }
-    }
-
-    public void UpdateFrequency(int frequency)
-    {
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-            mFrequencyPicker.updateFrequency(frequency);
-    }
-
-    public void onClick(DialogInterface dialog, int which) {
-        if (mCallBack != null) {
-            mFrequencyPicker.clearFocus();
-            int frequency = mFrequencyPicker.getFrequency();
-            mCallBack.onFrequencySet(mFrequencyPicker, frequency);
-        }
-    }
-
-    public void onFrequencyChanged(FrequencyPicker view, int frequency) {
-            UpdateFrequency(frequency);
-    }
-
-    @Override
-    public Bundle onSaveInstanceState() {
-        Bundle state = super.onSaveInstanceState();
-        state.putInt(FREQUENCY, mFrequencyPicker.getFrequency());
-        state.putInt(FREQ_MIN, mMinFrequency);
-        state.putInt(FREQ_MAX, mMaxFrequency);
-        state.putInt(FREQ_STEP, mChannelSpacing);
-        return state;
-    }
-
-    @Override
-    public void onRestoreInstanceState(Bundle savedInstanceState) {
-        super.onRestoreInstanceState(savedInstanceState);
-        int frequency = savedInstanceState.getInt(FREQUENCY);
-        mMinFrequency = savedInstanceState.getInt(FREQ_MIN);
-        mMaxFrequency = savedInstanceState.getInt(FREQ_MAX );
-        mChannelSpacing = savedInstanceState.getInt(FREQ_STEP);
-        mFrequencyPicker.init(mMinFrequency, mMaxFrequency, mChannelSpacing, frequency, this);
-        int MHz = frequency/1000;
-        int KHz = (frequency%1000)/100;
-            setTitle("FM - "+MHz+"."+KHz);
-    }
-}
diff --git a/fmhalService/Android.mk b/fmhalService/Android.mk
deleted file mode 100644
index cf0bdc0..0000000
--- a/fmhalService/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Setup bdroid local make variables for handling configuration
-ifneq ($(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR),)
-  bdroid_C_INCLUDES := $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)
-  bdroid_CFLAGS += -DHAS_BDROID_BUILDCFG
-else
-  bdroid_C_INCLUDES :=
-  bdroid_CFLAGS += -DHAS_NO_BDROID_BUILDCFG
-endif
-
-BDROID_DIR:= system/bt
-
-LOCAL_CFLAGS += $(bdroid_CFLAGS)
-
-LOCAL_SRC_FILES := \
-	     main.c
-
-LOCAL_SHARED_LIBRARIES := \
-         libdl \
-         libcutils \
-         liblog
-
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-LOCAL_C_INCLUDES += \
-        $(BDROID_DIR)/hci/include \
-        $(BDROID_DIR)/stack/include \
-        $(BDROID_DIR)/osi/include \
-        $(LOCAL_PATH)/../helium \
-        $(LOCAL_PATH)/../fm_hci
-
-LOCAL_MODULE := fmhal_service
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/fmhalService/main.c b/fmhalService/main.c
deleted file mode 100644
index 6647f8b..0000000
--- a/fmhalService/main.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above
- *            copyright notice, this list of conditions and the following
- *            disclaimer in the documentation and/or other materials provided
- *            with the distribution.
- *        * Neither the name of The Linux Foundation nor the names of its
- *            contributors may be used to endorse or promote products derived
- *            from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * FMhal service used to access RFKILL
-
-**/
-
-#include <cutils/log.h>
-#include <sys/socket.h>
-#include <cutils/sockets.h>
-#include <pthread.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <fcntl.h>
-#include <sys/un.h>
-#include <sys/eventfd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <cutils/properties.h>
-#include "private/android_filesystem_config.h"
-
-
-//#include "bt_hci_bdroid.h"
-#include "bt_vendor_lib.h"
-#include "fm_hci.h"
-#include "wcnss_fmhci.h"
-#include <dlfcn.h>
-
-
-#define LOG_TAG "FMHalService"
-
-#define FM_HAL_SOCK "fmhal_sock"
-
-
-#define BT_SSR_TRIGGERED 0xee
-
-#define FM_POWER_OFF      0x01
-#define FM_POWER_ON       0x02
-#define FM_USERIAL_OPEN   0x03
-#define FM_USERIAL_CLOSE  0x04
-
-#define FM_CMD_PACKET_TYPE     0x11
-#define FM_EVT_PACKET_TYPE     0x14
-
-#ifndef BLUETOOTH_UID
-#define BLUETOOTH_UID 1002
-#endif
-#ifndef SYSTEM_UID
-#define SYSTEM_UID 1000
-#endif
-
-#ifndef ROOT_UID
-#define ROOT_UID 0
-#endif
-
-pthread_mutex_t signal_mutex;
-
-bt_vendor_interface_t *fm_if = NULL;
-int remote_fm_hal_fd;
-
-int do_write(int fd, unsigned char *buf,int len);
-
-unsigned char reset_cmpl[] = {0x04, 0x0e, 0x04, 0x01,0x03, 0x0c, 0x00};
-
-static int extract_uid(int uuid)
-{
-    int userid;
-    int appid;
-
-    appid = userid =  uuid % AID_USER;
-    if (userid > BLUETOOTH_UID)
-    {
-        appid = userid % AID_APP;
-    }
-    ALOGD("%s appid = %d",__func__,appid);
-    return appid;
-}
- void service_cleanup()
-{
-    char ref_count[PROPERTY_VALUE_MAX];
-    char cleanup[PROPERTY_VALUE_MAX];
-    int ref_val,clean;
-
-    ALOGE("Service is stopped ");
-    property_get("wc_transport.clean_up", cleanup, "0");
-    property_set("wc_transport.fm_service_status", "0");
-    property_set("wc_transport.start_fmhci", "0");
-    property_set("wc_transport.fm_power_status", "0");
-    clean = atoi(cleanup);
-    ALOGE("clean Value =  %d",clean);
-}
-
-static int establish_fm_remote_socket(char *name)
-{
-    int fd = -1;
-    struct sockaddr_un client_address;
-    socklen_t clen;
-    int sock_id, ret;
-    struct ucred creds;
-    int c_uid;
-    ALOGI("%s(%s) Entry  ", __func__, name);
-
-    sock_id = socket(AF_LOCAL, SOCK_STREAM, 0);
-    if (sock_id < 0) {
-        ALOGE("%s: server Socket creation failure", __func__);
-        return fd;
-    }
-
-    ALOGI("convert name to android abstract name:%s %d", name, sock_id);
-    if (socket_local_server_bind(sock_id,
-        name, ANDROID_SOCKET_NAMESPACE_ABSTRACT) >= 0) {
-        if (listen(sock_id, 5) == 0) {
-            ALOGI("listen to local socket:%s, fd:%d", name, sock_id);
-        } else {
-            ALOGE("listen to local socket:failed");
-            close(sock_id);
-            return fd;
-        }
-    } else {
-        close(sock_id);
-        ALOGE("%s: server bind failed for socket : %s", __func__, name);
-        return fd;
-    }
-
-    clen = sizeof(client_address);
-    /*Indicate that, server is ready to accept*/
-    property_set("wc_transport.fm_service_status", "1");
-    ALOGI("%s: wc_transport.fm_service_status set to 1 ", __func__);
-    ALOGI("%s: before accept_server_socket", name);
-    fd = accept(sock_id, (struct sockaddr *)&client_address, &clen);
-    if (fd > 0) {
-        ALOGI("%s accepted fd:%d for server fd:%d", name, fd, sock_id);
-        close(sock_id);
-
-        memset(&creds, 0, sizeof(creds));
-        socklen_t szCreds = sizeof(creds);
-        ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &szCreds);
-        if (ret < 0) {
-            ALOGE("%s: error getting remote socket creds: %d\n", __func__, ret);
-            close(fd);
-            return -1;
-        }
-        c_uid = creds.uid;
-        if (c_uid > BLUETOOTH_UID)
-            c_uid = extract_uid(creds.uid);
-        if (c_uid != BLUETOOTH_UID && c_uid != SYSTEM_UID
-                && c_uid != ROOT_UID) {
-            ALOGE("%s: client doesn't have required credentials", __func__);
-            ALOGE("<%s req> client uid: %d", name, creds.uid);
-            close(fd);
-            return -1;
-        }
-
-        ALOGI("%s: Remote socket credentials: %d\n", __func__, creds.uid);
-        return fd;
-    } else {
-        ALOGE("BTC accept failed fd:%d sock d:%d error %s", fd, sock_id, strerror(errno));
-        close(sock_id);
-        return fd;
-    }
-
-    close(sock_id);
-    return fd;
-}
-
-
-int handle_fmcommand_writes(int fd) {
-    ALOGI("%s: ", __func__);
-    unsigned char first_byte;
-    int retval,val;
-	int fd_array[CH_MAX];
-
-    ALOGE("%s: FMHAL: read 1st byte to determine the power on/off ", __func__);
-
-    retval = read (fd, &first_byte, 1);
-    if (retval < 0) {
-        ALOGE("%s:read returns err: %d\n", __func__,retval);
-        return -1;
-    }
-    if (retval == 0) {
-        ALOGE("%s: This indicates the close of other end", __func__);
-        return -99;
-    }
-
-    ALOGE("%s: FM command type: 0x%x", __func__, first_byte);
-    switch(first_byte) {
-        case FM_POWER_OFF:
-             ALOGE("%s: Received power off command from FM stack: %d", __func__, first_byte);
-             val = 0;
-             retval = fm_if->op(BT_VND_OP_POWER_CTRL, &val);
-             if (retval < 0)
-             {
-                ALOGE("Failed to turn off power from  bt vendor interface");
-               //   return -1;
-             }
-             else {
-                 property_set("wc_transport.fm_power_status", "0");
-                 retval = -99;
-             }
-             break;
-
-        case FM_POWER_ON:
-             ALOGE("%s: Received power ON command from FM stack: %d", __func__, first_byte);
-             val = 1;
-             retval =fm_if->op(FM_VND_OP_POWER_CTRL, &val);
-             if (retval < 0)
-             {
-               ALOGE("Failed to turn on power from  bt vendor interface");
-             }
-             else
-                property_set("wc_transport.fm_power_status", "1");
-             break;
-        default:
-            ALOGE("%s: Unexpected data format!!",__func__);
-            retval = -1;
-    }
-    return retval;
-}
-
-
-int do_read(int fd, unsigned char* buf, size_t len) {
-   int bytes_left, bytes_read = 0, read_offset;
-
-   bytes_left = len;
-   read_offset = 0;
-
-   do {
-       bytes_read = read(fd, buf+read_offset, bytes_left);
-       if (bytes_read < 0) {
-           ALOGE("%s: Read error: %d (%s)", __func__, bytes_left, strerror(errno));
-           return -1;
-       } else if (bytes_read == 0) {
-            ALOGE("%s: read returned 0, err = %s, read bytes: %d, expected: %d",
-                              __func__, strerror(errno), (len-bytes_left), len);
-            return (len-bytes_left);
-       }
-       else {
-           if (bytes_read < bytes_left) {
-              ALOGV("Still there are %d bytes to read", bytes_left-bytes_read);
-              bytes_left = bytes_left-bytes_read;
-              read_offset = read_offset+bytes_read;
-           } else {
-              ALOGV("%s: done with read",__func__);
-              break;
-           }
-       }
-   }while(1);
-   return len;
-}
-
-int do_write(int fd, unsigned char *buf,int len)
-{
-    int ret = 0;
-    int write_offset = 0;
-    int write_len = len;
-    do {
-        ret = write(fd, buf+write_offset, write_len);
-        if (ret < 0)
-        {
-            ALOGE("%s: write failed ret = %d err = %s",__func__,ret,strerror(errno));
-            return -1;
-
-        } else if (ret == 0) {
-            ALOGE("%s: Write returned 0, err = %s, Written bytes: %d, expected: %d",
-                        __func__, strerror(errno), (len-write_len), len);
-            return (len-write_len);
-
-        } else {
-            if (ret < write_len)
-            {
-               ALOGD("%s, Write pending,do write ret = %d err = %s",__func__,ret,
-                       strerror(errno));
-               write_len = write_len - ret;
-               write_offset = ret;
-            } else if (ret > write_len) {
-               ALOGE("%s: FATAL wrote more than expected: written bytes: %d expected: %d",
-                      __func__, write_len, ret);
-               break;
-            } else {
-               ALOGV("Write successful");
-               break;
-            }
-        }
-    } while(1);
-    return len;
-}
-
-void vnd_load_if()
-{
-    void *dlhandle;
-    unsigned char bdaddr[] = {0xaa, 0xbb, 0xcc, 0x11, 0x22, 0x33};
-
-    dlhandle = dlopen("libbt-vendor.so", RTLD_NOW);
-    if (!dlhandle)
-    {
-        ALOGE("!!! Failed to load libbt-vendor.so !!!");
-        return;
-    }
-
-    fm_if = (bt_vendor_interface_t *) dlsym(dlhandle, "BLUETOOTH_VENDOR_LIB_INTERFACE");
-    if (!fm_if)
-    {
-        ALOGE("!!! Failed to get bt vendor interface !!!");
-        return;
-    }
-
-    ALOGI("FM-HCI: Registering the WCNSS HAL library by passing CBs and BD addr.");
-    fm_if->init(&fmhci_vendor_callbacks, bdaddr);
-}
-
-
-int main()  {
-   fd_set client_fds;
-    int retval = -1, n;
-
-    ALOGI("%s: Entry ", __func__);
-    ALOGI("FM HAL SERVICE: Loading the WCNSS HAL library...");
-    vnd_load_if();
-    ALOGI("create socket");
-    remote_fm_hal_fd = establish_fm_remote_socket(FM_HAL_SOCK);
-    if (remote_fm_hal_fd < 0) {
-       ALOGE("%s: invalid remote socket", __func__);
-       return -1;
-    }
-
-     FD_ZERO(&client_fds);
-     FD_SET(remote_fm_hal_fd, &client_fds);
-
-     do {
-            ALOGI("%s: Step 1-FM-HAL SERVICE: Waiting for FM HAL cmd ", __func__);
-            n = select(remote_fm_hal_fd+1, &client_fds, NULL, NULL, NULL);
-            if(n < 0){
-                ALOGE("Select: failed: %s", strerror(errno));
-                break;
-            }
-            ALOGI("%s: Step 2-FM-HAL SERVICE: FM  POWER CMD available for processing...\n", __func__);
-            if (FD_ISSET(remote_fm_hal_fd, &client_fds)) {
-                retval = handle_fmcommand_writes(remote_fm_hal_fd);
-                ALOGI("%s: handle_fmcommand_writes . %d", __func__, retval);
-               if(retval < 0) {
-                   if (retval == -99) {
-                       ALOGI("%s:End of wait loop", __func__);
-                       break;
-                   }
-                   ALOGI("%s: handle_fmcommand_writes returns: %d: ", __func__, retval);
-                 //  break;
-                }
-            }
-        } while(1);
-
-        service_cleanup();
-        ALOGI("%s: FM turned off or power off failed .service kill itself", __func__);
-        close(remote_fm_hal_fd);
-       remote_fm_hal_fd = 0;
-
-    ALOGI("%s: Exit: %d", __func__, retval);
-    return retval;
-}
-
diff --git a/fmhalService/wcnss_fmhci.h b/fmhalService/wcnss_fmhci.h
deleted file mode 100644
index 22029bf..0000000
--- a/fmhalService/wcnss_fmhci.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *        * Redistributions of source code must retain the above copyright
- *            notice, this list of conditions and the following disclaimer.
- *        * Redistributions in binary form must reproduce the above
- *            copyright notice, this list of conditions and the following
- *            disclaimer in the documentation and/or other materials provided
- *            with the distribution.
- *        * Neither the name of The Linux Foundation nor the names of its
- *            contributors may be used to endorse or promote products derived
- *            from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __WCNSS_FMHCI__
-#define __WCNSS_FMHCI__
-static void vendor_fwcfg_cb(bt_vendor_op_result_t result) {
-}
-
-static void vendor_scocfg_cb(bt_vendor_op_result_t result) {
-}
-
-static void vendor_lpm_vnd_cb(bt_vendor_op_result_t result) {
-}
-
-static void sco_audiostate_cb(bt_vendor_op_result_t result) {
-}
-
-static void* vendor_alloc(int size) {
-    return NULL;
-}
-
-static void vendor_dealloc(void *p_buf) {
-}
-
-static uint8_t vendor_xmit_cb(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback) {
-    return 0;
-}
-
-static void vendor_epilog_cb(bt_vendor_op_result_t result) {
-}
-
-
-static const bt_vendor_callbacks_t fmhci_vendor_callbacks = {
-  sizeof(fmhci_vendor_callbacks),
-   vendor_fwcfg_cb,
-   vendor_scocfg_cb,
-   vendor_lpm_vnd_cb,
-   sco_audiostate_cb,
-   vendor_alloc,
-   vendor_dealloc,
-   vendor_xmit_cb,
-   vendor_epilog_cb
-};
-#endif
diff --git a/helium/Android.mk b/helium/Android.mk
index 4008dd6..737ed3f 100644
--- a/helium/Android.mk
+++ b/helium/Android.mk
@@ -1,6 +1,3 @@
-#ifeq ($(BOARD_HAVE_QCOM_FM),true)
-#ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
-
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -15,7 +12,7 @@
          libnativehelper \
          libcutils
 
-FM_HCI_DIR:= vendor/qcom/opensource/fm
+FM_HCI_DIR:= vendor/qcom/opensource/commonsys/fm
 
 LOCAL_C_INCLUDES += $(FM_HCI_DIR)/fm_hci
 
@@ -23,8 +20,3 @@
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
-
-#endif # is-vendor-board-platform
-#endif # BOARD_HAVE_QCOM_FM
-
-
diff --git a/jni/Android.mk b/jni/Android.mk
index 1a8326d..4c64481 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -3,6 +3,10 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
+ifeq ($(BOARD_HAS_QCA_FM_SOC), "cherokee")
+LOCAL_CFLAGS += -DFM_SOC_TYPE_CHEROKEE
+endif
+
 LOCAL_SRC_FILES:= \
 android_hardware_fm.cpp \
 ConfFileParser.cpp \
@@ -10,9 +14,6 @@
 FmIoctlsInterface.cpp \
 FmPerformanceParams.cpp
 
-ifeq ($(BOARD_HAS_QCA_FM_SOC), "cherokee")
-LOCAL_CFLAGS += -DFM_SOC_TYPE_CHEROKEE
-endif
 LOCAL_LDLIBS += -ldl
 LOCAL_SHARED_LIBRARIES := \
         libandroid_runtime \
@@ -29,16 +30,6 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
-include $(CLEAR_VARS)
-LOCAL_MODULE := init.qti.fm.sh
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
-
-LOCAL_INIT_RC := init.qti.fm.rc
-
-include $(BUILD_PREBUILT)
 
 endif # is-vendor-board-platform
 endif # BOARD_HAVE_QCOM_FM
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index e60fe3d..6964271 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -83,7 +83,6 @@
 
 namespace android {
 
-#ifdef FM_SOC_TYPE_CHEROKEE
 char *FM_LIBRARY_NAME = "fm_helium.so";
 char *FM_LIBRARY_SYMBOL_NAME = "FM_HELIUM_LIB_INTERFACE";
 void *lib_handle;
@@ -649,7 +648,6 @@
     fm_enable_slimbus_cb,
     fm_enable_softmute_cb
 };
-#endif
 /* native interface */
 static jint android_hardware_fmradio_FmReceiverJNI_acquireFdNative
         (JNIEnv* env, jobject thiz, jstring path)
@@ -740,6 +738,23 @@
     return FM_JNI_SUCCESS;
 }
 
+static bool is_soc_cherokee() {
+    char value[PROPERTY_VALUE_MAX] = {'\0'};
+    property_get("vendor.bluetooth.soc", value, NULL);
+    ALOGD("BT soc is %s\n", value);
+
+    // Need to rework on property
+    /*if(strcmp(value, "cherokee") == 0)
+        return true;
+    else
+        return false;*/
+#ifdef FM_SOC_TYPE_CHEROKEE
+    ALOGD("BT soc is CHEROKEE");
+    return true;
+#else
+    return false;
+#endif
+}
 /********************************************************************
  * Current JNI
  *******************************************************************/
@@ -750,29 +765,32 @@
 {
     int err;
     long freq;
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_FREQ, (int *)&freq);
-    if (err == FM_JNI_SUCCESS) {
-        err = freq;
-    } else {
-        err = FM_JNI_FAILURE;
-        ALOGE("%s: get freq failed\n", LOG_TAG);
-    }
-#else
-    if (fd >= 0) {
-        err = FmIoctlsInterface :: get_cur_freq(fd, freq);
-        if(err < 0) {
-           err = FM_JNI_FAILURE;
-           ALOGE("%s: get freq failed\n", LOG_TAG);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_FREQ, (int *)&freq);
+        if (err == FM_JNI_SUCCESS) {
+            err = freq;
         } else {
-           err = freq;
+            err = FM_JNI_FAILURE;
+            ALOGE("%s: get freq failed\n", LOG_TAG);
         }
-    } else {
-        ALOGE("%s: get freq failed because fd is negative, fd: %d\n",
-              LOG_TAG, fd);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if (fd >= 0) {
+            err = FmIoctlsInterface :: get_cur_freq(fd, freq);
+            if(err < 0) {
+               err = FM_JNI_FAILURE;
+               ALOGE("%s: get freq failed\n", LOG_TAG);
+            } else {
+               err = freq;
+            }
+        } else {
+            ALOGE("%s: get freq failed because fd is negative, fd: %d\n",
+                  LOG_TAG, fd);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -781,23 +799,26 @@
     (JNIEnv * env, jobject thiz, jint fd, jint freq)
 {
     int err;
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_FREQ, freq);
-#else
-    if ((fd >= 0) && (freq > 0)) {
-        err = FmIoctlsInterface :: set_freq(fd, freq);
-        if (err < 0) {
-            ALOGE("%s: set freq failed, freq: %d\n", LOG_TAG, freq);
-            err = FM_JNI_FAILURE;
-        } else {
-            err = FM_JNI_SUCCESS;
-        }
-    } else {
-        ALOGE("%s: set freq failed because either fd/freq is negative,\
-               fd: %d, freq: %d\n", LOG_TAG, fd, freq);
-        err = FM_JNI_FAILURE;
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_FREQ, freq);
     }
-#endif
+    else 
+    {
+        if ((fd >= 0) && (freq > 0)) {
+            err = FmIoctlsInterface :: set_freq(fd, freq);
+            if (err < 0) {
+                ALOGE("%s: set freq failed, freq: %d\n", LOG_TAG, freq);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = FM_JNI_SUCCESS;
+            }
+        } else {
+            ALOGE("%s: set freq failed because either fd/freq is negative,\
+                   fd: %d, freq: %d\n", LOG_TAG, fd, freq);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -807,23 +828,26 @@
 {
     int err;
     ALOGE("id(%x) value: %x\n", id, value);
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->set_fm_ctrl(id, value);
-#else
-    if ((fd >= 0) && (id >= 0)) {
-        err = FmIoctlsInterface :: set_control(fd, id, value);
-        if (err < 0) {
-            ALOGE("%s: set control failed, id: %d\n", LOG_TAG, id);
-            err = FM_JNI_FAILURE;
-        } else {
-            err = FM_JNI_SUCCESS;
-        }
-    } else {
-        ALOGE("%s: set control failed because either fd/id is negavtive,\
-               fd: %d, id: %d\n", LOG_TAG, fd, id);
-        err = FM_JNI_FAILURE;
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->set_fm_ctrl(id, value);
     }
-#endif
+    else
+    {
+        if ((fd >= 0) && (id >= 0)) {
+            err = FmIoctlsInterface :: set_control(fd, id, value);
+            if (err < 0) {
+                ALOGE("%s: set control failed, id: %d\n", LOG_TAG, id);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = FM_JNI_SUCCESS;
+            }
+        } else {
+            ALOGE("%s: set control failed because either fd/id is negavtive,\
+                   fd: %d, id: %d\n", LOG_TAG, fd, id);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -856,29 +880,32 @@
     long val;
 
     ALOGE("id(%x)\n", id);
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->get_fm_ctrl(id, (int *)&val);
-    if (err < 0) {
-        ALOGE("%s: get control failed, id: %d\n", LOG_TAG, id);
-        err = FM_JNI_FAILURE;
-    } else {
-        err = val;
-    }
-#else
-    if ((fd >= 0) && (id >= 0)) {
-        err = FmIoctlsInterface :: get_control(fd, id, val);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->get_fm_ctrl(id, (int *)&val);
         if (err < 0) {
             ALOGE("%s: get control failed, id: %d\n", LOG_TAG, id);
             err = FM_JNI_FAILURE;
         } else {
             err = val;
         }
-    } else {
-        ALOGE("%s: get control failed because either fd/id is negavtive,\
-               fd: %d, id: %d\n", LOG_TAG, fd, id);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if ((fd >= 0) && (id >= 0)) {
+            err = FmIoctlsInterface :: get_control(fd, id, val);
+            if (err < 0) {
+                ALOGE("%s: get control failed, id: %d\n", LOG_TAG, id);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = val;
+            }
+        } else {
+            ALOGE("%s: get control failed because either fd/id is negavtive,\
+                   fd: %d, id: %d\n", LOG_TAG, fd, id);
+            err = FM_JNI_FAILURE;
+        }
+    }
 
     return err;
 }
@@ -888,30 +915,33 @@
     (JNIEnv * env, jobject thiz, jint fd, jint dir)
 {
     int err;
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_SEEK, dir);
-    if (err < 0) {
-        ALOGE("%s: search failed, dir: %d\n", LOG_TAG, dir);
-        err = FM_JNI_FAILURE;
-    } else {
-        err = FM_JNI_SUCCESS;
-    }
-#else
-    if ((fd >= 0) && (dir >= 0)) {
-        ALOGD("startSearchNative: Issuing the VIDIOC_S_HW_FREQ_SEEK");
-        err = FmIoctlsInterface :: start_search(fd, dir);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_SEEK, dir);
         if (err < 0) {
             ALOGE("%s: search failed, dir: %d\n", LOG_TAG, dir);
             err = FM_JNI_FAILURE;
         } else {
             err = FM_JNI_SUCCESS;
         }
-    } else {
-        ALOGE("%s: search failed because either fd/dir is negative,\
-               fd: %d, dir: %d\n", LOG_TAG, fd, dir);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if ((fd >= 0) && (dir >= 0)) {
+            ALOGD("startSearchNative: Issuing the VIDIOC_S_HW_FREQ_SEEK");
+            err = FmIoctlsInterface :: start_search(fd, dir);
+            if (err < 0) {
+                ALOGE("%s: search failed, dir: %d\n", LOG_TAG, dir);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = FM_JNI_SUCCESS;
+            }
+        } else {
+            ALOGE("%s: search failed because either fd/dir is negative,\
+                   fd: %d, dir: %d\n", LOG_TAG, fd, dir);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -921,29 +951,32 @@
 {
     int err;
 
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_SRCHON, 0);
-    if (err < 0) {
-        ALOGE("%s: cancel search failed\n", LOG_TAG);
-        err = FM_JNI_FAILURE;
-    } else {
-        err = FM_JNI_SUCCESS;
-    }
-#else
-    if (fd >= 0) {
-        err = FmIoctlsInterface :: set_control(fd, V4L2_CID_PRV_SRCHON, 0);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_SRCHON, 0);
         if (err < 0) {
             ALOGE("%s: cancel search failed\n", LOG_TAG);
             err = FM_JNI_FAILURE;
         } else {
             err = FM_JNI_SUCCESS;
         }
-    } else {
-        ALOGE("%s: cancel search failed because fd is negative, fd: %d\n",
-               LOG_TAG, fd);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if (fd >= 0) {
+            err = FmIoctlsInterface :: set_control(fd, V4L2_CID_PRV_SRCHON, 0);
+            if (err < 0) {
+                ALOGE("%s: cancel search failed\n", LOG_TAG);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = FM_JNI_SUCCESS;
+            }
+        } else {
+            ALOGE("%s: cancel search failed because fd is negative, fd: %d\n",
+                   LOG_TAG, fd);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -954,29 +987,32 @@
     int err;
     long rmssi;
 
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_RMSSI, (int *)&rmssi);
-    if (err < 0) {
-        ALOGE("%s: Get Rssi failed", LOG_TAG);
-        err = FM_JNI_FAILURE;
-    } else {
-        err = FM_JNI_SUCCESS;
-    }
-#else
-    if (fd >= 0) {
-        err = FmIoctlsInterface :: get_rmssi(fd, rmssi);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_RMSSI, (int *)&rmssi);
         if (err < 0) {
-            ALOGE("%s: get rmssi failed\n", LOG_TAG);
+            ALOGE("%s: Get Rssi failed", LOG_TAG);
             err = FM_JNI_FAILURE;
         } else {
-            err = rmssi;
+            err = FM_JNI_SUCCESS;
         }
-    } else {
-        ALOGE("%s: get rmssi failed because fd is negative, fd: %d\n",
-               LOG_TAG, fd);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if (fd >= 0) {
+            err = FmIoctlsInterface :: get_rmssi(fd, rmssi);
+            if (err < 0) {
+                ALOGE("%s: get rmssi failed\n", LOG_TAG);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = rmssi;
+            }
+        } else {
+            ALOGE("%s: get rmssi failed because fd is negative, fd: %d\n",
+                   LOG_TAG, fd);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -985,36 +1021,39 @@
     (JNIEnv * env, jobject thiz, jint fd, jint low, jint high)
 {
     int err;
-#ifdef FM_SOC_TYPE_CHEROKEE
-    err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_UPPER_BAND, high);
-    if (err < 0) {
-        ALOGE("%s: set band failed, high: %d\n", LOG_TAG, high);
-        err = FM_JNI_FAILURE;
-        return err;
-    }
-    err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_LOWER_BAND, low);
-    if (err < 0) {
-        ALOGE("%s: set band failed, low: %d\n", LOG_TAG, low);
-        err = FM_JNI_FAILURE;
-    } else {
-        err = FM_JNI_SUCCESS;
-    }
-#else
-    if ((fd >= 0) && (low >= 0) && (high >= 0)) {
-        err = FmIoctlsInterface :: set_band(fd, low, high);
+    if (is_soc_cherokee())
+    {
+        err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_UPPER_BAND, high);
         if (err < 0) {
-            ALOGE("%s: set band failed, low: %d, high: %d\n",
-                   LOG_TAG, low, high);
+            ALOGE("%s: set band failed, high: %d\n", LOG_TAG, high);
+            err = FM_JNI_FAILURE;
+            return err;
+        }
+        err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_LOWER_BAND, low);
+        if (err < 0) {
+            ALOGE("%s: set band failed, low: %d\n", LOG_TAG, low);
             err = FM_JNI_FAILURE;
         } else {
             err = FM_JNI_SUCCESS;
         }
-    } else {
-        ALOGE("%s: set band failed because either fd/band is negative,\
-               fd: %d, low: %d, high: %d\n", LOG_TAG, fd, low, high);
-        err = FM_JNI_FAILURE;
     }
-#endif
+    else
+    {
+        if ((fd >= 0) && (low >= 0) && (high >= 0)) {
+            err = FmIoctlsInterface :: set_band(fd, low, high);
+            if (err < 0) {
+                ALOGE("%s: set band failed, low: %d, high: %d\n",
+                       LOG_TAG, low, high);
+                err = FM_JNI_FAILURE;
+            } else {
+                err = FM_JNI_SUCCESS;
+            }
+        } else {
+            ALOGE("%s: set band failed because either fd/band is negative,\
+                   fd: %d, low: %d, high: %d\n", LOG_TAG, fd, low, high);
+            err = FM_JNI_FAILURE;
+        }
+    }
     return err;
 }
 
@@ -1024,7 +1063,8 @@
 {
     int err;
     ULINT freq;
-#ifdef FM_SOC_TYPE_CHEROKEE
+if (is_soc_cherokee())
+{
     err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_LOWER_BAND, (int *)&freq);
     if (err < 0) {
         ALOGE("%s: get lower band failed\n", LOG_TAG);
@@ -1033,7 +1073,9 @@
         err = freq;
     }
     return err;
-#endif
+}
+else 
+{
     if (fd >= 0) {
         err = FmIoctlsInterface :: get_lowerband_limit(fd, freq);
         if (err < 0) {
@@ -1047,7 +1089,7 @@
                fd: %d\n", LOG_TAG, fd);
         err = FM_JNI_FAILURE;
     }
-
+}
     return err;
 }
 
@@ -1057,8 +1099,8 @@
 {
     int err;
     ULINT freq;
-#ifdef FM_SOC_TYPE_CHEROKEE
-
+if (is_soc_cherokee())
+{
     err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_UPPER_BAND, (int *)&freq);
     if (err < 0) {
         ALOGE("%s: get upper band failed\n", LOG_TAG);
@@ -1067,7 +1109,9 @@
         err = freq;
     }
     return err;
-#endif
+}
+else
+{
     if (fd >= 0) {
         err = FmIoctlsInterface :: get_upperband_limit(fd, freq);
         if (err < 0) {
@@ -1081,6 +1125,7 @@
                fd: %d\n", LOG_TAG, fd);
         err = FM_JNI_FAILURE;
     }
+}
     return err;
 }
 
@@ -1089,7 +1134,8 @@
 {
 
     int err;
-#ifdef FM_SOC_TYPE_CHEROKEE
+if (is_soc_cherokee())
+{
     err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_IRIS_AUDIO_MODE, val);
     if (err < 0) {
         ALOGE("%s: set audio mode failed\n", LOG_TAG);
@@ -1098,7 +1144,9 @@
         err = FM_JNI_SUCCESS;
     }
     return err;
-#endif
+}
+else
+{
     if (fd >= 0) {
         err = FmIoctlsInterface :: set_audio_mode(fd, (enum AUDIO_MODE)val);
         if (err < 0) {
@@ -1109,6 +1157,7 @@
     } else {
         err = FM_JNI_FAILURE;
     }
+}
     return err;
 }
 
@@ -1593,9 +1642,9 @@
 {
     ALOGD("%s: val = %d\n", __func__, val);
     int err = JNI_ERR;
-#ifdef FM_SOC_TYPE_CHEROKEE
+if (is_soc_cherokee()) {
     err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_ENABLE_SLIMBUS, val);
-#endif
+}
     return err;
 }
 
@@ -1604,16 +1653,15 @@
 {
     ALOGD("%s: val = %d\n", __func__, val);
     int err = JNI_ERR;
-#ifdef FM_SOC_TYPE_CHEROKEE
+if (is_soc_cherokee()) {
     err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_SOFT_MUTE, val);
-#endif
+}
     return err;
 }
 
 static void classInitNative(JNIEnv* env, jclass clazz) {
 
     ALOGI("ClassInit native called \n");
-#ifdef FM_SOC_TYPE_CHEROKEE
     jclass dataClass = env->FindClass("qcom/fmradio/FmReceiverJNI");
     javaClassRef = (jclass) env->NewGlobalRef(dataClass);
     lib_handle = dlopen(FM_LIBRARY_NAME, RTLD_NOW);
@@ -1662,12 +1710,11 @@
     if (lib_handle)
         dlclose(lib_handle);
     lib_handle = NULL;
-#endif
 }
 
 static void initNative(JNIEnv *env, jobject object) {
 
-#ifdef FM_SOC_TYPE_CHEROKEE
+if (is_soc_cherokee()) {
     int status;
     ALOGI("Init native called \n");
 
@@ -1681,17 +1728,17 @@
         ALOGI("***** FM HAL Initialization complete *****\n");
     }
     mCallbacksObj = env->NewGlobalRef(object);
-#endif
+}
 }
 
 static void cleanupNative(JNIEnv *env, jobject object) {
 
-#ifdef FM_SOC_TYPE_CHEROKEE
-    if (mCallbacksObj != NULL) {
-        env->DeleteGlobalRef(mCallbacksObj);
-        mCallbacksObj = NULL;
+    if (is_soc_cherokee()) {
+        if (mCallbacksObj != NULL) {
+            env->DeleteGlobalRef(mCallbacksObj);
+            mCallbacksObj = NULL;
+        }
     }
-#endif
 }
 /*
  * JNI registration.
diff --git a/jni/init.qti.fm.rc b/jni/init.qti.fm.rc
deleted file mode 100644
index 5d52259..0000000
--- a/jni/init.qti.fm.rc
+++ /dev/null
@@ -1,6 +0,0 @@
-service fm_dl /vendor/bin/init.qti.fm.sh
-    class late_start
-    user system
-    group system
-    disabled
-    oneshot
diff --git a/jni/init.qti.fm.sh b/jni/init.qti.fm.sh
deleted file mode 100644
index e484753..0000000
--- a/jni/init.qti.fm.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/vendor/bin/sh
-# Copyright (c) 2009-2011, 2015, 2017 The Linux Foundation. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in the
-#       documentation and/or other materials provided with the distribution.
-#     * Neither the name of The Linux Foundation nor
-#       the names of its contributors may be used to endorse or promote
-#       products derived from this software without specific prior written
-#       permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-setprop hw.fm.init 0
-
-mode=`getprop hw.fm.mode`
-version=199217
-
-LOG_TAG="qti-fm"
-LOG_NAME="${0}:"
-
-loge ()
-{
-  /vendor/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
-}
-
-logi ()
-{
-  /vendor/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
-}
-
-failed ()
-{
-  loge "$1: exit code $2"
-  exit $2
-}
-
-logi "In FM shell Script"
-logi "mode: $mode"
-logi "Version : $version"
-
-#$fm_qsoc_patches <fm_chipVersion> <enable/disable WCM>
-#
-case $mode in
-  "normal")
-        logi "inserting the radio transport module"
-        echo 1 > /sys/module/radio_iris_transport/parameters/fmsmd_set
-        /vendor/bin/fm_qsoc_patches $version 0
-     ;;
-  "wa_enable")
-   /vendor/bin/fm_qsoc_patches $version 1
-     ;;
-  "wa_disable")
-   /vendor/bin/fm_qsoc_patches $version 2
-     ;;
-   *)
-    logi "Shell: Default case"
-    /vendor/bin/fm_qsoc_patches $version 0
-    ;;
-esac
-
-exit_code_fm_qsoc_patches=$?
-
-case $exit_code_fm_qsoc_patches in
-   0)
-    logi "FM QSoC calibration and firmware download succeeded"
-   ;;
-  *)
-    failed "FM QSoC firmware download and/or calibration failed" $exit_code_fm_qsoc_patches
-   ;;
-esac
-
-setprop hw.fm.init 1
-
-exit 0
diff --git a/libfm_jni/Android.mk b/libfm_jni/Android.mk
deleted file mode 100644
index af66eb5..0000000
--- a/libfm_jni/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-    FmIoctlsInterface.cpp \
-    ConfigFmThs.cpp \
-    FmPerformanceParams.cpp \
-    ConfFileParser.cpp \
-    FmRadioController.cpp \
-    LibfmJni.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) \
-    frameworks/base/include/media
-
-LOCAL_SHARED_LIBRARIES := \
-    libcutils \
-    libdl \
-    liblog \
-    libmedia \
-    libnativehelper \
-
-#LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-#LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
-
-LOCAL_MODULE := libfmjni
-#include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/libfm_jni/ConfFileParser.cpp b/libfm_jni/ConfFileParser.cpp
deleted file mode 100644
index 1817ad7..0000000
--- a/libfm_jni/ConfFileParser.cpp
+++ /dev/null
@@ -1,926 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <math.h>
-#include <utils/Log.h>
-#include "ConfFileParser.h"
-
-//declaration of functions only specific to this file
-static char parse_line
-(
-  group_table *key_file,
-  const char *line,
-  char **cur_grp
-);
-
-static char parse_load_frm_fhandler
-(
-  group_table *key_file,
-  FILE *fp
-);
-
-static char line_is_grp
-(
-  group_table *key_file,
-  const char *str,
-  char **cur_grp
-);
-
-static void free_grp_list
-(
-  group *a
-);
-
-static void free_key_list
-(
-  key_value_pair_list *a
-);
-
-static char line_is_key_value_pair
-(
-  group_table *key_file,
-  const char *str,
-  const char *cur_grp
-);
-
-static char line_is_comment
-(
-  const char *str
-);
-
-static char grp_exist
-(
-  const group_table *key_file,
-  const char *new_grp
-);
-
-static char add_grp
-(
-  group_table *key_file,
-  const char *new_grp
-);
-
-static group *alloc_group
-(
-  void
-);
-
-static key_value_pair_list *alloc_key_value_pair
-(
-  void
-);
-
-static char add_key_value_pair
-(
-  group_table *key_file,
-  const char *cur_grp,
-  const char *key,
-  const char *val
-);
-
-
-//Definitions
-void free_strs
-(
-  char **str_array
-)
-{
-  char **str_array_cpy = str_array;
-  if(str_array != NULL) {
-     while(*str_array != NULL) {
-           free(*str_array);
-           str_array++;
-     }
-  }
-  free(str_array_cpy);
-}
-//ToDo: Come up with code hashing
-//function
-unsigned int get_hash_code
-(
-  const char *str
-)
-{
-
-  unsigned len = strlen(str);
-  unsigned int i;
-  unsigned int hash_code = 0;
-
-  for(i = 0; len > 0; len--, i++) {
-      hash_code += (int)((str[i] * pow(2, len))) % INT_MAX;
-      hash_code %= INT_MAX;
-  }
-  return hash_code;
-}
-
-static key_value_pair_list *alloc_key_value_pair
-(
-  void
-)
-{
-  key_value_pair_list *key_list = NULL;
-
-  key_list = (key_value_pair_list *)malloc(
-                                       sizeof(key_value_pair_list));
-  if(key_list != NULL) {
-     key_list->key = NULL;
-     key_list->next = NULL;
-     key_list->value = NULL;
-  }
-  return key_list;
-}
-
-static group * alloc_group
-(
-  void
-)
-{
-  group *grp = NULL;
-  unsigned int i;
-
-  grp = (group *)malloc(sizeof(group));
-  if(grp != NULL) {
-     grp->grp_name = NULL;
-     grp->grp_next = NULL;
-     grp->num_of_keys = 0;
-     grp->keys_hash_size = MAX_UNIQ_KEYS;
-     grp->list = (key_value_pair_list **)malloc
-                    (sizeof(key_value_pair_list *) * grp->keys_hash_size);
-     if(grp->list == NULL) {
-        ALOGE("Could not alloc group\n");
-        free(grp);
-        grp = NULL;
-     }else {
-        for(i = 0; i < grp->keys_hash_size; i++) {
-            grp->list[i] = NULL;
-        }
-     }
-  }
-  return grp;
-}
-
-group_table *get_key_file
-(
-)
-{
-  group_table *t = NULL;
-  unsigned int i;
-
-  t = (group_table *)malloc(sizeof(group_table));
-  if (t != NULL) {
-      t->grps_hash_size = MAX_UNIQ_GRPS;
-      t->num_of_grps = 0;
-      t->grps_hash = (group **)malloc(sizeof(group *)
-                                       * t->grps_hash_size);
-      if (t->grps_hash == NULL) {
-          free(t);
-          return NULL;
-      }
-      for(i = 0; i < t->grps_hash_size; i++) {
-          t->grps_hash[i] = NULL;
-      }
-  }
-  return t;
-}
-
-void free_key_file(
-  group_table *key_file
-)
-{
-  unsigned int i;
-
-  if(key_file != NULL) {
-     if(key_file->grps_hash != NULL) {
-        for(i = 0; i < key_file->grps_hash_size; i++) {
-            free_grp_list(key_file->grps_hash[i]);
-        }
-     }
-     free(key_file->grps_hash);
-     free(key_file);
-  }
-}
-
-static void free_grp_list
-(
-  group *a
-)
-{
-  group *next;
-  unsigned int i;
-
-  while(a != NULL) {
-       next = a->grp_next;
-       if(a->list != NULL) {
-          for(i = 0; i < a->keys_hash_size; i++) {
-              free_key_list(a->list[i]);
-          }
-       }
-       free(a->grp_name);
-       free(a->list);
-       free(a);
-       a = next;
-  }
-}
-
-static void free_key_list
-(
-  key_value_pair_list *a
-)
-{
-  key_value_pair_list *next;
-
-  while(a != NULL) {
-       next = a->next;
-       free(a->key);
-       free(a->value);
-       free(a);
-       a = next;
-  }
-}
-//return all the groups
-//present in the file
-char **get_grps
-(
-  const group_table *key_file
-)
-{
-  char **grps = NULL;
-  unsigned int i = 0;
-  unsigned int j = 0;
-  unsigned int grp_len;
-  group *grp_list;
-
-  if((key_file == NULL)
-     || (key_file->grps_hash == NULL)
-     || (key_file->grps_hash_size == 0)
-     || (key_file->num_of_grps == 0)) {
-     return grps;
-  }
-  grps = (char **)calloc((key_file->num_of_grps + 1),
-                           sizeof(char *));
-  if(grps == NULL) {
-     return grps;
-  }
-  for(i = 0; i < key_file->grps_hash_size; i++) {
-      grp_list = key_file->grps_hash[i];
-      while(grp_list != NULL) {
-            grp_len = strlen(grp_list->grp_name);
-            grps[j] = (char *)malloc(sizeof(char) *
-                                     (grp_len + 1));
-            if(grps[j] == NULL) {
-               free_strs(grps);
-               grps = NULL;
-               return grps;
-            }
-            memcpy(grps[j], grp_list->grp_name,
-                   (grp_len + 1));
-            grp_list = grp_list->grp_next;
-            j++;
-      }
-  }
-  grps[j] = NULL;
-  return grps;
-}
-
-//returns the list of keys
-//associated with group name
-char **get_keys
-(
-  const group_table *key_file,
-  const char *grp_name
-)
-{
-  unsigned int grp_hash_code;
-  unsigned int grp_index;
-  unsigned int num_of_keys;
-  unsigned int i;
-  unsigned int j = 0;
-  unsigned int key_len;
-  group *grp;
-  key_value_pair_list *key_val_list;
-  char **keys = NULL;
-
-  if((key_file == NULL) || (grp_name == NULL)
-     || (key_file->num_of_grps == 0) ||
-     (key_file->grps_hash_size == 0) ||
-     (key_file->grps_hash == NULL) ||
-     (!strcmp(grp_name, ""))) {
-      return keys;
-  }
-  grp_hash_code = get_hash_code(grp_name);
-  grp_index = (grp_hash_code % key_file->grps_hash_size);
-  grp = key_file->grps_hash[grp_index];
-  while(grp != NULL) {
-        if(!strcmp(grp_name, grp->grp_name)) {
-            if((grp->num_of_keys == 0)
-               || (grp->keys_hash_size == 0)
-               || (grp->list == 0)) {
-               return keys;
-            }
-            keys = (char **)calloc((grp->num_of_keys + 1),
-                                   sizeof(char *));
-            if(keys == NULL) {
-                return keys;
-            }
-            for(i = 0; i < grp->keys_hash_size; i++) {
-                key_val_list = grp->list[i];
-                while(key_val_list != NULL) {
-                     key_len = strlen(key_val_list->key);
-                     keys[j] = (char *)malloc(sizeof(char) *
-                                              (key_len + 1));
-                     if(keys[j] == NULL) {
-                         free_strs(keys);
-                         keys = NULL;
-                         return keys;
-                     }
-                     memcpy(keys[j], key_val_list->key,
-                            (key_len + 1));
-                     j++;
-                     key_val_list = key_val_list->next;
-                }
-            }
-            keys[j] = NULL;
-            return keys;
-        }
-        grp = grp->grp_next;
-  }
-  return keys;
-}
-
-char *get_value
-(
-   const group_table *key_file,
-   const char *grp_name,
-   const char *key
-)
-{
-   unsigned int grp_hash_code;
-   unsigned int key_hash_code;
-   unsigned int grp_index;
-   unsigned int key_index;
-   unsigned val_len;
-   char *val = NULL;
-   group *grp;
-   key_value_pair_list *list;
-
-   if((key_file == NULL) || (grp_name == NULL)
-      || (key == NULL) || (key_file->grps_hash == NULL)
-      || (key_file->grps_hash_size == 0) || !strcmp(grp_name, "")
-      ||(!strcmp(key, ""))) {
-       return NULL;
-   }
-   grp_hash_code = get_hash_code(grp_name);
-   key_hash_code = get_hash_code(key);
-   grp_index = (grp_hash_code % key_file->grps_hash_size);
-   grp = key_file->grps_hash[grp_index];
-   while(grp != NULL) {
-         if(!strcmp(grp_name, grp->grp_name) && grp->keys_hash_size
-            && grp->list) {
-            key_index = (key_hash_code % grp->keys_hash_size);
-            list = grp->list[key_index];
-            while((list != NULL) && (strcmp(list->key, key))) {
-                   list = list->next;
-            }
-            if(list != NULL) {
-                val_len = strlen(list->value);
-                val = (char *)malloc(sizeof(char) * (val_len + 1));
-                if(val != NULL) {
-                   memcpy(val, list->value, val_len);
-                   val[val_len] = '\0';
-                }
-            }
-            return val;
-         }
-         grp = grp->grp_next;
-   }
-   return val;
-}
-//open the file,
-//read, parse and load
-//returns PARSE_SUCCESS if successfully
-//loaded else PARSE_FAILED
-char parse_load_file
-(
-  group_table *key_file,
-  const char *file
-)
-{
-  FILE *fp;
-  char ret = FALSE;
-
-  if((file == NULL) || !strcmp(file, "")) {
-     ALOGE("File name is null or empty \n");
-     return ret;
-  }
-
-  fp = fopen(file, "r");
-  if(fp == NULL) {
-     ALOGE("could not open file for read\n");
-     return ret;
-  }
-
-  ret = parse_load_frm_fhandler(key_file, fp);
-  fclose(fp);
-
-  return ret;
-}
-
-//Read block of data from file handler
-//extract each line, check kind of line(comment,
-//group, key value pair)
-static char parse_load_frm_fhandler
-(
-  group_table *key_file,
-  FILE *fp
-)
-{
-  char buf[MAX_LINE_LEN];
-  char ret = TRUE;
-  char *line = NULL;
-  void *new_line;
-  char *cur_grp = NULL;
-  unsigned line_len = 0;
-  unsigned line_allocated = 0;
-  unsigned int bytes_read = 0;
-  unsigned int i;
-  bool has_carriage_rtn = false;
-
-  while((bytes_read = fread(buf, 1, MAX_LINE_LEN, fp))) {
-        for(i = 0; i < bytes_read; i++) {
-            if(line_len == line_allocated) {
-                line_allocated += 25;
-                new_line = realloc(line, line_allocated);
-                if(new_line == NULL) {
-                   ret = FALSE;
-                   ALOGE("memory allocation failed for line\n");
-                   break;
-                }
-                line = (char *)new_line;
-            }
-            if((buf[i] == '\n')) {
-                has_carriage_rtn = false;
-                line[line_len] = '\0';
-                ret = parse_line(key_file, line, &cur_grp);
-                line_len = 0;
-                if(ret == FALSE) {
-                   ALOGE("could not parse the line, line not proper\n");
-                   break;
-                }
-            }else if(buf[i] == '\r') {
-                ALOGE("File has carriage return\n");
-                has_carriage_rtn = true;
-            }else if(has_carriage_rtn) {
-                ALOGE("File format is not proper, no line character\
-                        after carraige return\n");
-                ret = FALSE;
-                break;
-            }else {
-                line[line_len] = buf[i];
-                line_len++;
-            }
-        }
-        if (!ret) {
-            break;
-        }
-  }
-  free(line);
-  free(cur_grp);
-
-  return ret;
-}
-
-//checks whether a line is
-//comment or grp or key pair value
-//and accordingly adds to list
-static char parse_line
-(
-  group_table *key_file,
-  const char *line,
-  char **cur_grp
-)
-{
-  const char *line_begin;
-  char *grp_name;
-  unsigned int len;
-
-  if((line == NULL) || (key_file == NULL)) {
-      ALOGE("key file or line is null\n");
-      return FALSE;
-  }
-
-  for(line_begin = line; isspace(*line_begin);
-          line_begin++);
-
-  if(line_is_comment(line_begin)) {
-      ALOGE("line is comment\n");
-      return TRUE;
-  }else if(line_is_grp(key_file, line_begin, cur_grp)) {
-      ALOGE("line is grp\n");
-      return TRUE;
-  }else if(line_is_key_value_pair(key_file, line_begin, *cur_grp)) {
-      ALOGE("line is key value pair\n");
-      return TRUE;
-  }else {
-     ALOGE("line is neither comment, grp nor key value pair\n");
-     return FALSE;
-  }
-}
-
-static char line_is_comment
-(
-  const char *str
-)
-{
-  if(str == NULL) {
-      return FALSE;
-  }else if(((*str) == '#') || ((*str) == '\0')
-       || ((*str) == '\n')) {
-      return TRUE;
-  }else {
-      ALOGE("line is not comment\n");
-      return FALSE;
-  }
-}
-
-//return true if a group
-//name already exist
-//else false
-static char grp_exist
-(
-  const group_table *key_file,
-  const char *new_grp
-)
-{
-  unsigned hash_code;
-  unsigned int index;
-  group *grp;
-
-  if((key_file == NULL) || (new_grp == NULL)
-     || (!key_file->grps_hash_size)) {
-     return FALSE;
-  }else {
-    hash_code = get_hash_code(new_grp);
-    index = hash_code % key_file->grps_hash_size;
-    grp = key_file->grps_hash[index];
-    while(grp != NULL) {
-          if (!strcmp(grp->grp_name, new_grp))
-              return TRUE;
-          grp = grp->grp_next;
-    }
-    return FALSE;
-  }
-}
-
-//Add a group to group
-//table if it does not exist
-static char add_grp
-(
-  group_table *key_file,
-  const char *new_grp
-)
-{
-  unsigned int hash_code;
-  unsigned int index;
-  unsigned int grp_name_len;
-  group *grp;
-
-  if(!grp_exist(key_file, new_grp)) {
-      if((key_file == NULL) || (new_grp == NULL)
-         || !key_file->grps_hash_size) {
-         return FALSE;
-      }
-      hash_code = get_hash_code(new_grp);
-      ALOGE("group hash code is: %u\n", hash_code);
-      index = hash_code % key_file->grps_hash_size;
-      ALOGE("group index is: %u\n", index);
-      grp = alloc_group();
-      if(grp == NULL) {
-         return FALSE;
-      }
-      grp_name_len = strlen(new_grp);
-      grp->grp_name = (char *)malloc(
-                                  sizeof(char) * (grp_name_len + 1));
-      if(grp->grp_name == NULL) {
-         ALOGE("could not alloc memory for group name\n");
-         ALOGE("Add group failed\n");
-         free_grp_list(grp);
-         return FALSE;
-      }else {
-         memcpy(grp->grp_name, new_grp, (grp_name_len + 1));
-      }
-      grp->grp_next = key_file->grps_hash[index];
-      key_file->grps_hash[index] = grp;
-      key_file->num_of_grps++;
-      return TRUE;
-  }else {
-     return FALSE;
-  }
-}
-
-//checks validity of a group
-//a valid group is
-//inside [] group name must be
-//alphanumeric
-//Example: [grpName]
-static char line_is_grp
-(
-  group_table *key_file,
-  const char *str,
-  char **cur_grp
-)
-{
-  const char *g_start;
-  const char *g_end;
-  char *new_grp;
-  unsigned int grp_len;
-
-  if ((str == NULL) || (key_file == NULL)) {
-      ALOGE("str is null or key file is null\n");
-      return FALSE;
-  }
-  //checks start mark char ']'
-  if(((*str) != '[')) {
-      ALOGE("start mark is not '['\n");
-      return FALSE;
-  }else {
-      str++;
-      g_start = str;
-  }
-  //checks the end char '['
-  while((*str != '\0') && ((*str) != ']')) {
-        str++;
-  }
-  //if end mark group not found
-  if ((*str) != ']') {
-       ALOGE("grp end mark is not '['\n");
-       return FALSE;
-  }else {
-       g_end = (str - 1);
-  }
-
-  str++;
-  //if end mark found checks the rest chars as well
-  //rest chars should be space
-  while(((*str) == ' ') || ((*str) == '\t')) {
-        str++;
-  }
-  if(*str) {
-     ALOGE("after ']' there are some character\n");
-     return FALSE;
-  }
-
-  str = g_start;
-  while((*g_start != '\0') && (g_start != g_end)
-         && isalnum(*g_start)) {
-        g_start++;
-  }
-  if((g_start == g_end) && isalnum(*g_start)) {
-      //look up if already exist
-      //return false else insert the grp in grp table
-      grp_len = (g_end - str + 1);
-      new_grp = (char *)malloc(sizeof(char) * (grp_len + 1));
-      if (new_grp == NULL) {
-          ALOGE("could not alloc memory for new group\n");
-          return FALSE;
-      }
-      memcpy(new_grp, str, grp_len);
-      new_grp[grp_len] = '\0';
-
-      if(add_grp(key_file, new_grp)) {
-          free(*cur_grp);
-         *cur_grp = new_grp;
-         return TRUE;
-      }else {
-         ALOGE("could not add group to group table\n");
-         return FALSE;
-      }
-  }else {
-      return FALSE;
-  }
-}
-
-static char key_exist
-(
-  const group_table *key_file,
-  const char *cur_grp,
-  const char *key
-)
-{
-  unsigned int grp_hash_code;
-  unsigned int key_hash_code;
-  unsigned int grp_index;
-  unsigned int key_index;
-  group *grp = NULL;
-  key_value_pair_list *list = NULL;
-
-  if((key_file != NULL) && (cur_grp != NULL)
-      && (key != NULL) && ((key_file->grps_hash != NULL))
-      && (strcmp(key, ""))) {
-     grp_hash_code = get_hash_code(cur_grp);
-     grp_index = (grp_hash_code % key_file->grps_hash_size);
-     grp = key_file->grps_hash[grp_index];
-     key_hash_code = get_hash_code(key);
-     while((grp != NULL)) {
-           if(!strcmp(cur_grp, grp->grp_name)) {
-              key_index = (key_hash_code % grp->keys_hash_size);
-              if(grp->list)
-                 list = grp->list[key_index];
-              while((list != NULL) && strcmp(key, list->key)) {
-                    list = list->next;
-              }
-              if(list != NULL){
-                  return TRUE;
-              }else{
-                  return FALSE;
-              }
-           }
-           grp = grp->grp_next;
-     }
-     if(!grp) {
-        return TRUE;
-     }else {
-        return FALSE;
-     }
-  }else {
-     return FALSE;
-  }
-}
-
-//checks validity of key
-//a valid key must start in
-//a seperate line and key must
-//be alphanumeric and before '='
-//there must not be any space
-//Example: key=value
-static char line_is_key_value_pair
-(
-  group_table *key_file,
-  const char *str,
-  const char *cur_grp
-)
-{
-  char *equal_start;
-  char *key = NULL;
-  char *val = NULL;
-  unsigned key_len;
-  unsigned val_len;
-
-  if((str == NULL) || (cur_grp == NULL) ||
-     !strcmp(cur_grp, "") || (key_file == NULL)) {
-     ALOGE("line is null or cur group or key file is null or empty\n");
-     return FALSE;
-  }
-  equal_start = strchr(str, '=');
-  key_len = (equal_start - str);
-  if((equal_start == NULL) || (equal_start == str)) {
-     ALOGE("line does not have '=' character or no key\n");
-     return FALSE;
-  }
-  while((str != equal_start) && isalnum(*str))
-        str++;
-  if((str == equal_start)) {
-      key = (char *)malloc(sizeof(char) * (key_len + 1));
-      if(key == NULL) {
-         ALOGE("could not alloc memory for new key\n");
-         return FALSE;
-      }
-      equal_start++;
-      val_len = strlen(equal_start);
-      val = (char *)malloc(sizeof(char) * (val_len + 1));
-      if(val == NULL) {
-         ALOGE("could not alloc memory for value\n");
-         if(key){
-             free(key);
-             key = NULL;
-         }
-         return FALSE;
-      }
-      memcpy(key, (str - key_len), key_len);
-      memcpy(val, equal_start, val_len);
-      key[key_len] = '\0';
-      val[val_len] = '\0';
-      ALOGE("Grp: %s, key: %s, value: %s\n", cur_grp, key, val);
-      return add_key_value_pair(key_file,
-                                 cur_grp, key, val);
-  }else {
-     ALOGE("key name doesnot have alpha numeric char\n");
-     return FALSE;
-  }
-}
-
-static char add_key_value_pair
-(
-  group_table *key_file,
-  const char *cur_grp,
-  const char *key,
-  const char *val
-)
-{
-  unsigned int grp_hash_code;
-  unsigned int key_hash_code;
-  unsigned int grp_index;
-  unsigned int key_index;
-  unsigned key_len, val_len;
-  group *grp = NULL;
-  key_value_pair_list *list = NULL;
-
-  if((key_file != NULL) && (cur_grp != NULL)
-      && (key != NULL) && ((key_file->grps_hash != NULL))
-      && (strcmp(key, ""))) {
-     grp_hash_code = get_hash_code(cur_grp);
-     ALOGE("grp hash code is %u\n", grp_hash_code);
-     grp_index = (grp_hash_code % key_file->grps_hash_size);
-     ALOGE("grp index is %u\n", grp_index);
-     grp = key_file->grps_hash[grp_index];
-     key_hash_code = get_hash_code(key);
-     while((grp != NULL)) {
-           if(!strcmp(cur_grp, grp->grp_name)) {
-              key_index = (key_hash_code % grp->keys_hash_size);
-              if(grp->list) {
-                 list = grp->list[key_index];
-              }else {
-                 ALOGE("group list is null\n");
-                 goto err;
-              }
-              while((list != NULL) && strcmp(key, list->key)) {
-                    list = list->next;
-              }
-              if(list != NULL) {
-                  ALOGE("group already contains the key\n");
-                  goto err;
-              }else{
-                  list = alloc_key_value_pair();
-                  if(list == NULL) {
-                     ALOGE("add key value failed as could not alloc memory for key\
-                            val pair\n");
-                     goto err;
-                  }
-                  key_len = strlen(key);
-                  list->key = (char *)malloc(sizeof(char) *
-                                              (key_len + 1));
-                  if(list->key == NULL) {
-                     ALOGE("could not alloc memory for key\n");
-                     free(list);
-                     goto err;
-                  }
-                  val_len = strlen(val);
-                  list->value = (char *)malloc(sizeof(char) *
-                                                (val_len + 1));
-                  if(!list->value) {
-                      free(list->key);
-                      free(list);
-                      goto err;
-                  }
-                  memcpy(list->key, key, key_len);
-                  memcpy(list->value, val, val_len);
-                  if (key) free((char*)key);
-                  if (val) free((char*)val);
-                  list->key[key_len] = '\0';
-                  list->value[val_len] = '\0';
-                  list->next = grp->list[key_index];
-                  grp->list[key_index] = list;
-                  grp->num_of_keys++;
-                  return TRUE;
-              }
-           }
-           grp = grp->grp_next;
-     }
-     ALOGE("group does not exist\n");
-     goto err;
-  }
-err:
-     if (key) free((char*)key);
-     if (val) free((char*)val);
-     return FALSE;
-}
diff --git a/libfm_jni/ConfFileParser.h b/libfm_jni/ConfFileParser.h
deleted file mode 100644
index 88f67e0..0000000
--- a/libfm_jni/ConfFileParser.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __CONF_FILE_PARSER_H__
-#define __CONF_FILE_PARSER_H__
-
-#define MAX_LINE_LEN 512
-#define MAX_UNIQ_KEYS 5
-#define MAX_UNIQ_GRPS 10
-#define TRUE 1
-#define FALSE 0
-
-struct key_value_pair_list
-{
-   char *key;
-   char *value;
-   key_value_pair_list *next;
-};
-
-struct group
-{
-    char *grp_name;
-    unsigned int num_of_keys;
-    unsigned int keys_hash_size;
-    key_value_pair_list **list;
-    group *grp_next;
-};
-
-struct group_table
-{
-    unsigned int grps_hash_size;
-    unsigned int num_of_grps;
-    group **grps_hash;
-};
-
-enum CONF_PARSE_ERRO_CODE
-{
-  PARSE_SUCCESS,
-  INVALID_FILE_NAME,
-  FILE_OPEN_FAILED,
-  FILE_NOT_PROPER,
-  MEMORY_ALLOC_FAILED,
-  PARSE_FAILED,
-};
-
-unsigned int get_hash_code(const char *str);
-group_table *get_key_file();
-void free_strs(char **str_array);
-void free_key_file(group_table *key_file);
-char parse_load_file(group_table *key_file, const char *file);
-char **get_grps(const group_table *key_file);
-char **get_keys(const group_table *key_file, const char *grp);
-char *get_value(const group_table *key_file, const char *grp,
-                 const char *key);
-
-#endif //__CONF_FILE_PARSER_H__
diff --git a/libfm_jni/ConfigFmThs.cpp b/libfm_jni/ConfigFmThs.cpp
deleted file mode 100644
index dd6b283..0000000
--- a/libfm_jni/ConfigFmThs.cpp
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <cstdlib>
-#include <cstring>
-#include <utils/Log.h>
-#include "ConfigFmThs.h"
-#include "FmPerformanceParams.h"
-#include "FmRadioController.h"
-
-static int compare_name
-(
-   const void *name1, const void *name2
-)
-{
-    char *first = (char *)name1;
-    struct NAME_MAP *second = (struct NAME_MAP *)name2;
-
-    return(strcmp(first, second->name));
-}
-
-ConfigFmThs :: ConfigFmThs
-(
-)
-{
-    keyfile = NULL;
-}
-
-ConfigFmThs :: ~ConfigFmThs
-(
-)
-{
-   free_key_file(keyfile);
-}
-
-void ConfigFmThs :: set_band_cfgs
-(
-   UINT fd
-)
-{
-    signed char ret = FM_SUCCESS;
-    char **keys;
-    char **keys_cpy;
-    char *key_value;
-    int value;
-    FmPerformanceParams perf_params;
-    struct NAME_MAP *found;
-
-    if(keyfile != NULL) {
-       keys_cpy = keys = get_keys(keyfile, GRPS_MAP[1].name);
-       if(keys != NULL) {
-          while(*keys != NULL) {
-              ALOGE("key found is: %s\n", *keys);
-              found = (NAME_MAP *)bsearch(*keys, BAND_CFG_MAP,
-                          MAX_BAND_PARAMS, sizeof(NAME_MAP), compare_name);
-              if(found != NULL) {
-                 key_value = get_value(keyfile,
-                                     GRPS_MAP[1].name, found->name);
-                 if((key_value != NULL) && strcmp(key_value, "")) {
-                    value = atoi(key_value);
-                    switch(found->num) {
-                    case RADIO_BAND:
-                         ALOGE("RADIO_BAND\n");
-                         if((value >= BAND_87500_108000)
-                             && (value <= BAND_76000_90000)) {
-                             ALOGE("%s:Set band as: %d\n",__func__, value);
-                             ret = perf_params.SetBand(fd, value);
-                             if(ret == FM_FAILURE)
-                                ALOGE("Error in setting band\n");
-                         }
-                         break;
-                    case EMPHASIS:
-                         ALOGE("EMPHASIS\n");
-                         if((value >= DE_EMP75)
-                             && (value <= DE_EMP50)) {
-                             ALOGE("%s:Set Emphasis as: %d\n",__func__, value);
-                             ret = perf_params.SetEmphsis(fd, value);
-                             if(ret == FM_FAILURE)
-                                ALOGE("Error in setting Emphasis\n");
-                         }
-                         break;
-                    case CHANNEL_SPACING:
-                         ALOGE("CHANNEL_SPACING\n");
-                         if((value >= CHAN_SPACE_200)
-                             && (value <= CHAN_SPACE_50)) {
-                             ALOGE("%s:Set CH space as: %d\n",__func__, value);
-                             ret = perf_params.SetChannelSpacing(fd, value);
-                             if(ret == FM_FAILURE)
-                                ALOGE("Error in setting channel spacing\n");
-                         }
-                         break;
-                   }
-                 }else {
-                   ALOGE("key_val for key: %s is empty\n",
-                             *keys);
-                 }
-                 free(key_value);
-              }
-              keys++;
-          }
-       }else {
-          ALOGE("No of keys found is zero\n");
-       }
-       free_strs(keys_cpy);
-    }else {
-       ALOGE("key file is null\n");
-    }
-}
-
-void ConfigFmThs :: set_af_ths
-(
-   UINT fd
-)
-{
-    signed char ret = FM_SUCCESS;
-    char **keys;
-    char **keys_cpy;
-    char *key_value;
-    int value;
-    FmPerformanceParams perf_params;
-    struct NAME_MAP *found;
-
-    if(keyfile != NULL) {
-       keys_cpy = keys = get_keys(keyfile, GRPS_MAP[0].name);
-       if(keys != NULL) {
-          while(*keys != NULL) {
-              ALOGE("key found is: %s\n", *keys);
-              found = (NAME_MAP *)bsearch(*keys, AF_PARAMS_MAP,
-                          MAX_AF_PARAMS, sizeof(NAME_MAP), compare_name);
-              if(found != NULL) {
-                 key_value = get_value(keyfile,
-                                     GRPS_MAP[0].name, found->name);
-                 if((key_value != NULL) && strcmp(key_value, "")) {
-                    value = atoi(key_value);
-                    switch(found->num) {
-                    case AF_RMSSI_TH:
-                         if((value >= AF_RMSSI_TH_MIN)
-                             && (value <= AF_RMSSI_TH_MAX)) {
-                             ALOGE("Set af rmssi th: %d\n", value);
-                             ret = perf_params.SetAfRmssiTh(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting Af Rmssi th\n");
-                                break;
-                             }
-                             unsigned short th;
-                             ret = perf_params.GetAfRmssiTh(fd, th);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read af rmssith: %hd\n", th);
-                             }else {
-                                ALOGE("Error in reading Af Rmssi th\n");
-                             }
-                         }
-                         break;
-                    case AF_RMSSI_SAMPLES:
-                         if((value >= AF_RMSSI_SAMPLES_MIN)
-                             && (value <= AF_RMSSI_SAMPLES_MAX)) {
-                             ALOGE("Set af rmssi samples cnt: %d\n", value);
-                             ret = perf_params.SetAfRmssiSamplesCnt(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting af rmssi samples\n");
-                                break;
-                             }
-                             unsigned char cnt;
-                             ret = perf_params.GetAfRmssiSamplesCnt(fd, cnt);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read af rmssi samples cnt: %hhd\n", cnt);
-                             }else {
-                                 ALOGE("Error in reading rmssi samples\n");
-                             }
-                         }
-                         break;
-                    case GOOD_CH_RMSSI_TH:
-                         if((value >= GOOD_CH_RMSSI_TH_MIN)
-                             && (value <= GOOD_CH_RMSSI_TH_MAX)) {
-                             ALOGE("Set Good channle rmssi th: %d\n", value);
-                             ret = perf_params.SetGoodChannelRmssiTh(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting Good channle rmssi th\n");
-                                break;
-                             }
-                             signed char th;
-                             ret = perf_params.GetGoodChannelRmssiTh(fd, th);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read good channel rmssi th: %d\n", th);
-                             }else {
-                                ALOGE("Error in reading Good channle rmssi th\n");
-                             }
-                         }
-                         break;
-                   }
-                 }else {
-                   ALOGE("key_val for key: %s is empty\n",
-                             *keys);
-                 }
-                 free(key_value);
-              }
-              keys++;
-          }
-       }else {
-          ALOGE("No of keys found is zero\n");
-       }
-       free_strs(keys_cpy);
-    }else {
-       ALOGE("key file is null\n");
-    }
-}
-
-void ConfigFmThs :: set_srch_ths
-(
-    UINT fd
-)
-{
-    signed char ret = FM_SUCCESS;
-    char **keys = NULL;
-    char **keys_cpy = NULL;
-    char *key_value = NULL;
-    int value;
-    FmPerformanceParams perf_params;
-    struct NAME_MAP *found = NULL;
-
-    if(keyfile != NULL) {
-       keys_cpy = keys = get_keys(keyfile, GRPS_MAP[3].name);
-       if(keys != NULL) {
-          while(*keys != NULL) {
-              found = (NAME_MAP *)bsearch(*keys, SEACH_PARAMS_MAP,
-                           MAX_SRCH_PARAMS, sizeof(NAME_MAP), compare_name);
-              if(found != NULL) {
-                 key_value = get_value(keyfile, GRPS_MAP[2].name, found->name);
-                 ALOGE("found srch ths: %s: %s\n", found->name, key_value);
-                 if((key_value != NULL) && strcmp(key_value, "")) {
-                    value = atoi(key_value);
-                    switch(found->num) {
-                    case SINR_FIRST_STAGE:
-                         if((value >= SINR_FIRST_STAGE_MIN)
-                             && (value <= SINR_FIRST_STAGE_MAX)) {
-                             ALOGE("Set sinr first stage: %d\n", value);
-                             ret = perf_params.SetSinrFirstStage(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting sinr first stage\n");
-                                break;
-                             }
-                             signed char th;
-                             ret = perf_params.GetSinrFirstStage(fd, th);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read sinr first stage: %d\n", th);
-                             }else {
-                                ALOGE("Error in reading sinr first stage\n");
-                             }
-                         }
-                         break;
-                    case RMSSI_FIRST_STAGE:
-                         if((value >= RMSSI_FIRST_STAGE_MIN)
-                             && (value <= RMSSI_FIRST_STAGE_MAX)) {
-                             ALOGE("Set rmssi first stage: %d\n", value);
-                             ret = perf_params.SetRmssiFirstStage(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting rmssi first stage\n");
-                                break;
-                             }
-                             signed char th;
-                             ret = perf_params.GetRmssiFirstStage(fd, th);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read rmssi first stage: %d\n", th);
-                             }else {
-                                ALOGE("Error in reading rmssi first stage\n");
-                             }
-                         }
-                         break;
-                    case INTF_LOW_TH:
-                         if((value >= INTF_LOW_TH_MIN)
-                             && (value <= INTF_LOW_TH_MAX)) {
-                            ALOGE("Set intf low th: %d\n", value);
-                            ret = perf_params.SetIntfLowTh(fd, value);
-                            if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting intf low th\n");
-                                break;
-                            }
-                            unsigned char th;
-                            ret = perf_params.GetIntfLowTh(fd, th);
-                            if(ret == FM_SUCCESS) {
-                               ALOGE("Read intf low th: %u\n", th);
-                            }else {
-                               ALOGE("Error in reading intf low th\n");
-                            }
-                         }
-                         break;
-                    case INTF_HIGH_TH:
-                         if((value >= INTF_HIGH_TH_MIN)
-                             && (value <= INTF_HIGH_TH_MAX)) {
-                            ALOGE("Set intf high th: %d\n", value);
-                            ret = perf_params.SetIntfHighTh(fd, value);
-                            if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting intf high th\n");
-                                break;
-                            }
-                            unsigned char th;
-                            ret = perf_params.GetIntfHighTh(fd, th);
-                            if(ret == FM_SUCCESS) {
-                               ALOGE("Read intf high th: %u\n", th);
-                            }else {
-                               ALOGE("Error in reading intf high th\n");
-                            }
-                         }
-                         break;
-                    case CF0_TH:
-                         ALOGE("Set cf0 th: %d\n", value);
-                         ret = perf_params.SetCf0Th12(fd, value);
-                         if(ret == FM_FAILURE) {
-                            ALOGE("Error in setting cf0 th\n");
-                            break;
-                         }
-                         int th;
-                         ret = perf_params.GetCf0Th12(fd, th);
-                         if(ret == FM_SUCCESS) {
-                            ALOGE("Read CF012 th: %d\n", th);
-                         }else {
-                            ALOGE("Error in reading cf0 th\n");
-                         }
-                         break;
-                    case SRCH_ALGO_TYPE:
-                         if((value >= SRCH_ALGO_TYPE_MIN)
-                             && (value <= SRCH_ALGO_TYPE_MAX)) {
-                             ALOGE("Set search algo type: %d\n", value);
-                             ret = perf_params.SetSrchAlgoType(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting search algo type\n");
-                                break;
-                             }
-                             unsigned char algo;
-                             ret = perf_params.GetSrchAlgoType(fd, algo);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read algo type: %u\n", algo);
-                             }else {
-                                ALOGE("Error in reading search algo type\n");
-                             }
-                         }
-                         break;
-                    case SINR_SAMPLES:
-                         if((value >= SINR_SAMPLES_CNT_MIN)
-                             && (value <= SINR_SAMPLES_CNT_MAX)) {
-                             ALOGE("Set sinr samples count: %d\n", value);
-                             ret = perf_params.SetSinrSamplesCnt(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting sinr samples count\n");
-                                break;
-                             }
-                             unsigned char cnt;
-                             ret = perf_params.GetSinrSamplesCnt(fd, cnt);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read sinr samples cnt: %u\n", cnt);
-                             }else {
-                                ALOGE("Error in reading sinr samples count\n");
-                             }
-                         }
-                         break;
-                    case SINR:
-                         if((value >= SINR_FINAL_STAGE_MIN)
-                             && (value <= SINR_FINAL_STAGE_MAX)) {
-                             ALOGE("Set final stage sinr: %d\n", value);
-                             ret = perf_params.SetSinrFinalStage(fd, value);
-                             if(ret == FM_FAILURE) {
-                                ALOGE("Error in setting final stage sinr\n");
-                                break;
-                             }
-                             signed char th;
-                             ret = perf_params.GetSinrFinalStage(fd, th);
-                             if(ret == FM_SUCCESS) {
-                                ALOGE("Read final stage sinr: %d\n", th);
-                             }else {
-                                ALOGE("Error in reading final stage sinr\n");
-                             }
-                         }
-                         break;
-                    }
-                 }else {
-                    ALOGE("key_value for key: %s is empty\n",
-                                  *keys);
-                 }
-                 free(key_value);
-              }
-              keys++;
-          }
-       }else {
-          ALOGE("No of keys found is zero\n");
-       }
-       free_strs(keys_cpy);
-    }else {
-       ALOGE("key file is null\n");
-    }
-}
-
-void ConfigFmThs :: set_hybrd_list
-(
-    UINT fd
-)
-{
-    signed char ret = FM_SUCCESS;
-    char **keys = NULL;
-    char **keys_cpy = NULL;
-    char *key_value = NULL;
-    char *freqs = NULL;
-    unsigned int *freqs_array = NULL;
-    signed char *sinrs_array = NULL;
-    char *sinrs = NULL;
-    int value;
-    unsigned int freq_cnt = 0;
-    unsigned int sinr_cnt = 0;
-    FmPerformanceParams perf_params;
-    struct NAME_MAP *found;
-
-    ALOGE("Inside hybrid srch list\n");
-    if(keyfile != NULL) {
-       keys_cpy = keys = get_keys(keyfile, GRPS_MAP[2].name);
-       if(keys != NULL) {
-          while(*keys != NULL) {
-              found = (NAME_MAP *)bsearch(*keys, HYBRD_SRCH_MAP,
-                           MAX_HYBRID_SRCH_PARAMS, sizeof(NAME_MAP), compare_name);
-              if(found != NULL) {
-                 key_value = get_value(keyfile, GRPS_MAP[1].name, found->name);
-                 if((key_value != NULL) && strcmp(key_value, "")) {
-                     switch(found->num) {
-                     case FREQ_LIST:
-                          freqs = key_value;
-                          break;
-                     case SINR_LIST:
-                          sinrs = key_value;
-                          break;
-                     default:
-                          free(key_value);
-                          break;
-                     }
-                 }
-              }
-              keys++;
-          }
-          free_strs(keys_cpy);
-       }else {
-          ALOGE("No of keys found is zero\n");
-       }
-    }else {
-       ALOGE("key file is null\n");
-    }
-
-    freq_cnt = extract_comma_sep_freqs(freqs, &freqs_array, ",");
-    sinr_cnt = extract_comma_sep_sinrs(sinrs, &sinrs_array, ",");
-
-    if((freq_cnt == sinr_cnt) && (sinr_cnt > 0)) {
-       perf_params.SetHybridSrchList(fd, freqs_array, sinrs_array, freq_cnt);
-    }
-
-    free(freqs);
-    free(sinrs);
-    free(freqs_array);
-    free(sinrs_array);
-}
-
-unsigned int ConfigFmThs :: extract_comma_sep_freqs
-(
-    char *freqs,
-    unsigned int **freqs_arr,
-    const char *str
-)
-{
-    char *next_freq;
-    char *saveptr;
-    unsigned int freq;
-    unsigned int *freqs_new_arr;
-    unsigned int size = 0;
-    unsigned int len = 0;
-
-    next_freq = strtok_r(freqs, str, &saveptr);
-    while(next_freq != NULL) {
-          freq = atoi(next_freq);
-          ALOGD("HYBRID_SRCH freq: %u\n", freq);
-          if(size == len) {
-             size <<= 1;
-             if(size == 0)
-                size = 1;
-             freqs_new_arr = (unsigned int *)realloc(*freqs_arr,
-                                              size * sizeof(unsigned int));
-             if(freqs_new_arr == NULL) {
-                free(*freqs_arr);
-                *freqs_arr = NULL;
-                break;
-             }
-             *freqs_arr = freqs_new_arr;
-          }
-          (*freqs_arr)[len] = freq;
-          len++;
-          next_freq = strtok_r(NULL, str, &saveptr);
-    }
-    return len;
-}
-
-unsigned int ConfigFmThs :: extract_comma_sep_sinrs
-(
-    char *sinrs,
-    signed char **sinrs_arr,
-    const char *str
-)
-{
-    char *next_sinr;
-    char *saveptr;
-    signed char *sinrs_new_arr;
-    unsigned int size = 0;
-    unsigned int len = 0;
-    signed char sinr;
-
-    next_sinr = strtok_r(sinrs, str, &saveptr);
-    while(next_sinr != NULL) {
-          sinr = atoi(next_sinr);
-          ALOGD("HYBRID_SRCH sinr: %d\n", sinr);
-          if(size == len) {
-             size <<= 1;
-             if(size == 0)
-                size = 1;
-             sinrs_new_arr = (signed char *)realloc(*sinrs_arr,
-                                               size * sizeof(signed char));
-             if(sinrs_new_arr == NULL) {
-                free(*sinrs_arr);
-                *sinrs_arr = NULL;
-                break;
-             }
-             *sinrs_arr = sinrs_new_arr;
-          }
-          (*sinrs_arr)[len] = sinr;
-          len++;
-          next_sinr = strtok_r(NULL, str,&saveptr);
-    }
-    return len;
-}
-
-void  ConfigFmThs :: SetRxSearchAfThs
-(
-    const char *file, UINT fd
-)
-{
-    int index;
-    struct NAME_MAP *found;
-    char **grps = NULL;
-    char **grps_cpy = NULL;
-
-    keyfile = get_key_file();
-
-    ALOGE("file name is: %s\n", file);
-    if(!parse_load_file(keyfile, file)) {
-       ALOGE("Error in loading threshold file\n");
-    }else {
-       grps_cpy = grps = get_grps(keyfile);
-       if(grps != NULL) {
-          while(*grps != NULL) {
-              ALOGE("Search grp: %s\n", *grps);
-              found = (NAME_MAP *)bsearch(*grps, GRPS_MAP, MAX_GRPS,
-                             sizeof(NAME_MAP), compare_name);
-              if(found != NULL) {
-                 ALOGE("Found group: %s\n", found->name);
-                 switch(found->num) {
-                 case AF_THS:
-                      set_af_ths(fd);
-                      break;
-                 case SRCH_THS:
-                      set_srch_ths(fd);
-                      break;
-                 case HYBRD_SRCH_LIST:
-                      set_hybrd_list(fd);
-                      break;
-                 case BAND_CFG:
-                      set_band_cfgs(fd);
-                      break;
-                 }
-              }
-              grps++;
-          }
-       }else {
-          ALOGE("No of groups found is zero\n");
-       }
-       free_strs(grps_cpy);
-    }
-    free_key_file(keyfile);
-    keyfile = NULL;
-}
diff --git a/libfm_jni/ConfigFmThs.h b/libfm_jni/ConfigFmThs.h
deleted file mode 100644
index 19bf86c..0000000
--- a/libfm_jni/ConfigFmThs.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __CONFIG_FM_THS_H__
-#define __CONFIG_FM_THS_H__
-
-#include <cstring>
-#include "FM_Const.h"
-#include "ConfFileParser.h"
-
-#define MAX_GRPS 4
-#define MAX_SRCH_PARAMS 8
-#define MAX_AF_PARAMS 3
-#define MAX_BAND_PARAMS 3
-
-#define SINR_SAMPLES_CNT_MIN 0
-#define SINR_SAMPLES_CNT_MAX 255
-#define SINR_FIRST_STAGE_MIN -128
-#define SINR_FIRST_STAGE_MAX 127
-#define RMSSI_FIRST_STAGE_MIN -128
-#define RMSSI_FIRST_STAGE_MAX 127
-#define INTF_LOW_TH_MIN 0
-#define INTF_LOW_TH_MAX  255
-#define INTF_HIGH_TH_MIN 0
-#define INTF_HIGH_TH_MAX 255
-#define SRCH_ALGO_TYPE_MIN 0
-#define SRCH_ALGO_TYPE_MAX 1
-#define SINR_FINAL_STAGE_MIN -128
-#define SINR_FINAL_STAGE_MAX 127
-
-#define AF_RMSSI_TH_MIN 0
-#define AF_RMSSI_TH_MAX 65535
-#define AF_RMSSI_SAMPLES_MIN 0
-#define AF_RMSSI_SAMPLES_MAX 255
-#define GOOD_CH_RMSSI_TH_MIN -128
-#define GOOD_CH_RMSSI_TH_MAX 127
-#define FM_DE_EMP75  0
-#define FM_DE_EMP50  1
-#define FM_CHSPACE_200_KHZ  0
-#define FM_CHSPACE_100_KHZ  1
-#define FM_CHSPACE_50_KHZ  2
-
-const unsigned char MAX_HYBRID_SRCH_PARAMS = 2;
-
-struct NAME_MAP
-{
-   const char name[50];
-   const int num;
-};
-
-enum PERFORMANCE_GRPS
-{
-    AF_THS,
-    SRCH_THS,
-    HYBRD_SRCH_LIST,
-    BAND_CFG,
-};
-
-enum BAND_CFG_PARAMS
-{
-    RADIO_BAND,
-    EMPHASIS,
-    CHANNEL_SPACING,
-};
-
-enum PERFORMANCE_SRCH_PARAMS
-{
-    SRCH_ALGO_TYPE,
-    CF0_TH,
-    SINR_FIRST_STAGE,
-    SINR,
-    RMSSI_FIRST_STAGE,
-    INTF_LOW_TH,
-    INTF_HIGH_TH,
-    SINR_SAMPLES,
-};
-
-enum PERFORMANCE_AF_PARAMS
-{
-    AF_RMSSI_TH,
-    AF_RMSSI_SAMPLES,
-    GOOD_CH_RMSSI_TH,
-};
-
-enum HYBRID_SRCH_PARAMS
-{
-    FREQ_LIST,
-    SINR_LIST,
-};
-
-//Keep this list in sorted order (ascending order in terms of "name")
-//Don't change the name of GRPS, if changed please also change accordingly
-//file: fm_srch_af_th.conf
-static struct NAME_MAP GRPS_MAP[] =
-{
-   {"AFTHRESHOLDS", AF_THS},
-   {"BANDCONFIG", BAND_CFG},
-   {"HYBRIDSEARCHLIST", HYBRD_SRCH_LIST},
-   {"SEARCHTHRESHOLDS", SRCH_THS},
-};
-
-static struct NAME_MAP BAND_CFG_MAP[] =
-{
-    {"ChSpacing", CHANNEL_SPACING},
-    {"Emphasis", EMPHASIS},
-    {"RadioBand", RADIO_BAND},
-};
-
-//Keep this list in sorted order (ascending order in terms of "name")
-//Don't change the name of SEARCH thresholds,
-//if changed please also change accordingly
-//file: fm_srch_af_th.conf
-static struct NAME_MAP SEACH_PARAMS_MAP[] =
-{
-   {"Cf0Th12", CF0_TH},
-   {"IntfHighTh", INTF_HIGH_TH},
-   {"IntfLowTh", INTF_LOW_TH},
-   {"RmssiFirstStage", RMSSI_FIRST_STAGE},
-   {"SearchAlgoType", SRCH_ALGO_TYPE},
-   {"Sinr", SINR},
-   {"SinrFirstStage", SINR_FIRST_STAGE},
-   {"SinrSamplesCnt", SINR_SAMPLES},
-};
-
-//Keep this list in sorted order (ascending order in terms of "name")
-//Don't change the name of SEARCH thresholds,
-//if changed please also change accordingly
-//file: fm_srch_af_th.conf
-static struct NAME_MAP AF_PARAMS_MAP[] =
-{
-   {"AfRmssiSamplesCnt", AF_RMSSI_SAMPLES},
-   {"AfRmssiTh", AF_RMSSI_TH},
-   {"GoodChRmssiTh", GOOD_CH_RMSSI_TH},
-};
-
-static struct NAME_MAP HYBRD_SRCH_MAP[] =
-{
-   {"Freqs", FREQ_LIST},
-   {"Sinrs", SINR_LIST},
-};
-
-class ConfigFmThs {
-   private:
-          group_table *keyfile;
-          void set_srch_ths(UINT fd);
-          void set_af_ths(UINT fd);
-          unsigned int extract_comma_sep_freqs(char *freqs, unsigned int **freqs_arr, const char *str);
-          unsigned int extract_comma_sep_sinrs(char *sinrs, signed char **sinrs_arr, const char *str);
-          void set_hybrd_list(UINT fd);
-          void set_band_cfgs(UINT fd);
-   public:
-          ConfigFmThs();
-          ~ConfigFmThs();
-          void SetRxSearchAfThs(const char *file, UINT fd);
-};
-
-#endif //__CONFIG_FM_THS_H__
diff --git a/libfm_jni/FM_Const.h b/libfm_jni/FM_Const.h
deleted file mode 100644
index b0cc684..0000000
--- a/libfm_jni/FM_Const.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __FM_CONST_H__
-#define __FM_CONST_H__
-
-//return related
-#define IOCTL_SUCC 0
-#define FM_SUCCESS 0
-#define FM_FAILURE -1
-#define PROP_SET_SUCC 0
-
-#define MAX_VER_STR_LEN 40
-#define INIT_LOOP_CNT 45
-
-//Time in us
-#define INIT_WAIT_TIMEOUT 200000
-#define RDS_AVL_INT_WAIT_TIMEOUT 200000
-//Time in secs
-#define READY_EVENT_TIMEOUT 5
-#define SCAN_COMPL_TIMEOUT 1280
-#define TUNE_EVENT_TIMEOUT 2
-#define SEEK_COMPL_TIMEOUT 60
-#define FM_SCAN_CH_SIZE_MAX 25
-
-#define TUNE_MULT 16
-#define CAL_DATA_SIZE 23
-#define STD_BUF_SIZE 256
-
-//RDS GROUPS
-#define GRP_3A 64
-
-//data related to enabling various
-//rds data RT, PS, AF LIST, AF JMP
-#define RDS_GRP_RT_EN 1
-#define RDS_GRP_PS_EN 2
-#define RDS_AF_JMP_LIST_EN 8
-#define RDS_GRP_AFJMP_EN 16
-
-//Data for PS received
-#define MAX_PS_LEN 8
-#define PS_STR_NUM_IND 0
-#define PS_DATA_OFFSET_IND 5
-
-//RT related
-#define MAX_RT_LEN 64
-#define RT_LEN_IND 0
-#define RT_DATA_OFFSET_IND 5
-#define RT_A_B_FLAG_IND 4
-
-//ERT related
-#define ERT_LEN_IND 0
-#define ERT_DATA_OFFSET_IND 3
-
-//Common to RT, PS
-#define FIRST_CTRL_CHAR 0
-#define LAST_CTRL_CHAR 31
-#define FIRST_NON_PRNT_CHAR  127
-#define SPACE_CHAR 32
-
-//RT PLUS related constanst
-#define RT_OR_ERT_IND 1
-#define RT_PLUS_TAGS_NUM_IND 0
-#define MAX_RT_PLUS_TAGS 2
-#define TAGS_DATA_BEGIN_OFFSET 4
-#define ITEM_TOGGLE_IND 2
-#define ITEM_RUNNING_IND 3
-#define DUMMY_TAG_CODE 0
-
-#define FM_RX_RDS_GRP_RT_EBL   1
-#define FM_RX_RDS_GRP_PS_EBL   2
-#define FM_RX_RDS_GRP_AF_EBL 4
-#define FM_RX_RDS_GRP_PS_SIMPLE_EBL 16
-
-#define FREQ_MULT 1000
-#define HYBRID_SRCH_DATA_LEN 3
-#define HYBRID_SRCH_DATA_INDEX 3
-#define HYBRID_SRCH_MODE 0x40
-#define STARTING_FREQ 76000
-#define FREQ_MULTIPLEX 50
-#define NO_OF_BYTES_EACH_FREQ 2
-#define EXTRACT_FIRST_BYTE 0x03
-#define SRCH_DIV 100
-#define AF_SIZE_IDX 6
-#define NO_OF_BYTES_AF 4
-#define MAX_AF_LIST_SIZE 25
-
-typedef  unsigned int UINT;
-typedef  unsigned long ULINT;
-
-//STRING LITERALS
-const char *const FM_MODE_PROP = "hw.fm.mode";
-const char *const FM_VERSION_PROP = "hw.fm.version";
-const char *const FM_INIT_PROP = "hw.fm.init";
-const char *const SCRIPT_START_PROP = "ctl.start";
-const char *const FM_SOC_DL_SCRIPT = "fm_dl";
-const char *const SCRIPT_STOP_PROP = "ctl.stOP";
-const char *const CALIB_DATA_NAME = "/data/misc/fm/Riva_fm_cal";
-const char *const SOC_PATCH_DL_SCRPT = "fm_dl";
-const char *const FM_DEVICE_PATH = "/dev/radio0";
-const char *const FM_PERFORMANCE_PARAMS = "/etc/fm/fm_srch_af_th.conf";
-
-const UINT V4L2_CTRL_CLASS_USER = 0x00980000;
-const UINT V4L2_CID_BASE = (V4L2_CTRL_CLASS_USER | 0x900);
-const UINT V4L2_CID_AUDIO_MUTE  = (V4L2_CID_BASE + 9);
-const UINT SEARCH_DWELL_TIME = 2;
-const UINT SEEK_DWELL_TIME = 0;
-
-//BAND LIMITS
-const UINT US_BAND_LOW = 87500;
-const UINT US_BAND_HIGH = 108000;
-const UINT EU_BAND_LOW = 87500;
-const UINT EU_BAND_HIGH = 108000;
-const UINT JAP_BAND_STD_LOW = 76000;
-const UINT JAP_BAND_STD_HIGH = 90000;
-const UINT JAP_BAND_WIDE_LOW = 90000;
-const UINT JAP_BAND_WIDE_HIGH = 108000;
-const UINT USR_DEF_BAND_LOW = 87500;
-const UINT USR_DEF_BAND_HIGH = 108000;
-const UINT FM_RX_SRCHLIST_MAX_STATIONS =20;
-
-//RDS standard type
-enum RDS_STD
-{
-    RBDS,
-    RDS,
-    NO_RDS_RBDS,
-};
-
-enum DE_EMPHASIS
-{
-    DE_EMP75,
-    DE_EMP50,
-};
-
-//Band Type
-enum FM_REGION
-{
-    BAND_87500_108000 = 1,
-    BAND_76000_108000,
-    BAND_76000_90000,
-};
-
-enum FM_AUDIO_PATH
-{
-    AUDIO_DIGITAL_PATH,
-    AUDIO_ANALOG_PATH,
-};
-
-enum FM_DEVICE
-{
-    FM_DEV_NONE,
-    FM_RX,
-    FM_TX,
-};
-
-enum fm_rds_onoff {
-    FM_RDS_ON,
-    FM_RDS_OFF,
-    FM_MAX
-};
-
-typedef enum {
-    FM_LONG_ANA = 0,
-    FM_SHORT_ANA
-} fm_antenna_type;
-
-enum BUFF_INDEXES
-{
-    STATION_LIST_IND,
-    EVENT_IND,
-    RT_IND,
-    PS_IND,
-    AF_LIST_IND = PS_IND + 2,
-    RT_PLUS_IND = 11,
-    ERT_IND,
-};
-
-typedef enum {
-    RDS_EVT_UPDATE         = 0x0001,
-    RDS_EVT_PI_UPDATE      = 0x0002,
-    RDS_EVT_PTY_UPDATE     = 0x0004,
-    RDS_EVT_PS_UPDATE      = 0x0008,
-    RDS_EVT_RT_UPDATE      = 0x0040,
-    RDS_EVT_AF_JUMP        = 0x0080,
-    RDS_EVT_AF_LIST        = 0x0100,
-    RDS_EVT_AF_LIST_UPDATE = 0x0200,
-    RDS_EVT_RDS_AVL        = 0x2000,
-    RDS_EVT_RDS_NOT_AVL    = 0x4000,
-} RdsEvts;
-
-enum SEARCH_MODE
-{
-    SEEK_MODE,
-    SCAN_MODE,
-    SRCHLIST_MODE_STRONG,
-    SRCHLIST_MODE_WEAK,
-    SRCHRDS_MODE_SEEK_PTY,
-    SRCHRDS_MODE_SCAN_PTY,
-    SRCHRDS_MODE_SEEK_PI,
-    SRCHRDS_MODE_SEEK_AF,
-    SRCHLIST_MODE_STRONGEST,
-    SRCHLIST_MODE_WEAKEST,
-};
-
-enum SEARCH_DIR
-{
-    SEARCH_DOWN,
-    SEARCH_UP,
-};
-
-//CHANNEL SPACING for samsung
-enum SS_CHAN_SPACING
-{
-    SS_CHAN_SPACE_200 = 20,
-    SS_CHAN_SPACE_100 = 10,
-    SS_CHAN_SPACE_50 = 5,
-};
-
-enum CHAN_SPACING
-{
-    CHAN_SPACE_200,
-    CHAN_SPACE_100,
-    CHAN_SPACE_50,
-};
-
-enum AUDIO_MODE
-{
-    MONO,
-    STEREO,
-};
-
-//HARD MUTE MODE
-enum HARD_MUTE_MODE
-{
-    UNMUTE_L_R_CHAN,
-    MUTE_L_CHAN,
-    MUTE_R_CHAN,
-    MUTE_L_R_CHAN,
-};
-
-//SOFT MUTE STATES
-enum SOFT_MUTE_MODE
-{
-    SMUTE_DISABLED,
-    SMUTE_ENABLED,
-};
-
-//FM EVENTS FROM KERNEL
-enum FM_EVENTS
-{
-    READY_EVENT,
-    TUNE_EVENT,
-    SEEK_COMPLETE_EVENT,
-    SCAN_NEXT_EVENT,
-    RAW_RDS_EVENT,
-    RT_EVENT,
-    PS_EVENT,
-    ERROR_EVENT,
-    BELOW_TH_EVENT,
-    ABOVE_TH_EVENT,
-    STEREO_EVENT,
-    MONO_EVENT,
-    RDS_AVAL_EVENT,
-    RDS_NOT_AVAL_EVENT,
-    SRCH_LIST_EVENT,
-    AF_LIST_EVENT,
-    DISABLED_EVENT = 18,
-    RDS_GRP_MASK_REQ_EVENT,
-    RT_PLUS_EVENT,
-    ERT_EVENT,
-    AF_JMP_EVENT,
-};
-
-//FM STATES
-enum fm_states
-{
-    FM_OFF,
-    FM_OFF_IN_PROGRESS,
-    FM_ON_IN_PROGRESS,
-    FM_ON,
-    FM_TUNE_IN_PROGRESS,
-    SEEK_IN_PROGRESS,
-    SCAN_IN_PROGRESS,
-};
-
-//V4L2 CONTROLS FOR FM DRIVER
-enum FM_V4L2_PRV_CONTROLS
-{
-    V4L2_CID_PRV_BASE = 0x8000000,
-    V4L2_CID_PRV_SRCHMODE,
-    V4L2_CID_PRV_SCANDWELL,
-    V4L2_CID_PRV_SRCHON,
-    V4L2_CID_PRV_STATE,
-    V4L2_CID_PRV_TRANSMIT_MODE,
-    V4L2_CID_PRV_RDSGROUP_MASK,
-    V4L2_CID_PRV_REGION,
-    V4L2_CID_PRV_SIGNAL_TH,
-    V4L2_CID_PRV_SRCH_PTY,
-    V4L2_CID_PRV_SRCH_PI,
-    V4L2_CID_PRV_SRCH_CNT,
-    V4L2_CID_PRV_EMPHASIS,
-    V4L2_CID_PRV_RDS_STD,
-    V4L2_CID_PRV_CHAN_SPACING,
-    V4L2_CID_PRV_RDSON,
-    V4L2_CID_PRV_RDSGROUP_PROC,
-    V4L2_CID_PRV_LP_MODE,
-    V4L2_CID_PRV_ANTENNA,
-    V4L2_CID_PRV_INTDET = V4L2_CID_PRV_BASE + 25,
-    V4L2_CID_PRV_AF_JUMP = V4L2_CID_PRV_BASE + 27,
-    V4L2_CID_PRV_SOFT_MUTE = V4L2_CID_PRV_BASE + 30,
-    V4L2_CID_PRV_AUDIO_PATH = V4L2_CID_PRV_BASE + 41,
-    V4L2_CID_PRV_SINR = V4L2_CID_PRV_BASE + 44,
-    V4L2_CID_PRV_ON_CHANNEL_THRESHOLD = V4L2_CID_PRV_BASE + 0x2D,
-    V4L2_CID_PRV_OFF_CHANNEL_THRESHOLD,
-    V4L2_CID_PRV_SINR_THRESHOLD,
-    V4L2_CID_PRV_SINR_SAMPLES,
-    V4L2_CID_PRV_SPUR_FREQ,
-    V4L2_CID_PRV_SPUR_FREQ_RMSSI,
-    V4L2_CID_PRV_SPUR_SELECTION,
-    V4L2_CID_PRV_AF_RMSSI_TH = V4L2_CID_PRV_BASE + 0x36,
-    V4L2_CID_PRV_AF_RMSSI_SAMPLES,
-    V4L2_CID_PRV_GOOD_CH_RMSSI_TH,
-    V4L2_CID_PRV_SRCHALGOTYPE,
-    V4L2_CID_PRV_CF0TH12,
-    V4L2_CID_PRV_SINRFIRSTSTAGE,
-    V4L2_CID_PRV_RMSSIFIRSTSTAGE,
-    V4L2_CID_PRV_SOFT_MUTE_TH,
-    V4L2_CID_PRV_IRIS_RDSGRP_RT,
-    V4L2_CID_PRV_IRIS_RDSGRP_PS_SIMPLE,
-    V4L2_CID_PRV_IRIS_BLEND_SINRHI,
-    V4L2_CID_PRV_IRIS_BLEND_RMSSIHI,
-    V4L2_CID_PRV_IRIS_RDSGRP_AFLIST,
-    V4L2_CID_PRV_IRIS_RDSGRP_ERT,
-    V4L2_CID_PRV_IRIS_RDSGRP_RT_PLUS,
-    V4L2_CID_PRV_IRIS_RDSGRP_3A,
-
-    V4L2_CID_PRV_IRIS_READ_DEFAULT = V4L2_CTRL_CLASS_USER + 0x928,
-    V4L2_CID_PRV_IRIS_WRITE_DEFAULT,
-    V4L2_CID_PRV_SET_CALIBRATION = V4L2_CTRL_CLASS_USER + 0x92A,
-};
-#endif
diff --git a/libfm_jni/FmIoctlsInterface.cpp b/libfm_jni/FmIoctlsInterface.cpp
deleted file mode 100644
index fbe035c..0000000
--- a/libfm_jni/FmIoctlsInterface.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "FmIoctlsInterface.h"
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <fcntl.h>
-#include <cutils/properties.h>
-#include <sys/ioctl.h>
-#include <linux/videodev2.h>
-#include <math.h>
-#include <utils/Log.h>
-
-int FmIoctlsInterface :: start_fm_patch_dl
-(
-    UINT fd
-)
-{
-    int ret;
-    int init_success = 0;
-    char versionStr[MAX_VER_STR_LEN] = {'\0'};
-    char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
-    struct v4l2_capability cap;
-
-    ALOGE("start_fm_patch_dl = %d\n",fd);
-    ret = ioctl(fd, VIDIOC_QUERYCAP, &cap);
-    ALOGE("executed cmd\n");
-    if(ret == IOCTL_SUCC) {
-        ret = snprintf(versionStr, MAX_VER_STR_LEN, "%d", cap.version);
-        if(ret >= MAX_VER_STR_LEN) {
-            return FM_FAILURE;
-        }else {
-            ret = property_set(FM_VERSION_PROP, versionStr);
-            ALOGE("set versionStr done");
-            if(ret != PROP_SET_SUCC)
-               return FM_FAILURE;
-            ret = property_set(FM_MODE_PROP, "normal");
-            ALOGE("set FM_MODE_PROP done");
-            if(ret != PROP_SET_SUCC)
-               return FM_FAILURE;
-            ret = property_set(FM_INIT_PROP, "0");
-            ALOGE("set FM_INIT_PROP done");
-            if(ret != PROP_SET_SUCC)
-               return FM_FAILURE;
-            ret = property_set(SCRIPT_START_PROP, SOC_PATCH_DL_SCRPT);
-            if(ret != PROP_SET_SUCC)
-               return FM_FAILURE;
-            for(int i = 0; i < INIT_LOOP_CNT; i++) {
-                property_get(FM_INIT_PROP, prop_value, NULL);
-                if (strcmp(prop_value, "1") == 0) {
-                    init_success = 1;
-                    break;
-                }else {
-                    usleep(INIT_WAIT_TIMEOUT);
-                }
-            }
-            if(!init_success) {
-                property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
-                return FM_FAILURE;
-            }else {
-                return FM_SUCCESS;
-            }
-        }
-    }else {
-        return FM_FAILURE;
-    }
-}
-
-int  FmIoctlsInterface :: close_fm_patch_dl
-(
-    void
-)
-{
-    int ret;
-
-    ret = property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
-    if(ret != PROP_SET_SUCC) {
-        return FM_FAILURE;
-    }else {
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: get_cur_freq
-(
-    UINT fd, long &freq
-)
-{
-    int ret;
-    struct v4l2_frequency channel;
-
-    channel.type = V4L2_TUNER_RADIO;
-    ret = ioctl(fd, VIDIOC_G_FREQUENCY, &channel);
-
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        freq = (channel.frequency / TUNE_MULT);
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: set_freq
-(
-    UINT fd, ULINT freq
-)
-{
-    int ret;
-    struct v4l2_frequency channel;
-
-    channel.type = V4L2_TUNER_RADIO;
-    channel.frequency = (freq * TUNE_MULT);
-
-    ret = ioctl(fd, VIDIOC_S_FREQUENCY, &channel);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: set_control
-(
-    UINT fd, UINT id, int val
-)
-{
-    int ret;
-    struct v4l2_control control;
-
-    control.value = val;
-    control.id = id;
-
-    ret = ioctl(fd, VIDIOC_S_CTRL, &control);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: set_calibration
-(
-    UINT fd
-)
-{
-    int ret;
-    FILE *cal_fp;
-    struct v4l2_ext_control ext_ctl;
-    struct v4l2_ext_controls v4l2_ctls;
-    char cal_data[CAL_DATA_SIZE] = {0};
-
-    cal_fp = fopen(CALIB_DATA_NAME, "r");
-    if(cal_fp != NULL) {
-       if(fread(&cal_data[0], 1, CAL_DATA_SIZE, cal_fp)
-           < CAL_DATA_SIZE) {
-           fclose(cal_fp);
-           return FM_FAILURE;
-       }
-       fclose(cal_fp);
-       ext_ctl.string = cal_data;
-       ext_ctl.size = CAL_DATA_SIZE;
-       v4l2_ctls.ctrl_class = V4L2_CTRL_CLASS_USER;
-       v4l2_ctls.count = 1;
-       v4l2_ctls.controls = &ext_ctl;
-       ret = ioctl(fd, VIDIOC_S_EXT_CTRLS, &v4l2_ctls);
-       if(ret < IOCTL_SUCC) {
-           return FM_FAILURE;
-       }else {
-           return FM_SUCCESS;
-       }
-    }else {
-        return FM_FAILURE;
-    }
-}
-
-int  FmIoctlsInterface :: get_control
-(
-    UINT fd, UINT id, long &val
-)
-{
-    int ret;
-    struct v4l2_control control;
-
-    control.id = id;
-    ret = ioctl(fd, VIDIOC_G_CTRL, &control);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        val = control.value;
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: start_search
-(
-    UINT fd, UINT dir
-)
-{
-    int ret;
-    struct v4l2_hw_freq_seek hw_seek;
-
-    hw_seek.seek_upward = dir;
-    hw_seek.type = V4L2_TUNER_RADIO;
-
-    ret = ioctl(fd, VIDIOC_S_HW_FREQ_SEEK, &hw_seek);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: set_band
-(
-    UINT fd, ULINT low, ULINT high
-)
-{
-    int ret;
-    struct v4l2_tuner tuner;
-
-    tuner.index = 0;
-    tuner.signal = 0;
-    tuner.rangelow = (low * TUNE_MULT);
-    tuner.rangehigh = (high * TUNE_MULT);
-
-    ret = ioctl(fd, VIDIOC_S_TUNER, &tuner);
-    ret = set_control(fd, V4L2_CID_PRV_REGION, 0);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        return FM_SUCCESS;
-    }
-}
-
-int FmIoctlsInterface :: get_rmssi
-(
-    UINT fd, long &rmssi
-)
-{
-    struct v4l2_tuner tuner;
-    int ret;
-
-    tuner.index = 0;
-    tuner.signal = 0;
-    ret = ioctl(fd, VIDIOC_G_TUNER, &tuner);
-    if(ret < IOCTL_SUCC) {
-        ret = FM_FAILURE;
-    }else {
-        rmssi = tuner.signal;
-        ret = FM_SUCCESS;
-    }
-    return ret;
-}
-
-int  FmIoctlsInterface :: get_upperband_limit
-(
-    UINT fd, ULINT &freq
-)
-{
-    int ret;
-    struct v4l2_tuner tuner;
-
-    tuner.index = 0;
-    ret = ioctl(fd, VIDIOC_G_TUNER, &tuner);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        freq = (tuner.rangehigh / TUNE_MULT);
-        ALOGE("high freq: %d\n",freq);
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: get_lowerband_limit
-(
-    UINT fd, ULINT &freq
-)
-{
-    int ret;
-    struct v4l2_tuner tuner;
-
-    tuner.index = 0;
-    ret = ioctl(fd, VIDIOC_G_TUNER, &tuner);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        freq = (tuner.rangelow / TUNE_MULT);
-        ALOGE("low freq: %d\n",freq);
-        return FM_SUCCESS;
-    }
-}
-
-int  FmIoctlsInterface :: set_audio_mode
-(
-    UINT fd, enum AUDIO_MODE mode
-)
-{
-    int ret;
-    struct v4l2_tuner tuner;
-
-    tuner.index = 0;
-    ret = ioctl(fd, VIDIOC_G_TUNER, &tuner);
-    if(ret < IOCTL_SUCC) {
-        return FM_FAILURE;
-    }else {
-        tuner.audmode = mode;
-        ret = ioctl(fd, VIDIOC_S_TUNER, &tuner);
-        if(ret != IOCTL_SUCC) {
-            return FM_FAILURE;
-        }else {
-            return FM_SUCCESS;
-        }
-    }
-}
-
-int  FmIoctlsInterface :: get_buffer
-(
-     UINT fd, char *buff, UINT len, UINT index
-)
-{
-    int ret;
-    struct v4l2_buffer v4l2_buf;
-
-    if((len < STD_BUF_SIZE) || (buff == NULL)) {
-        return FM_FAILURE;
-    }else {
-        memset(&v4l2_buf, 0, sizeof(v4l2_buf));
-        v4l2_buf.index = index;
-        v4l2_buf.type = V4L2_BUF_TYPE_PRIVATE;
-        v4l2_buf.length = STD_BUF_SIZE;
-        v4l2_buf.m.userptr = (ULINT)buff;
-        ret = ioctl(fd, VIDIOC_DQBUF, &v4l2_buf);
-        if(ret < IOCTL_SUCC) {
-            return FM_FAILURE;
-        }else {
-            return v4l2_buf.bytesused;
-        }
-    }
-}
-
-int FmIoctlsInterface :: set_ext_control
-(
-    UINT fd,
-    struct v4l2_ext_controls *v4l2_ctls
-)
-{
-    int ret;
-
-    ret = ioctl(fd, VIDIOC_S_EXT_CTRLS, v4l2_ctls);
-
-    if(ret < IOCTL_SUCC) {
-       return FM_FAILURE;
-    }else {
-       return FM_SUCCESS;
-    }
-}
-
diff --git a/libfm_jni/FmIoctlsInterface.h b/libfm_jni/FmIoctlsInterface.h
deleted file mode 100644
index e2ae601..0000000
--- a/libfm_jni/FmIoctlsInterface.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __FM_IOCTL_INTERFACE_H__
-#define __FM_IOCTL_INTERFACE_H__
-
-#include "FM_Const.h"
-
-#include <linux/videodev2.h>
-
-class FmIoctlsInterface
-{
-    public:
-        static int start_fm_patch_dl(UINT fd);
-        static int close_fm_patch_dl(void);
-        static int get_cur_freq(UINT fd, long &freq);
-        static int set_freq(UINT fd, ULINT freq);
-        static int set_control(UINT fd, UINT id, int val);
-        static int set_calibration(UINT fd);
-        static int get_control(UINT fd, UINT id, long &val);
-        static int start_search(UINT fd, UINT dir);
-        static int set_band(UINT fd, ULINT low, ULINT high);
-        static int get_upperband_limit(UINT fd, ULINT &freq);
-        static int get_lowerband_limit(UINT fd, ULINT &freq);
-        static int set_audio_mode(UINT fd, enum AUDIO_MODE mode);
-        static int get_buffer(UINT fd, char *buff, UINT len, UINT index);
-        static int get_rmssi(UINT fd, long &rmssi);
-        static int set_ext_control(UINT fd, struct v4l2_ext_controls *v4l2_ctls);
-};
-
-#endif //__FM_IOCTL_INTERFACE_H__
diff --git a/libfm_jni/FmPerformanceParams.cpp b/libfm_jni/FmPerformanceParams.cpp
deleted file mode 100644
index dc22432..0000000
--- a/libfm_jni/FmPerformanceParams.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <cstdio>
-#include <utils/Log.h>
-#include "FmPerformanceParams.h"
-#include "FmIoctlsInterface.h"
-#include <linux/videodev2.h>
-
-signed char FmPerformanceParams :: SetBand
-(
-   UINT fd, unsigned char band
-)
-{
-   signed char ret = FM_FAILURE;
-
-   switch(band) {
-   case BAND_87500_108000:
-       ret = FmIoctlsInterface::set_band(fd,
-                               87500, 108000);
-       break;
-   case BAND_76000_108000:
-       ret = FmIoctlsInterface::set_band(fd,
-                               76000, 108000);
-       break;
-   case BAND_76000_90000:
-       ret = FmIoctlsInterface::set_band(fd,
-                               76000, 90000);
-       break;
-   default:
-       ALOGE("Band type: %ld is invalid\n", band);
-       ret = FM_FAILURE;
-       break;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetEmphsis
-(
-   UINT fd, unsigned char emph
-)
-{
-   signed char ret = FM_FAILURE;
-
-   switch(emph) {
-   case DE_EMP75:
-   case DE_EMP50:
-       ret = FmIoctlsInterface::set_control(fd,
-                       V4L2_CID_PRV_EMPHASIS, emph);
-       break;
-   default:
-       ALOGE("invalid de-emphasis value\n");
-       ret = FM_FAILURE;
-       break;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetChannelSpacing
-(
-   UINT fd, unsigned char spacing
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                               V4L2_CID_PRV_CHAN_SPACING, spacing);
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetAfRmssiTh
-(
-   UINT fd, unsigned short th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_AF_RMSSI_TH, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetAfRmssiSamplesCnt
-(
-   UINT fd, unsigned char cnt
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_AF_RMSSI_SAMPLES, cnt);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetGoodChannelRmssiTh
-(
-   UINT fd, signed char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_GOOD_CH_RMSSI_TH, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetSrchAlgoType
-(
-   UINT fd, unsigned char algo
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_SRCHALGOTYPE, algo);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetSinrFirstStage
-(
-   UINT fd, signed char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_SINRFIRSTSTAGE, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetRmssiFirstStage
-(
-   UINT fd, signed char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_RMSSIFIRSTSTAGE, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetCf0Th12
-(
-   UINT fd, int th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_CF0TH12, th);
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetSinrSamplesCnt
-(
-   UINT fd, unsigned char cnt
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_SINR_SAMPLES, cnt);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetIntfLowTh
-(
-   UINT fd, unsigned char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_ON_CHANNEL_THRESHOLD, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetIntfHighTh
-(
-   UINT fd, unsigned char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_OFF_CHANNEL_THRESHOLD, th);
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetSinrFinalStage
-(
-   UINT fd, signed char th
-)
-{
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::set_control(fd,
-                V4L2_CID_PRV_SINR_THRESHOLD, th);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetAfRmssiTh
-(
-   UINT fd, unsigned short &th
-)
-{
-   long int af_rmssi_th;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_AF_RMSSI_TH, af_rmssi_th);
-   if(ret == FM_SUCCESS) {
-      th = af_rmssi_th;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetAfRmssiSamplesCnt
-(
-   UINT fd, unsigned char &cnt
-)
-{
-   long int af_samples_cnt;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_AF_RMSSI_SAMPLES, af_samples_cnt);
-   if(ret == FM_SUCCESS) {
-      cnt = af_samples_cnt;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetGoodChannelRmssiTh
-(
-   UINT fd, signed char &th
-)
-{
-   long int gd_chan_rmssi_th;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_GOOD_CH_RMSSI_TH, gd_chan_rmssi_th);
-   if(ret == FM_SUCCESS) {
-      th = gd_chan_rmssi_th;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetSrchAlgoType
-(
-   UINT fd, unsigned char &algo
-)
-{
-   long int srch_algo_type;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_SRCHALGOTYPE, srch_algo_type);
-   if(ret == FM_SUCCESS) {
-      algo = srch_algo_type;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetSinrFirstStage
-(
-   UINT fd, signed char &th
-)
-{
-   long int sinr_first_stage;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_SINRFIRSTSTAGE, sinr_first_stage);
-   if(ret == FM_SUCCESS) {
-      th = sinr_first_stage;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetRmssiFirstStage
-(
-   UINT fd, signed char &th
-)
-{
-   long int rmssi_first_stage;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_RMSSIFIRSTSTAGE, rmssi_first_stage);
-   if(ret == FM_SUCCESS) {
-      th = rmssi_first_stage;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetCf0Th12
-(
-   UINT fd, int &th
-)
-{
-   long int cf0th12;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_CF0TH12, cf0th12);
-   if(ret == FM_SUCCESS) {
-      th = cf0th12;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetSinrSamplesCnt
-(
-   UINT fd, unsigned char &cnt
-)
-{
-   long int sinr_samples_cnt;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_SINR_SAMPLES, sinr_samples_cnt);
-   if(ret == FM_SUCCESS) {
-      cnt = sinr_samples_cnt;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetIntfLowTh
-(
-   UINT fd, unsigned char &th
-)
-{
-   long int intf_low_th;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-               V4L2_CID_PRV_ON_CHANNEL_THRESHOLD, intf_low_th);
-   if(ret == FM_SUCCESS) {
-      th = intf_low_th;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetIntfHighTh
-(
-   UINT fd, unsigned char &th
-)
-{
-   long int intf_high_th;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-               V4L2_CID_PRV_OFF_CHANNEL_THRESHOLD, intf_high_th);
-   if(ret == FM_SUCCESS) {
-      th = intf_high_th;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetIntfDet
-(
-   UINT fd, unsigned char &th
-)
-{
-   long int int_det;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-               V4L2_CID_PRV_INTDET, int_det);
-   if(ret == FM_SUCCESS) {
-      th = int_det;
-   }
-   return ret;
-}
-signed char FmPerformanceParams :: GetSinrFinalStage
-(
-   UINT fd, signed char &th
-)
-{
-   signed char ret = FM_FAILURE;
-   long int sinr;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_SINR_THRESHOLD, sinr);
-
-   if(ret == FM_SUCCESS) {
-      th = sinr;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetHybridSrchList
-(
-   UINT fd,
-   unsigned int *freqs,
-   signed char *sinrs,
-   unsigned int n
-)
-{
-   struct v4l2_ext_control ext_ctl;
-   struct v4l2_ext_controls v4l2_ctls;
-   unsigned int freq;
-   signed char sinr;
-   unsigned int size = 0;
-   char *data = NULL;
-   signed char ret = FM_FAILURE;
-
-   if(n <= 0) {
-      return ret;
-   }
-   data = new char[(n * HYBRID_SRCH_DATA_LEN + HYBRID_SRCH_DATA_INDEX)];
-
-   if(data != NULL) {
-      data[size++] = HYBRID_SRCH_MODE;
-      data[size++] = ((n * HYBRID_SRCH_DATA_LEN) + 1);
-      data[size++] = n;
-      while((size < (n * HYBRID_SRCH_DATA_LEN + 2)) && (freqs != NULL)
-            && (sinrs != NULL)) {
-            freq = (*freqs - STARTING_FREQ) / FREQ_MULTIPLEX;
-            data[size++] = (freq & 0xff);
-            data[size++] = ((freq >> 8) & 0xff);
-            data[size++] = *sinrs;
-            freqs++;
-            sinrs++;
-      }
-      if(size == (n * HYBRID_SRCH_DATA_LEN + HYBRID_SRCH_DATA_INDEX)) {
-         ext_ctl.id = V4L2_CID_PRV_IRIS_WRITE_DEFAULT;
-         ext_ctl.string = data;
-         ext_ctl.size = size;
-         v4l2_ctls.ctrl_class = V4L2_CTRL_CLASS_USER;
-         v4l2_ctls.count = 1;
-         v4l2_ctls.controls  = &ext_ctl;
-         ret =  FmIoctlsInterface::set_ext_control(fd, &v4l2_ctls);
-         if(ret == FM_SUCCESS) {
-            ALOGE("hybrid srch list sent successfully\n");
-         }else {
-            ALOGE("hybrid srch list setting failed\n");
-         }
-      }
-   }
-
-   delete []data;
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetBlendSinr
-(
-   UINT fd, signed char bsinr
-)
-{
-   signed char ret = FM_FAILURE;
-
-   if ((bsinr >= MIN_BLEND_SINRHI) &&
-       (bsinr <= MAX_BLEND_SINRHI))
-        ret = FmIoctlsInterface::set_control(fd,
-                   V4L2_CID_PRV_IRIS_BLEND_SINRHI, bsinr);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetBlendSinr
-(
-   UINT fd, signed char &bsinr
-)
-{
-   long int blend_sinr_hi;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_IRIS_BLEND_SINRHI, blend_sinr_hi);
-   if(ret == FM_SUCCESS) {
-      bsinr = blend_sinr_hi;
-   }
-   return ret;
-}
-
-signed char FmPerformanceParams :: SetBlendRmssi
-(
-   UINT fd, signed char brmssi
-)
-{
-   signed char ret = FM_FAILURE;
-
-    if ((brmssi >= MIN_BLEND_RMSSIHI) &&
-        (brmssi <= MAX_BLEND_RMSSIHI))
-         ret = FmIoctlsInterface::set_control(fd,
-                   V4L2_CID_PRV_IRIS_BLEND_RMSSIHI, brmssi);
-
-   return ret;
-}
-
-signed char FmPerformanceParams :: GetBlendRmssi
-(
-   UINT fd, signed char &brmssi
-)
-{
-   long int blend_rmssi_hi;
-   signed char ret = FM_FAILURE;
-
-   ret = FmIoctlsInterface::get_control(fd,
-                V4L2_CID_PRV_IRIS_BLEND_RMSSIHI, blend_rmssi_hi);
-   if(ret == FM_SUCCESS) {
-      brmssi = blend_rmssi_hi;
-   }
-   return ret;
-}
diff --git a/libfm_jni/FmPerformanceParams.h b/libfm_jni/FmPerformanceParams.h
deleted file mode 100644
index 88e53cc..0000000
--- a/libfm_jni/FmPerformanceParams.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __FM_PERFORMANCE_PARAMS_H__
-#define __FM_PERFORMANCE_PARAMS_H__
-
-#include "FM_Const.h"
-
-#define MIN_BLEND_SINRHI -128
-#define MAX_BLEND_SINRHI  127
-#define MIN_BLEND_RMSSIHI -128
-#define MAX_BLEND_RMSSIHI  127
-
-class FmPerformanceParams
-{
-      private:
-      public:
-          signed char SetBand(UINT fd, unsigned char band);
-          signed char SetEmphsis(UINT fd, unsigned char emph);
-          signed char SetChannelSpacing(UINT fd, unsigned char spacing);
-          signed char SetAfRmssiTh(UINT fd, unsigned short th);
-          signed char SetAfRmssiSamplesCnt(UINT fd, unsigned char cnt);
-          signed char SetGoodChannelRmssiTh(UINT fd, signed char th);
-          signed char SetSrchAlgoType(UINT fd, unsigned char algo);
-          signed char SetSinrFirstStage(UINT fd, signed char th);
-          signed char SetRmssiFirstStage(UINT fd, signed char th);
-          signed char SetCf0Th12(UINT fd, int th);
-          signed char SetSinrSamplesCnt(UINT fd, unsigned char cnt);
-          signed char SetIntfLowTh(UINT fd, unsigned char th);
-          signed char SetIntfHighTh(UINT fd, unsigned char th);
-          signed char SetSinrFinalStage(UINT fd, signed char th);
-          signed char SetHybridSrchList(UINT fd, unsigned int *freqs, signed char *sinrs, unsigned int n);
-          signed char SetBlendSinr(UINT fd, signed char bsinr);
-          signed char SetBlendRmssi(UINT fd, signed char brmssi);
-
-          signed char GetAfRmssiTh(UINT fd, unsigned short &th);
-          signed char GetAfRmssiSamplesCnt(UINT fd, unsigned char &cnt);
-          signed char GetGoodChannelRmssiTh(UINT fd, signed char &th);
-          signed char GetSrchAlgoType(UINT fd, unsigned char &algo);
-          signed char GetSinrFirstStage(UINT fd, signed char &th);
-          signed char GetRmssiFirstStage(UINT fd, signed char &th);
-          signed char GetCf0Th12(UINT fd, int &th);
-          signed char GetSinrSamplesCnt(UINT fd, unsigned char &cnt);
-          signed char GetIntfLowTh(UINT fd, unsigned char &th);
-          signed char GetIntfHighTh(UINT fd, unsigned char &th);
-          signed char GetIntfDet(UINT fd, unsigned char &th);
-          signed char GetSinrFinalStage(UINT fd, signed char &th);
-          signed char GetBlendSinr(UINT fd, signed char &bsinr);
-          signed char GetBlendRmssi(UINT fd, signed char &brmssi);
-};
-
-#endif //__FM_PERFORMANCE_PARAMS_H__
diff --git a/libfm_jni/FmRadioController.cpp b/libfm_jni/FmRadioController.cpp
deleted file mode 100644
index 613a062..0000000
--- a/libfm_jni/FmRadioController.cpp
+++ /dev/null
@@ -1,1444 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <fcntl.h>
-#include <utils/Log.h>
-#include <cutils/properties.h>
-#include <sys/ioctl.h>
-#include <math.h>
-#include "FmRadioController.h"
-#include "FmIoctlsInterface.h"
-#include "ConfigFmThs.h"
-#include <linux/videodev2.h>
-
-//Reset all variables to default value
-static FmIoctlsInterface * FmIoct;
-FmRadioController :: FmRadioController
-(
-)
-{
-    cur_fm_state = FM_OFF;
-    prev_freq = -1;
-    seek_scan_canceled = false;
-    af_enabled = 0;
-    rds_enabled = 0;
-    event_listener_canceled = false;
-    is_rds_support = false;
-    is_ps_event_received = false;
-    is_rt_event_received = false;
-    is_af_jump_received = false;
-    mutex_fm_state = PTHREAD_MUTEX_INITIALIZER;
-    mutex_seek_compl_cond = PTHREAD_MUTEX_INITIALIZER;
-    mutex_scan_compl_cond = PTHREAD_MUTEX_INITIALIZER;
-    mutex_tune_compl_cond = PTHREAD_MUTEX_INITIALIZER;
-    mutex_turn_on_cond = PTHREAD_MUTEX_INITIALIZER;
-    turn_on_cond = PTHREAD_COND_INITIALIZER;
-    seek_compl_cond = PTHREAD_COND_INITIALIZER;
-    scan_compl_cond = PTHREAD_COND_INITIALIZER;
-    tune_compl_cond = PTHREAD_COND_INITIALIZER;
-    event_listener_thread = 0;
-    fd_driver = -1;
-    FmIoct = new FmIoctlsInterface();
-}
-
-/* Turn off FM */
-FmRadioController :: ~FmRadioController
-(
-)
-{
-    if((cur_fm_state != FM_OFF)) {
-        Stop_Scan_Seek();
-        set_fm_state(FM_OFF_IN_PROGRESS);
-        FmIoctlsInterface::set_control(fd_driver,
-                        V4L2_CID_PRV_STATE, FM_DEV_NONE);
-    }
-    if(event_listener_thread != 0) {
-        event_listener_canceled = true;
-        pthread_join(event_listener_thread, NULL);
-    }
-}
-
-int FmRadioController ::open_dev()
-{
-    int ret = FM_SUCCESS;
-
-    fd_driver = open(FM_DEVICE_PATH, O_RDONLY, O_NONBLOCK);
-
-    if (fd_driver < 0) {
-        ALOGE("%s failed, [fd=%d] %s\n", __func__, fd_driver, FM_DEVICE_PATH);
-        return FM_FAILURE;
-    }
-
-    ALOGD("%s, [fd=%d] \n", __func__, fd_driver);
-    return ret;
-}
-
-int FmRadioController ::close_dev()
-{
-    int ret = 0;
-
-    if (fd_driver > 0) {
-        close(fd_driver);
-        fd_driver = -1;
-    }
-    ALOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd_driver, ret);
-    return ret;
-}
-
-struct timespec FmRadioController :: set_time_out
-(
-    int secs
-)
-{
-    struct timespec ts;
-    struct timeval tp;
-
-    gettimeofday(&tp, NULL);
-    ts.tv_sec = tp.tv_sec;
-    ts.tv_nsec = tp.tv_usec * 1000;
-    ts.tv_sec += secs;
-
-    return ts;
-}
-
-//Get current tuned frequency
-//Return -1 if failed to get freq
-long FmRadioController :: GetChannel
-(
-    void
-)
-{
-    long freq = -1;
-    int ret;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-       ret = FmIoctlsInterface::get_cur_freq(fd_driver, freq);
-       if(ret == FM_SUCCESS) {
-          ALOGI("FM get freq is successfull, freq is: %ld\n", freq);
-       }else {
-          ALOGE("FM get frequency failed, freq is: %ld\n", freq);
-       }
-    }else {
-       ALOGE("FM get freq is not valid in current state\n");
-    }
-    return freq;
-}
-
-int FmRadioController ::Pwr_Up(int freq)
-{
-    int ret = FM_SUCCESS;
-    struct timespec ts;
-    ConfigFmThs thsObj;
-    char value[PROPERTY_VALUE_MAX] = {'\0'};
-
-    ALOGI("%s,[freq=%d]\n", __func__, freq);
-    property_get("qcom.bluetooth.soc", value, NULL);
-    ALOGD("BT soc is %s\n", value);
-    if (fd_driver < 0) {
-        ret = open_dev();
-        if (ret != FM_SUCCESS) {
-            ALOGE("Dev open failed\n");
-            return FM_FAILURE;
-        }
-    }
-
-    if (cur_fm_state == FM_OFF) {
-        ALOGE("cur_fm_state = %d\n",cur_fm_state);
-        if (strcmp(value, "rome") != 0) {
-            ret = FmIoctlsInterface::start_fm_patch_dl(fd_driver);
-            if (ret != FM_SUCCESS) {
-                ALOGE("FM patch downloader failed: %d\n", ret);
-                close_dev();
-                set_fm_state(FM_OFF);
-                return FM_FAILURE;
-            }
-        }
-        if (event_listener_thread == 0) {
-            ret = pthread_create(&event_listener_thread, NULL,
-                                              handle_events, this);
-            if (ret == 0) {
-                ALOGI("Lock the mutex for FM turn on cond\n");
-                pthread_mutex_lock(&mutex_turn_on_cond);
-                ts = set_time_out(READY_EVENT_TIMEOUT);
-                ret = FmIoctlsInterface::set_control(fd_driver,
-                                             V4L2_CID_PRV_STATE, FM_RX);
-                if (ret == FM_SUCCESS) {
-                    ALOGI("Waiting for timedout or FM on\n");
-                    pthread_cond_timedwait(&turn_on_cond,
-                                       &mutex_turn_on_cond, &ts);
-                    ALOGI("Unlocked mutex & timedout or condition satisfied\n");
-                    pthread_mutex_unlock(&mutex_turn_on_cond);
-                    if (cur_fm_state == FM_ON) {//after READY event
-                        ret = SetBand(BAND_87500_108000);
-                        if (ret != FM_SUCCESS) {
-                            ALOGE("set band failed\n");
-                            ret = FM_FAILURE;
-                            goto exit;
-                        }
-                        ret = SetChannelSpacing(CHAN_SPACE_100);
-                        if (ret != FM_SUCCESS) {
-                            ALOGE("set channel spacing failed\n");
-                            ret = FM_FAILURE;
-                            goto exit;
-                        }
-                        ret = SetDeConstant(DE_EMP50);
-                        if (ret != FM_SUCCESS) {
-                            ALOGE("set Emphasis failed\n");
-                            ret = FM_FAILURE;
-                            goto exit;
-                        }
-                        thsObj.SetRxSearchAfThs(FM_PERFORMANCE_PARAMS, fd_driver);
-                        SetStereo();
-                        ret = TuneChannel(freq);
-                        if (ret != FM_SUCCESS) {
-                            ALOGI("FM set freq command failed\n");
-                            ret = FM_FAILURE;
-                            goto exit;
-                        }
-                        return FM_SUCCESS;
-                    } else { //if time out
-                        ret = FM_FAILURE;
-                        goto exit;
-                    }
-                } else {
-                    ALOGE("Set FM on control failed\n");
-                    pthread_mutex_unlock(&mutex_turn_on_cond);
-                    ALOGI("Unlocked the FM on cond mutex\n");
-                    ret = FM_FAILURE;
-                    goto close_fd;
-                }
-            } else {
-                ALOGE("FM event listener thread failed: %d\n", ret);
-                set_fm_state(FM_OFF);
-                return FM_FAILURE;
-            }
-        } else {
-            ALOGE("FM event listener threadi existed\n");
-            return FM_SUCCESS;
-        }
-    } else if(cur_fm_state != FM_ON_IN_PROGRESS) {
-        return FM_SUCCESS;
-    } else {
-        return FM_FAILURE;
-    }
-
-exit:
-    FmIoctlsInterface::set_control(fd_driver,
-                                     V4L2_CID_PRV_STATE, FM_DEV_NONE);
-close_fd:
-    event_listener_canceled = true;
-    pthread_join(event_listener_thread, NULL);
-    close(fd_driver);
-    fd_driver = -1;
-    set_fm_state(FM_OFF);
-
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret;
-}
-
-int FmRadioController ::Pwr_Down()
-{
-    int ret = 0;
-
-    if((cur_fm_state != FM_OFF)) {
-        Stop_Scan_Seek();
-        set_fm_state(FM_OFF_IN_PROGRESS);
-        FmIoctlsInterface::set_control(fd_driver,
-                        V4L2_CID_PRV_STATE, FM_DEV_NONE);
-    }
-    if(event_listener_thread != 0) {
-        ALOGD("%s, event_listener_thread canceeled\n", __func__);
-        event_listener_canceled = true;
-        pthread_join(event_listener_thread, NULL);
-    }
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret;
-}
-//Tune to a Freq
-//Return FM_SUCCESS on success FM_FAILURE
-//on failure
-int FmRadioController :: TuneChannel
-(
-    long freq
-)
-{
-    int ret = FM_SUCCESS;
-    struct timespec ts;
-
-    if((cur_fm_state == FM_ON) &&
-        (freq > 0)) {
-        set_fm_state(FM_TUNE_IN_PROGRESS);
-        ret = FmIoctlsInterface::set_freq(fd_driver,
-                                             freq);
-        if(ret == FM_SUCCESS) {
-           ALOGI("FM set frequency command set successfully\n");
-           pthread_mutex_lock(&mutex_tune_compl_cond);
-           ts = set_time_out(TUNE_EVENT_TIMEOUT);
-           ret = pthread_cond_timedwait(&tune_compl_cond, &mutex_tune_compl_cond, &ts);
-           pthread_mutex_unlock(&mutex_tune_compl_cond);
-        }else {
-           if((cur_fm_state != FM_OFF)) {
-              set_fm_state(FM_ON);
-           }
-           ALOGE("FM set freq command failed\n");
-        }
-    }else {
-        ALOGE("Fm is not in proper state for tuning to a freq\n");
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: Seek(int dir)
-{
-    int ret = 0;
-    int freq = -1;
-    struct timespec ts;
-
-    if (cur_fm_state != FM_ON) {
-        ALOGE("%s error Fm state: %d\n", __func__,cur_fm_state);
-        return FM_FAILURE;
-    }
-
-    ALOGI("FM seek started\n");
-    set_fm_state(SEEK_IN_PROGRESS);
-    ret = FmIoctlsInterface::set_control(fd_driver,
-                                  V4L2_CID_PRV_SRCHMODE, SEEK_MODE);
-    if (ret != FM_SUCCESS) {
-        set_fm_state(FM_ON);
-        return FM_FAILURE;
-    }
-
-    ret = FmIoctlsInterface::set_control(fd_driver,
-                           V4L2_CID_PRV_SCANDWELL, SEEK_DWELL_TIME);
-    if (ret != FM_SUCCESS) {
-        set_fm_state(FM_ON);
-        return FM_FAILURE;
-    }
-
-    if (dir == 1) {
-        ret = FmIoctlsInterface::start_search(fd_driver,
-                                                     SEARCH_UP);
-    } else {
-        ret = FmIoctlsInterface::start_search(fd_driver,
-                                            SEARCH_DOWN);
-    }
-
-    if (ret != FM_SUCCESS) {
-        set_fm_state(FM_ON);
-        return FM_FAILURE;
-    }
-    pthread_mutex_lock(&mutex_seek_compl_cond);
-    ts = set_time_out(SEEK_COMPL_TIMEOUT);
-    ret = pthread_cond_timedwait(&seek_compl_cond, &mutex_seek_compl_cond, &ts);
-    pthread_mutex_unlock(&mutex_seek_compl_cond);
-    if ((cur_fm_state != SEEK_IN_PROGRESS) && !seek_scan_canceled) {
-        ALOGI("Seek completed without timeout\n");
-        freq = GetChannel();
-    }
-    seek_scan_canceled = false;
-    return freq;
-}
-
-bool FmRadioController ::IsRds_support
-(
-    void
-)
-{
-   is_rds_support = true;
-   ALOGI("is_rds_support: \n", is_rds_support);
-   return is_rds_support;
-}
-
-//HardMute both audio channels
-int FmRadioController ::MuteOn()
-{
-    int ret;
-
-    ALOGE("cur_fm_state = %d\n", cur_fm_state);
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-       ret = FmIoctlsInterface::set_control(fd_driver,
-                       V4L2_CID_AUDIO_MUTE, MUTE_L_R_CHAN);
-       ALOGE("CMD executed mute\n");
-    }else {
-       ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//Unmute both audio channel
-int FmRadioController ::MuteOff()
-{
-    int ret;
-
-    ALOGE("cur_fm_state = %d\n", cur_fm_state);
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_AUDIO_MUTE, UNMUTE_L_R_CHAN);
-        ALOGE("CMD executed for unmute\n");
-    }else {
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//
-int FmRadioController ::SetSoftMute(bool mode)
-{
-    int ret;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                             V4L2_CID_PRV_SOFT_MUTE, mode);
-    }else {
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: Set_mute(bool mute)
-{
-    int ret = 0;
-
-    if (mute) {
-        ret = MuteOn();
-    } else {
-        ret = MuteOff();
-    }
-
-    if (ret)
-        ALOGE("%s failed, %d\n", __func__, ret);
-    ALOGD("%s, [mute=%d] [ret=%d]\n", __func__, mute, ret);
-    return ret;
-}
-
-int FmRadioController :: Stop_Scan_Seek
-(
-)
-{
-   int ret;
-
-    if((cur_fm_state == SEEK_IN_PROGRESS) ||
-       (cur_fm_state == SCAN_IN_PROGRESS)) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                                       V4L2_CID_PRV_SRCHON, 0);
-        if (ret == FM_SUCCESS) {
-            ALOGI("FM Seek cancel command set successfully\n");
-            seek_scan_canceled = true;
-        } else {
-            ALOGE("FM Seek cancel command sent failed\n");
-        }
-    } else {
-        ALOGE("FM is not in proper state for cancelling Seek operation\n");
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: ReadRDS() //todo define each RDS flag
-{
-   int ret = 0;
-
-   if (is_ps_event_received)
-       ret |= RDS_EVT_PS_UPDATE;
-   if (is_rt_event_received)
-       ret |= RDS_EVT_RT_UPDATE;
-   if (is_af_jump_received)
-       ret |= RDS_EVT_AF_JUMP;
-
-   return ret;
-}
-
-int FmRadioController :: Get_ps(char *ps, int *ps_len)
-{
-    int ret = 0;
-    int len = 0;
-    char raw_rds[STD_BUF_SIZE];
-
-    ret = FmIoctlsInterface::get_buffer(fd_driver,
-                                    raw_rds, STD_BUF_SIZE, PS_IND);
-    if (ret <= 0) {
-        return FM_FAILURE;
-    } else {
-        if (raw_rds[PS_STR_NUM_IND] > 0) {
-            if (ps != NULL) {
-                for(int i = 0; i < MAX_PS_LEN; i++) {
-                    ps[i] = raw_rds[PS_DATA_OFFSET_IND + i];
-                    if (ps[i] == 0) {
-                        break;
-                    } else if((ps[len] <= LAST_CTRL_CHAR) ||
-                              (ps[len] >= FIRST_NON_PRNT_CHAR)) {
-                        ps[i] = SPACE_CHAR;
-                        continue;
-                    }
-                    len++;
-                }
-                if (len < (MAX_PS_LEN - 1)) {
-                    ps[len] = '\0';
-                    *ps_len = len + 1;
-                } else {
-                    *ps_len = len;
-                }
-                ALOGI("PS is: %s\n", ps);
-            } else {
-                return FM_FAILURE;
-            }
-        }
-    }
-    is_ps_event_received = false;
-    ALOGD("%s, [ps_len=%d]\n", __func__, *ps_len);
-    return FM_SUCCESS;
-}
-
-int FmRadioController :: Get_rt(char *rt, int *rt_len)
-{
-    int ret = 0;
-    int len = 0;
-    char raw_rds[STD_BUF_SIZE];
-
-    ret = FmIoctlsInterface::get_buffer(fd_driver,
-                               raw_rds, STD_BUF_SIZE, RT_IND);
-    if (ret <= 0) {
-        return FM_FAILURE;
-    } else {
-        if (rt != NULL) {
-            if ((raw_rds[RT_LEN_IND] > 0) &&
-                (raw_rds[RT_LEN_IND] <= MAX_RT_LEN)) {
-                for(len = 0; len < raw_rds[RT_LEN_IND]; len++) {
-                   rt[len] = raw_rds[RT_DATA_OFFSET_IND + len];
-                   ALOGI("Rt byte[%d]: %d\n", len, rt[len]);
-                   if ((rt[len] <= LAST_CTRL_CHAR) ||
-                       (rt[len] >= FIRST_NON_PRNT_CHAR)) {
-                       rt[len] = SPACE_CHAR;
-                       continue;
-                   }
-                }
-                if (len < (MAX_RT_LEN - 1)) {
-                    rt[len] = '\0';
-                    *rt_len = len + 1;
-                } else {
-                    *rt_len = len;
-                }
-                ALOGI("Rt is: %s\n", rt);
-                ALOGI("RT text A / B: %d\n", raw_rds[RT_A_B_FLAG_IND]);
-            } else {
-                return FM_FAILURE;
-            }
-        } else {
-            return FM_FAILURE;
-        }
-    }
-    is_rt_event_received = false;
-    ALOGD("%s, [rt_len=%d]\n", __func__, *rt_len);
-    return FM_SUCCESS;
-}
-
-int FmRadioController :: Get_AF_freq(uint16_t *ret_freq)
-{
-    int ret =0;
-    ULINT lowBand, highBand;
-    float real_freq = 0;
-
-    ALOGI("get_AF_freq\n");
-    ret = FmIoctlsInterface::get_lowerband_limit(fd_driver,
-                                                         lowBand);
-    if (ret != FM_SUCCESS) {
-        ALOGE("failed to get lowerband: %d\n", ret);
-        return FM_FAILURE;
-    }
-    ALOGI("lowBand = %ld\n",lowBand);
-    ret = FmIoctlsInterface::get_upperband_limit(fd_driver,
-                                                      highBand);
-    if (ret != FM_SUCCESS) {
-        ALOGE("failed to getgherband: %d\n", ret);
-        return FM_FAILURE;
-    }
-    ALOGI("highBand = %ld\n",highBand);
-    real_freq = GetChannel();
-    if ((real_freq < lowBand ) || (real_freq > highBand)) {
-        ALOGE("AF freq is not in band limits\ni");
-        return FM_FAILURE;
-    } else {
-        *ret_freq = real_freq/100;
-    }
-    is_af_jump_received = false;
-    return FM_SUCCESS;
-}
-
-//Emphasis:
-//75microsec: 0, 50 microsec: 1
-//return FM_SUCCESS on success, FM_FAILURE
-//on failure
-int FmRadioController :: SetDeConstant
-(
-    long emphasis
-)
-{
-    int ret;
-
-     ALOGE("cur_fm_state: %d, emphasis: %d\n", cur_fm_state, emphasis);
-    if(cur_fm_state == FM_ON) {
-        switch(emphasis) {
-            case DE_EMP75:
-            case DE_EMP50:
-                ret = FmIoctlsInterface::set_control(fd_driver,
-                       V4L2_CID_PRV_EMPHASIS, emphasis);
-                break;
-            default:
-                ALOGE("FM value pass for set Deconstant is invalid\n");
-                ret = FM_FAILURE;
-                break;
-        }
-    }else {
-        ALOGE("FM is not in proper state to set De constant\n");
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: GetStationList
-(
-    uint16_t *scan_tbl, int *max_cnt
-)
-{
-    char srch_list[STD_BUF_SIZE];
-    int ret;
-    ULINT lowBand, highBand;
-    int station_num = 0;
-    int stationList[FM_RX_SRCHLIST_MAX_STATIONS];
-    int tmpFreqByte1=0;
-    int tmpFreqByte2=0;
-    int freq = 0;
-    float real_freq = 0;
-    int i = 0, j = 0;
-
-    ALOGI("getstationList\n");
-    ret = FmIoctlsInterface::get_lowerband_limit(fd_driver,
-                                                         lowBand);
-    if (ret != FM_SUCCESS) {
-        ALOGE("failed to get lowerband: %d\n", ret);
-        return FM_FAILURE;
-    }
-    ALOGI("lowBand = %ld\n",lowBand);
-    ret = FmIoctlsInterface::get_upperband_limit(fd_driver,
-                                                      highBand);
-    if (ret != FM_SUCCESS) {
-        ALOGE("failed to getgherband: %d\n", ret);
-        return FM_FAILURE;
-    }
-    ALOGI("highBand = %ld\n",highBand);
-    ret = FmIoctlsInterface::get_buffer(fd_driver,
-                          srch_list, STD_BUF_SIZE, STATION_LIST_IND);
-    if ((int)srch_list[0] >0) {
-        station_num = (int)srch_list[0];
-    }
-    ALOGI("station_num: %d ", station_num);
-    *max_cnt = station_num;
-    for (i=0;i<station_num;i++) {
-        freq = 0;
-        ALOGI(" Byte1 = %d", srch_list[i * NO_OF_BYTES_EACH_FREQ + 1]);
-        ALOGI(" Byte2 = %d", srch_list[i * NO_OF_BYTES_EACH_FREQ + 2]);
-        tmpFreqByte1 = srch_list[i * NO_OF_BYTES_EACH_FREQ + 1] & 0xFF;
-        tmpFreqByte2 = srch_list[i * NO_OF_BYTES_EACH_FREQ + 2] & 0xFF;
-        ALOGI(" tmpFreqByte1 = %d", tmpFreqByte1);
-        ALOGI(" tmpFreqByte2 = %d", tmpFreqByte2);
-        freq = (tmpFreqByte1 & EXTRACT_FIRST_BYTE) << 8;
-        freq |= tmpFreqByte2;
-        ALOGI(" freq: %d", freq);
-        real_freq  = (freq * FREQ_MULTIPLEX) + lowBand;
-        ALOGI(" real_freq: %d", real_freq);
-        if ( (real_freq < lowBand ) || (real_freq > highBand) ) {
-              ALOGI("Frequency out of band limits");
-        } else {
-            scan_tbl[j] = (real_freq/SRCH_DIV);
-            ALOGI(" scan_tbl: %d", scan_tbl[j]);
-            j++;
-        }
-    }
-    return FM_SUCCESS;
-}
-
-int FmRadioController ::ScanList
-(
-    uint16_t *scan_tbl, int *max_cnt
-)
-{
-    int ret;
-    struct timespec ts;
-
-    /* Check current state of FM device */
-    if (cur_fm_state == FM_ON) {
-        ALOGI("FM searchlist started\n");
-        set_fm_state(SCAN_IN_PROGRESS);
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                           V4L2_CID_PRV_SRCHMODE, SRCHLIST_MODE_STRONG);
-        if (ret != FM_SUCCESS) {
-            set_fm_state(FM_ON);
-            return FM_FAILURE;
-        }
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                         V4L2_CID_PRV_SRCH_CNT, FM_RX_SRCHLIST_MAX_STATIONS);
-        if (ret != FM_SUCCESS) {
-            set_fm_state(FM_ON);
-            return FM_FAILURE;
-        }
-        ret = FmIoctlsInterface::start_search(fd_driver,
-                                                     SEARCH_UP);
-        if (ret != FM_SUCCESS) {
-            set_fm_state(FM_ON);
-            return FM_FAILURE;
-        }
-        pthread_mutex_lock(&mutex_scan_compl_cond);
-        ts = set_time_out(SCAN_COMPL_TIMEOUT);
-        ALOGI("Wait for Scan Timeout or scan complete");
-        ret = pthread_cond_timedwait(&scan_compl_cond, &mutex_scan_compl_cond, &ts);
-        ALOGI("Scan complete or timedout");
-        pthread_mutex_unlock(&mutex_scan_compl_cond);
-        if (cur_fm_state == FM_ON && !seek_scan_canceled) {
-            GetStationList(scan_tbl, max_cnt);
-        } else {
-            seek_scan_canceled = false;
-            return FM_FAILURE;
-        }
-    } else {
-        ALOGI("Scanlist: not proper state %d\n",cur_fm_state );
-        return FM_FAILURE;
-    }
-    return FM_SUCCESS;
-}
-
-long FmRadioController :: GetCurrentRSSI
-(
-    void
-)
-{
-    int ret;
-    long rmssi = -129;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-        ret = FmIoctlsInterface::get_rmssi(fd_driver, rmssi);
-    }else {
-    }
-    return rmssi;
-}
-
-//enable, disable value to receive data of a RDS group
-//return FM_SUCCESS on success, FM_FAILURE on failure
-int FmRadioController :: SetRdsGrpProcessing
-(
-    int grps
-)
-{
-    int ret;
-    long mask;
-
-    if(cur_fm_state == FM_ON) {
-       ret = FmIoctlsInterface::get_control(fd_driver,
-                     V4L2_CID_PRV_RDSGROUP_PROC, mask);
-       if(ret != FM_SUCCESS) {
-          return ret;
-       }
-       mask &= 0xC7;
-       mask |= ((grps & 0x07) << 3);
-       ret = FmIoctlsInterface::set_control(fd_driver,
-                    V4L2_CID_PRV_RDSGROUP_PROC, (int)mask);
-    }else {
-       ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//Enable RDS data receiving
-//Enable RT, PS, AF Jump, RTPLUS, ERT etc
-int FmRadioController :: EnableRDS
-(
-    void
-)
-{
-    int ret = FM_FAILURE;
-
-    ALOGE("%s:cur_fm_state = %d\n", __func__, cur_fm_state);
-    if (cur_fm_state == FM_ON) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_RDSON, 1);
-        if (ret != FM_SUCCESS) {
-            ALOGE("RDS ON failed\n");
-            return ret;
-        }
-        ret = SetRdsGrpProcessing(FM_RX_RDS_GRP_RT_EBL |
-                                  FM_RX_RDS_GRP_PS_EBL |
-                                  FM_RX_RDS_GRP_AF_EBL |
-                                  FM_RX_RDS_GRP_PS_SIMPLE_EBL);
-        if (ret != FM_SUCCESS) {
-            ALOGE("Set RDS grp processing\n");
-            return ret;
-        }
-        ret = FM_SUCCESS;
-        rds_enabled = 1;
-        EnableAF();
-    } else {
-        ALOGE("%s:not in proper state cur_fm_state = %d\n", cur_fm_state);
-        return ret;
-    }
-    return ret;
-}
-
-//Disable all RDS data processing
-//RT, ERT, RT PLUS, PS
-int FmRadioController :: DisableRDS
-(
-    void
-)
-{
-    int ret = FM_FAILURE;
-
-    ALOGE("%s:cur_fm_state = %d\n", __func__, cur_fm_state);
-    if (cur_fm_state == FM_ON) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_RDSON, 2);
-        if (ret != FM_SUCCESS) {
-            ALOGE("Disable RDS failed\n");
-            return ret;
-        }
-        ret = FM_SUCCESS;
-        rds_enabled = 0;
-        DisableAF();
-    } else {
-        ALOGE("%s:not in proper state cur_fm_state = %d\n", cur_fm_state);
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: Turn_On_Off_Rds(bool onoff)
-{
-    int ret = 0;
-
-    if (onoff) {
-        ret = EnableRDS();
-    } else {
-        ret = DisableRDS();
-    }
-
-    if (ret) {
-        ALOGE("%s, failed\n", __func__);
-    }
-    ALOGD("%s, [onoff=%d] [ret=%d]\n", __func__, onoff, ret);
-    return ret;
-}
-
-//Enables Alternate Frequency switching
-int FmRadioController :: EnableAF
-(
-    void
-)
-{
-    int ret;
-    long rdsgrps;
-
-    if(cur_fm_state == FM_ON) {
-        ret = FmIoctlsInterface::get_control(fd_driver,
-                      V4L2_CID_PRV_RDSGROUP_PROC, rdsgrps);
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_RDSON, 1);
-        if(ret == FM_SUCCESS) {
-            ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_AF_JUMP, 1);
-            if(ret == FM_SUCCESS) {
-               af_enabled = 1;
-            }
-        } else {
-        }
-    } else {
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//Disables Alternate Frequency switching
-int FmRadioController :: DisableAF
-(
-    void
-)
-{
-    int ret;
-    long rdsgrps;
-
-    if(cur_fm_state == FM_ON) {
-        ret = FmIoctlsInterface::get_control(fd_driver,
-                      V4L2_CID_PRV_RDSGROUP_PROC, rdsgrps);
-        if(ret == FM_SUCCESS) {
-            ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_AF_JUMP, 0);
-            if(ret == FM_SUCCESS) {
-               af_enabled = 0;
-            }
-        }else {
-        }
-    }else {
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//Set regional band
-int FmRadioController :: SetBand
-(
-    long band
-)
-{
-    int ret;
-
-    if(cur_fm_state == FM_ON) {
-        switch(band) {
-            case BAND_87500_108000:
-                ret = FmIoctlsInterface::set_band(fd_driver,
-                               87500, 108000);
-                break;
-            case BAND_76000_108000:
-                ret = FmIoctlsInterface::set_band(fd_driver,
-                               76000, 108000);
-                break;
-            case BAND_76000_90000:
-                ret = FmIoctlsInterface::set_band(fd_driver,
-                               76000, 90000);
-                break;
-            default:
-                ALOGE("Band type: %ld is invalid\n", band);
-                ret = FM_FAILURE;
-                break;
-        }
-    }else {
-        ALOGE("FM is not in proper state to set band type\n");
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-//set spacing for successive channels
-int FmRadioController :: SetChannelSpacing
-(
-    long spacing
-)
-{
-    int ret;
-
-    if (cur_fm_state == FM_ON) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                               V4L2_CID_PRV_CHAN_SPACING, spacing);
-    } else {
-        ALOGE("FM is not in proper state to set the channel spacing\n");
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: SetStereo
-(
-)
-{
-    int ret;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-       ret = FmIoctlsInterface::set_audio_mode(fd_driver,
-                                           STEREO);
-    }else {
-       ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-int FmRadioController :: SetMono
-(
-)
-{
-    int ret;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-       ret = FmIoctlsInterface::set_audio_mode(fd_driver,
-                                              MONO);
-    }else {
-       ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-bool FmRadioController :: GetSoftMute
-(
-)
-{
-    int ret = FM_SUCCESS;
-    long mode = SMUTE_DISABLED;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-       ret = FmIoctlsInterface::get_control(fd_driver,
-                            V4L2_CID_PRV_SOFT_MUTE, mode);
-       if(ret == FM_SUCCESS) {
-          ALOGI("FM Get soft mute is successful: %ld\n", mode);
-       }else {
-          ALOGE("FM Get soft mute failed");
-       }
-    }else {
-       ALOGE("FM is not in proper state for getting soft mute\n");
-       ret = FM_FAILURE;
-    }
-    return mode;
-}
-
-int FmRadioController :: Antenna_Switch(int antenna)
-{
-    int ret = 0;
-
-    if (antenna) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                                     V4L2_CID_PRV_ANTENNA, 1);
-    } else {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                                     V4L2_CID_PRV_ANTENNA, 0);
-    }
-    ALOGD("%s, antenna type = %d [ret=%d]\n", __func__, antenna, ret);
-    return ret;
-}
-
-int FmRadioController :: get_fm_state
-(
-)
-{
-    return cur_fm_state;
-}
-
-void FmRadioController :: set_fm_state
-(
-    int state
-)
-{
-    pthread_mutex_lock(&mutex_fm_state);
-    cur_fm_state = state;
-    pthread_mutex_unlock(&mutex_fm_state);
-}
-
-void* FmRadioController :: handle_events
-(
-    void *arg
-)
-{
-    int bytesread;
-    char event_buff[STD_BUF_SIZE];
-    bool status = true;
-    FmRadioController *obj_p = static_cast<FmRadioController*>(arg);
-
-    while(status && !obj_p->event_listener_canceled) {
-        bytesread = FmIoctlsInterface::get_buffer(obj_p->fd_driver,
-                      event_buff, STD_BUF_SIZE, EVENT_IND);
-        for(int i = 0; i < bytesread; i++) {
-            status = obj_p->process_radio_events(event_buff[i]);
-            if(status == false) {
-                break;
-            }
-        }
-    }
-    return NULL;
-}
-
-int FmRadioController :: SetRdsGrpMask
-(
-    int mask
-)
-{
-    int ret;
-
-    if((cur_fm_state != FM_OFF) &&
-       (cur_fm_state != FM_OFF_IN_PROGRESS) &&
-       (cur_fm_state != FM_ON_IN_PROGRESS)) {
-        ret = FmIoctlsInterface::set_control(fd_driver,
-                      V4L2_CID_PRV_RDSGROUP_MASK, mask);
-    }else {
-        ret = FM_FAILURE;
-    }
-    return ret;
-}
-
-void FmRadioController :: handle_enabled_event
-(
-     void
-)
-{
-     char value[PROPERTY_VALUE_MAX] = {'\0'};
-
-     ALOGI("FM handle ready Event\n");
-     FmIoctlsInterface::set_control(fd_driver,
-             V4L2_CID_PRV_AUDIO_PATH, AUDIO_DIGITAL_PATH);
-     property_get("qcom.bluetooth.soc", value, NULL);
-     if (strcmp(value, "rome") != 0) {
-         FmIoctlsInterface::set_calibration(fd_driver);
-     }
-     pthread_mutex_lock(&mutex_turn_on_cond);
-     set_fm_state(FM_ON);
-     pthread_cond_broadcast(&turn_on_cond);
-     pthread_mutex_unlock(&mutex_turn_on_cond);
-}
-
-void FmRadioController :: handle_tuned_event
-(
-     void
-)
-{
-     long freq = -1;
-
-     ALOGI("FM handle Tune event\n");
-     freq = GetChannel();
-     switch(cur_fm_state) {
-         case FM_ON:
-            if(af_enabled && (freq != prev_freq)
-                && (prev_freq > 0)) {
-               ALOGI("AF jump happened\n");
-               is_af_jump_received = true;
-            }
-            break;
-         case FM_TUNE_IN_PROGRESS:
-            pthread_mutex_lock(&mutex_tune_compl_cond);
-            set_fm_state(FM_ON);
-            pthread_cond_broadcast(&tune_compl_cond);
-            pthread_mutex_unlock(&mutex_tune_compl_cond);
-            break;
-         case SEEK_IN_PROGRESS:
-            pthread_mutex_lock(&mutex_seek_compl_cond);
-            set_fm_state(FM_ON);
-            pthread_cond_broadcast(&seek_compl_cond);
-            pthread_mutex_unlock(&mutex_seek_compl_cond);
-            break;
-         case SCAN_IN_PROGRESS:
-            break;
-     }
-     prev_freq = freq;
-}
-
-void FmRadioController :: handle_seek_next_event
-(
-     void
-)
-{
-     ALOGI("FM handle seek next event\n");
-}
-
-void FmRadioController :: handle_seek_complete_event
-(
-     void
-)
-{
-     ALOGI("FM handle seek complete event\n");
-}
-
-void FmRadioController :: handle_raw_rds_event
-(
-     void
-)
-{
-
-}
-
-void FmRadioController :: handle_rt_event
-(
-     void
-)
-{
-     ALOGI("FM handle RT event\n");
-     is_rt_event_received = true;
-}
-
-void FmRadioController :: handle_ps_event
-(
-    void
-)
-{
-    ALOGI("FM handle PS event\n");
-    is_ps_event_received = true;
-}
-
-void FmRadioController :: handle_error_event
-(
-   void
-)
-{
-
-}
-
-void FmRadioController :: handle_below_th_event
-(
-   void
-)
-{
-
-}
-
-void FmRadioController :: handle_above_th_event
-(
-   void
-)
-{
-
-}
-
-void FmRadioController :: handle_stereo_event
-(
-   void
-)
-{
-
-}
-void FmRadioController :: handle_mono_event
-(
-  void
-)
-{
-
-}
-
-void FmRadioController :: handle_rds_aval_event
-(
-  void
-)
-{
-    ALOGI("Got rds_aval_event\n");
-    is_rds_support = true;
-}
-
-void FmRadioController :: handle_rds_not_aval_event
-(
-  void
-)
-{
-    ALOGI("Got rds_not_aval_event\n");
-}
-
-void FmRadioController :: handle_srch_list_event
-(
-  void
-)
-{
-    ALOGI("Got srch list event\n");
-    if (cur_fm_state == SCAN_IN_PROGRESS) {
-        pthread_mutex_lock(&mutex_scan_compl_cond);
-        set_fm_state(FM_ON);
-        pthread_cond_broadcast(&scan_compl_cond);
-        pthread_mutex_unlock(&mutex_scan_compl_cond);
-    }
-}
-
-void FmRadioController :: handle_af_list_event
-(
-  void
-)
-{
-    char raw_rds[STD_BUF_SIZE];
-    int ret;
-    int aflist_size;
-    ULINT lower_band;
-    int AfList[MAX_AF_LIST_SIZE];
-
-    ALOGI("Got af list event\n");
-    ret = FmIoctlsInterface::get_buffer(fd_driver,
-                     raw_rds, STD_BUF_SIZE, AF_LIST_IND);
-    lower_band = FmIoctlsInterface::get_lowerband_limit(fd_driver,
-                     lower_band);
-    ALOGI("raw_rds[0]: %d\n", (raw_rds[0] & 0xff));
-    ALOGI("raw_rds[1]: %d\n", (raw_rds[1] & 0xff));
-    ALOGI("raw_rds[2]: %d\n", (raw_rds[2] & 0xff));
-    ALOGI("raw_rds[3]: %d\n", (raw_rds[3] & 0xff));
-    ALOGI("raw_rds[4]: %d\n", (raw_rds[4] & 0xff));
-    ALOGI("raw_rds[5]: %d\n", (raw_rds[5] & 0xff));
-    ALOGI("raw_rds[6]: %d\n", (raw_rds[6] & 0xff));
-
-    aflist_size = raw_rds[AF_SIZE_IDX] & 0xff;
-    for(int i = 0; i < aflist_size; i++) {
-       AfList[i] = (raw_rds[AF_SIZE_IDX + i * NO_OF_BYTES_AF + 1] & 0xFF) |
-                   ((raw_rds[AF_SIZE_IDX + i * NO_OF_BYTES_AF + 2] & 0xFF) << 8) |
-                   ((raw_rds[AF_SIZE_IDX + i * NO_OF_BYTES_AF + 3] & 0xFF) << 16) |
-                   ((raw_rds[AF_SIZE_IDX + i * NO_OF_BYTES_AF + 4] & 0xFF) << 24);
-       ALOGI("AF: %d\n", AfList[i]);
-    }
-}
-
-void FmRadioController :: handle_disabled_event
-(
-  void
-)
-{
-     //Expected disabled
-     if(cur_fm_state == FM_OFF_IN_PROGRESS) {
-        ALOGI("Expected disabled event\n");
-     }else {//Enexpected disabled
-        ALOGI("Unexpected disabled event\n");
-     }
-
-     set_fm_state(FM_OFF);
-     close(fd_driver);
-     fd_driver = -1;
-
-     //allow tune function to exit
-     pthread_mutex_lock(&mutex_tune_compl_cond);
-     pthread_cond_broadcast(&tune_compl_cond);
-     pthread_mutex_unlock(&mutex_tune_compl_cond);
-     //allow scan function to exit
-     pthread_mutex_lock(&mutex_scan_compl_cond);
-     pthread_cond_broadcast(&scan_compl_cond);
-     pthread_mutex_unlock(&mutex_scan_compl_cond);
-     //Allow seek function to exit
-     pthread_mutex_lock(&mutex_seek_compl_cond);
-     pthread_cond_broadcast(&seek_compl_cond);
-     pthread_mutex_unlock(&mutex_seek_compl_cond);
-}
-
-void FmRadioController :: handle_rds_grp_mask_req_event
-(
-    void
-)
-{
-    SetRdsGrpMask(0);
-}
-
-void FmRadioController :: handle_rt_plus_event
-(
-    void
-)
-{
-    ALOGI("FM handle RT Plus event\n");
-}
-
-void FmRadioController :: handle_af_jmp_event
-(
-    void
-)
-{
-    long freq = -1;
-
-    freq = GetChannel();
-    ALOGI("FM handle AF Jumped event\n");
-    if(af_enabled && (freq != prev_freq)) {
-       ALOGI("AF Jump occured, prevfreq is: %ld, af freq is: %ld\n", prev_freq, freq);
-    }
-    prev_freq = freq;
-}
-
-void FmRadioController :: handle_ert_event
-(
-    void
-)
-{
-    ALOGI("FM handle ERT event\n");
-}
-
-bool FmRadioController :: process_radio_events
-(
-    int event
-)
-{
-    bool ret = true;
-
-    switch(event) {
-        case READY_EVENT:
-            handle_enabled_event();
-            break;
-        case TUNE_EVENT:
-            handle_tuned_event();
-            break;
-        case SEEK_COMPLETE_EVENT:
-            handle_seek_complete_event();
-            break;
-        case SCAN_NEXT_EVENT:
-            handle_seek_next_event();
-            break;
-        case RAW_RDS_EVENT:
-            handle_raw_rds_event();
-            break;
-        case RT_EVENT:
-            handle_rt_event();
-            break;
-        case PS_EVENT:
-            handle_ps_event();
-            break;
-        case ERROR_EVENT:
-            handle_error_event();
-            break;
-        case BELOW_TH_EVENT:
-            handle_below_th_event();
-            break;
-        case ABOVE_TH_EVENT:
-            handle_above_th_event();
-            break;
-        case STEREO_EVENT:
-            handle_stereo_event();
-            break;
-        case MONO_EVENT:
-            handle_mono_event();
-            break;
-        case RDS_AVAL_EVENT:
-            handle_rds_aval_event();
-            break;
-        case RDS_NOT_AVAL_EVENT:
-            handle_rds_not_aval_event();
-            break;
-        case SRCH_LIST_EVENT:
-            handle_srch_list_event();
-            break;
-        case AF_LIST_EVENT:
-            handle_af_list_event();
-            break;
-        case DISABLED_EVENT:
-            handle_disabled_event();
-            ret = false;
-            break;
-        case RDS_GRP_MASK_REQ_EVENT:
-            handle_rds_grp_mask_req_event();
-            break;
-        case RT_PLUS_EVENT:
-            handle_rt_plus_event();
-            break;
-        case ERT_EVENT:
-            handle_ert_event();
-            break;
-        case AF_JMP_EVENT:
-            handle_af_jmp_event();
-            break;
-        default:
-            break;
-    }
-    return ret;
-}
diff --git a/libfm_jni/FmRadioController.h b/libfm_jni/FmRadioController.h
deleted file mode 100644
index 6ce906e..0000000
--- a/libfm_jni/FmRadioController.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __FM_RADIO_CTRL_H__
-#define __FM_RADIO_CTRL_H___
-
-#include <pthread.h>
-#include <ctime>
-
-class FmRadioController
-{
-    private:
-        int cur_fm_state;
-        char af_enabled;
-        bool seek_scan_canceled;
-        bool is_rds_support;
-        bool is_ps_event_received = false;
-        bool is_rt_event_received = false;
-        bool is_af_jump_received = false;
-        bool event_listener_canceled;
-        pthread_mutex_t mutex_fm_state;
-        pthread_mutex_t mutex_turn_on_cond;
-        pthread_mutex_t mutex_seek_compl_cond;
-        pthread_mutex_t mutex_scan_compl_cond;
-        pthread_mutex_t mutex_tune_compl_cond;
-        pthread_cond_t turn_on_cond;
-        pthread_cond_t seek_compl_cond;
-        pthread_cond_t scan_compl_cond;
-        pthread_cond_t tune_compl_cond;
-        char rds_enabled;
-        long int prev_freq;
-        int fd_driver;
-        pthread_t event_listener_thread;
-        int SetRdsGrpMask(int mask);
-        int SetRdsGrpProcessing(int grps);
-        void handle_enabled_event(void);
-        void handle_tuned_event(void);
-        void handle_seek_next_event(void);
-        void handle_seek_complete_event(void);
-        void handle_raw_rds_event(void);
-        void handle_rt_event(void);
-        void handle_ps_event(void);
-        void handle_error_event(void);
-        void handle_below_th_event(void);
-        void handle_above_th_event(void);
-        void handle_stereo_event(void);
-        void handle_mono_event(void);
-        void handle_rds_aval_event(void);
-        void handle_rds_not_aval_event(void);
-        void handle_srch_list_event(void);
-        void handle_af_list_event(void);
-        void handle_disabled_event(void);
-        void handle_rds_grp_mask_req_event(void);
-        void handle_rt_plus_event(void);
-        void handle_ert_event(void);
-        void handle_af_jmp_event(void);
-        void set_fm_state(int state);
-        struct timespec set_time_out(int secs);
-        int GetStationList(uint16_t *scan_tbl, int *max_cnt);
-        int EnableRDS(void);
-        int DisableRDS(void);
-        int EnableAF(void);
-        int DisableAF(void);
-        int SetStereo(void);
-        int SetMono(void);
-        int MuteOn(void);
-        int MuteOff(void);
-        int get_fm_state(void);
-        long GetCurrentRSSI(void);
-        bool GetSoftMute(void);
-    public:
-       FmRadioController();
-       ~FmRadioController();
-       int open_dev(void);
-       int close_dev();
-       int Pwr_Up(int freq);
-       int Pwr_Down(void);
-       long GetChannel(void);
-       int TuneChannel(long);
-       bool IsRds_support();
-       int ScanList(uint16_t *scan_tbl, int *max_cnt);
-       int Seek(int dir);
-       int ReadRDS(void);
-       int Get_ps(char *ps, int *ps_len);
-       int Get_rt(char *rt, int *rt_len);
-       int Get_AF_freq(uint16_t *ret_freq);
-       int SetDeConstant(long );
-       int SetSoftMute(bool mode);
-       int Set_mute(bool mute);
-       int SetBand(long);
-       int SetChannelSpacing(long);
-       int Stop_Scan_Seek(void);
-       int Turn_On_Off_Rds(bool onoff);
-       int Antenna_Switch(int antenna);
-       static void* handle_events(void *arg);
-       bool process_radio_events(int event);
-};
-
-#endif
diff --git a/libfm_jni/LibfmJni.cpp b/libfm_jni/LibfmJni.cpp
deleted file mode 100644
index 52ad029..0000000
--- a/libfm_jni/LibfmJni.cpp
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
-Copyright (c) 2015, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <jni.h>
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
-#include <utils/Log.h>
-#include "FmRadioController.h"
-#include "FM_Const.h"
-
-static FmRadioController * pFMRadio;
-
-jboolean OpenFd(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-    pFMRadio = new FmRadioController();
-    if (pFMRadio)
-        ret = pFMRadio->open_dev();
-    else
-        ret = JNI_FALSE;
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret? JNI_FALSE: JNI_TRUE;
-}
-
-jboolean CloseFd(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->close_dev();
-    else
-        ret = JNI_FALSE;
-
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret? JNI_FALSE: JNI_TRUE;
-}
-
-jboolean TurnOn(JNIEnv *env, jobject thiz, jfloat freq)
-{
-    int ret = 0;
-    int tmp_freq;
-
-    ALOGI("%s, [freq=%d]\n", __func__, (int)freq);
-    tmp_freq = (int)(freq * FREQ_MULT);   //Eg, 87.5 * 1000 --> 87500
-    if (!pFMRadio) {
-        pFMRadio = new FmRadioController();
-    }
-    if (pFMRadio)
-        ret = pFMRadio->Pwr_Up(tmp_freq);
-    else
-        ret = JNI_FALSE;
-
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-jboolean TurnOff(JNIEnv *env, jobject thiz, jint type)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Pwr_Down();
-    else
-        ret = JNI_FALSE;
-
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    if (pFMRadio) {
-        delete pFMRadio;
-        pFMRadio = NULL;
-    }
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-jboolean SetFreq(JNIEnv *env, jobject thiz, jfloat freq)
-{
-    int ret = 0;
-    int tmp_freq;
-
-    tmp_freq = (int)(freq * FREQ_MULT);        //Eg, 87.5 * 10 --> 875
-    if (pFMRadio)
-        ret = pFMRadio->TuneChannel(tmp_freq);
-    else
-        ret = JNI_FALSE;
-
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-jfloat Seek(JNIEnv *env, jobject thiz, jfloat freq, jboolean isUp)
-{
-    int ret = JNI_FALSE;
-    float val = freq;
-
-    if (pFMRadio) {
-        ret = pFMRadio->Set_mute(true);
-        ALOGD("%s, [mute] [ret=%d]\n", __func__, ret);
-        ret = pFMRadio->Seek((int)isUp);
-        ALOGD("%s, [freq=%f] [ret=%d]\n", __func__, freq, ret);
-        if (ret > 0)
-            val = (float)ret/FREQ_MULT;   //Eg, 8755 / 100 --> 87.55
-    }
-
-    return val;
-}
-
-jshortArray ScanList(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-    jshortArray scanList;
-    int chl_cnt = FM_SCAN_CH_SIZE_MAX;
-    uint16_t ScanTBL[FM_SCAN_CH_SIZE_MAX];
-
-    if (pFMRadio)
-        ret = pFMRadio->ScanList(ScanTBL, &chl_cnt);
-    else
-        ret = JNI_FALSE;
-    if (ret < 0) {
-        ALOGE("scan failed!\n");
-        scanList = NULL;
-        goto out;
-    }
-    if (chl_cnt > 0) {
-        scanList = env->NewShortArray(chl_cnt);
-        env->SetShortArrayRegion(scanList, 0, chl_cnt, (const jshort*)&ScanTBL[0]);
-    } else {
-        ALOGE("cnt error, [cnt=%d]\n", chl_cnt);
-        scanList = NULL;
-    }
-
-out:
-    ALOGD("%s, [cnt=%d] [ret=%d]\n", __func__, chl_cnt, ret);
-    return scanList;
-}
-
-jshort GetRdsEvent(JNIEnv *env, jobject thiz)
-{
-    int ret = JNI_FALSE;
-
-    if (pFMRadio)
-        ret = pFMRadio->ReadRDS();
-
-    return ret;
-}
-
-jbyteArray GetPsText(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-    jbyteArray PS;
-    char ps[MAX_PS_LEN];
-    int ps_len = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Get_ps(ps, &ps_len);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-        return NULL;
-    }
-    PS = env->NewByteArray(ps_len);
-    env->SetByteArrayRegion(PS, 0, ps_len, (const jbyte*)ps);
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return PS;
-}
-
-jbyteArray GetRtText(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-    jbyteArray RadioText;
-    char rt[MAX_RT_LEN];
-    int rt_len = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Get_rt(rt, &rt_len);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-        return NULL;
-    }
-    RadioText = env->NewByteArray(rt_len);
-    env->SetByteArrayRegion(RadioText, 0, rt_len, (const jbyte*)rt);
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return RadioText;
-}
-
-jshort GetAfFreq(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-    jshort ret_freq = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Get_AF_freq((uint16_t*)&ret_freq);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-        return 0;
-    }
-    ALOGD("%s, [ret_freq=%d]\n", __func__, ret_freq);
-    return ret_freq;
-}
-
-jint SetRds(JNIEnv *env, jobject thiz, jboolean rdson)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Turn_On_Off_Rds(rdson);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-    }
-    ALOGD("%s, [rdson=%d] [ret=%d]\n", __func__, rdson, ret);
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-jboolean StopSrch(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Stop_Scan_Seek();
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-    }
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-jint SetMute(JNIEnv *env, jobject thiz, jboolean mute)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->Set_mute(mute);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-    }
-    ALOGD("%s, [mute=%d] [ret=%d]\n", __func__, (int)mute, ret);
-    return ret?JNI_FALSE:JNI_TRUE;
-}
-
-/******************************************
- * Inquiry if RDS is support in driver.
- * Parameter:
- *      None
- *Return Value:
- *      1: support
- *      0: NOT support
- *      -1: error
- ******************************************/
-jint IsRdsSupport(JNIEnv *env, jobject thiz)
-{
-    int ret = 0;
-
-    if (pFMRadio)
-        ret = pFMRadio->IsRds_support();
-    else
-        ret = JNI_FALSE;
-    if (!ret) {
-        ALOGE("%s, error, [ret=%d]\n", __func__, ret);
-    }
-    ALOGD("%s, [ret=%d]\n", __func__, ret);
-    return ret;
-}
-
-/******************************************
- * SwitchAntenna
- * Parameter:
- *      antenna:
-                0 : switch to long antenna
-                1: switch to short antenna
- *Return Value:
- *          0: Success
- *          1: Failed
- *          2: Not support
- ******************************************/
-jint SetAntenna(JNIEnv *env, jobject thiz, jint antenna)
-{
-    int ret = 0;
-    jint jret = 0;
-    int ana = -1;
-
-    if (0 == antenna) {
-        ana = FM_LONG_ANA;
-    } else if (1 == antenna) {
-        ana = FM_SHORT_ANA;
-    } else {
-        ALOGE("%s:fail, para error\n", __func__);
-        jret = JNI_FALSE;
-        goto out;
-    }
-    if (pFMRadio)
-        ret = pFMRadio->Antenna_Switch(ana);
-    else
-        ret = JNI_FALSE;
-    if (ret) {
-        ALOGE("switchAntenna(), error\n");
-        jret = 1;
-    } else {
-        jret = 0;
-    }
-out:
-    ALOGD("%s: [antenna=%d] [ret=%d]\n", __func__, ana, ret);
-    return jret;
-}
-
-static const char *classPathNameFM = "com/android/fmradio/FmNative";
-
-static JNINativeMethod gMethods[] = {
-    {"openDev",       "()Z",   (void*)OpenFd },
-    {"closeDev",      "()Z",   (void*)CloseFd },
-    {"powerUp",       "(F)Z",  (void*)TurnOn },
-    {"powerDown",     "(I)Z",  (void*)TurnOff },
-    {"tune",          "(F)Z",  (void*)SetFreq },
-    {"seek",          "(FZ)F", (void*)Seek },
-    {"autoScan",      "()[S",  (void*)ScanList },
-    {"stopScan",      "()Z",   (void*)StopSrch },
-    {"setRds",        "(Z)I",  (void*)SetRds  },
-    {"readRds",       "()S",   (void*)GetRdsEvent },
-    {"getPs",         "()[B",  (void*)GetPsText },
-    {"getLrText",     "()[B",  (void*)GetRtText},
-    {"activeAf",      "()S",   (void*)GetAfFreq},
-    {"setMute",       "(Z)I",  (void*)SetMute},
-    {"isRdsSupport",  "()I",   (void*)IsRdsSupport},
-    {"switchAntenna", "(I)I",  (void*)SetAntenna},
-};
-
-int register_android_hardware_fm(JNIEnv* env)
-{
-        return jniRegisterNativeMethods(env, classPathNameFM, gMethods, NELEM(gMethods));
-}
-
-jint JNI_OnLoad(JavaVM *jvm, void *reserved)
-{
-  JNIEnv *e;
-  int status;
-   ALOGE("FM : loading FM-JNI\n");
-
-   if(jvm->GetEnv((void **)&e, JNI_VERSION_1_6)) {
-       ALOGE("JNI version mismatch error");
-      return JNI_ERR;
-   }
-
-   if ((status = register_android_hardware_fm(e)) < 0) {
-       ALOGE("jni adapter service registration failure, status: %d", status);
-      return JNI_ERR;
-   }
-   return JNI_VERSION_1_6;
-}
-
