FM: Ignore VOLUME_CHANGED_ACTION intent when
    fm is turned off.

 - when fm is turned off and fm app is running then
   if VOLUME_CHANGED_ACTION intent comes,
   no need to apply changed fm volume
 - set default FM OutPut Device to WiredHeadset

CRs-Fixed: 2374389

Change-Id: I8fccb09eab41f0007157b34af41d654a41a891da
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 8faa313..9b8647d 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -143,7 +143,7 @@
    private boolean mServiceInUse = false;
    private static boolean mMuted = false;
    private static boolean mResumeAfterCall = false;
-   private static int mAudioDevice = 0;
+   private static int mAudioDevice = AudioDeviceInfo.TYPE_WIRED_HEADPHONES;
    MediaRecorder mRecorder = null;
    MediaRecorder mA2dp = null;
    private boolean mFMOn = false;
@@ -584,6 +584,10 @@
                             stopRecording();
                         }
                     } else if( action.equals(AudioManager.VOLUME_CHANGED_ACTION)) {
+                        if(!isFmOn()) {
+                            Log.d(LOGTAG, "FM is Turned off ,not applying the changed volume");
+                            return;
+                        }
                         int streamType =
                               intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);
                         if (streamType == AudioManager.STREAM_MUSIC) {