Promotion of fm.lnx.1.0-00005.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
956285   I60debca73cf883032cde0abe23f6eeea6e97f323   FMRecord: Add REAL_GET_TASKS permissions.
956792   If9c3b5001963e837dde699a844a6406acd892126   FM: Do not stop FMRadioService if FM is still on

Change-Id: Ic89adb313d4e8b96b84debef6ef2f141e1954296
CRs-Fixed: 956792, 956285
diff --git a/FMRecord/AndroidManifest.xml b/FMRecord/AndroidManifest.xml
index 96c0177..c1df646 100644
--- a/FMRecord/AndroidManifest.xml
+++ b/FMRecord/AndroidManifest.xml
@@ -34,6 +34,7 @@
       <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>
 
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index ff48847..c364885 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -2976,14 +2976,21 @@
 
    public  void unbindFromService(Context context) {
       ServiceBinder sb = (ServiceBinder) sConnectionMap.remove(context);
+      boolean isFmOn = isFmOn();
       Log.e(LOGTAG, "unbindFromService: Context");
       if (sb == null) {
          Log.e(LOGTAG, "Trying to unbind for unknown Context");
          return;
       }
       context.unbindService(sb);
-      Log.e(LOGTAG, "stop FM radio service");
-      context.stopService(new Intent(context, FMRadioService.class));
+
+      if (isFmOn) {
+         Log.d(LOGTAG, "FM is still on");
+      } else {
+         Log.e(LOGTAG, "stop FM radio service");
+         context.stopService(new Intent(context, FMRadioService.class));
+      }
+
       if (sConnectionMap.isEmpty()) {
          // presumably there is nobody interested in the service at this point,
          // so don't hang on to the ServiceConnection