summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhalid Zubair <kzubair@cyngn.com>2016-06-28 12:14:22 -0700
committerKhalid Zubair <kzubair@cyngn.com>2016-06-30 10:51:27 -0700
commit218df606ceca8083b283f317834249293b772441 (patch)
treecfe647ff9857835459fdcd724ec7b24235c1830f
parentd308e8e1f4ef715d85d12bed3d6b73ee6022a547 (diff)
downloadandroid_packages_apps_FMRadio-stable/cm-13.0-ZNH2KB.tar.gz
android_packages_apps_FMRadio-stable/cm-13.0-ZNH2KB.tar.bz2
android_packages_apps_FMRadio-stable/cm-13.0-ZNH2KB.zip
Keep main activity when recording is cancelledstable/cm-13.0-ZNH2KB
When a recording (running in background) is stopped and the user returns to the FM app, the recording activity is seen with a 'Save Recording?' popup. After responding keep/discard the app exits itself instead of returning to the main activity. This happens because the service calls exitFm() and activity finish() when the service receives the musicservice 'pause' command (e.g. when the camera starts). Instead of a complete shutdown, stop recording and pause (powerDown) the FM playback. This leaves the service in a funtional state and the recording activity can save/discard the recording and return to the main screen. FEIJ-1373 Change-Id: Ia3209b32cea193e76fb7b0b26b1ba05b88bd9d2c (cherry picked from commit 480142b3781b394a9f088cba0bc51d8ecbbc4faa)
-rw-r--r--src/com/android/fmradio/FmService.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java
index d197be4..f6e98c3 100644
--- a/src/com/android/fmradio/FmService.java
+++ b/src/com/android/fmradio/FmService.java
@@ -248,7 +248,14 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan
String command = intent.getStringExtra("command");
Log.d(TAG, "onReceive, action = " + action + " / command = " + command);
// other app want FM stop, stop FM
- if ((SOUND_POWER_DOWN_MSG.equals(action) && CMDPAUSE.equals(command))) {
+
+ if (CMDPAUSE.equals(command)) {
+ // need remove all messages, make power down will be execute
+ mFmServiceHandler.removeCallbacksAndMessages(null);
+ Log.d(TAG, "Stopping FM playback");
+ powerDownAsync();
+ } else if (SOUND_POWER_DOWN_MSG.equals(action)) {
+ // phone shut down, so exit FM
// need remove all messages, make power down will be execute
mFmServiceHandler.removeCallbacksAndMessages(null);
exitFm();
@@ -692,6 +699,10 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan
return true;
}
+ if (mFmRecorder != null) {
+ stopRecording();
+ }
+
setMute(true);
setRds(false);
enableFmAudio(false);