diff options
author | juncao <juncao@codeaurora.org> | 2015-12-29 17:43:35 +0800 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2016-01-26 11:58:28 +0000 |
commit | 208ee64877e3eae68a21d422bf7f05ff6a747440 (patch) | |
tree | 47a6d584a7197ece54c4af6aee006c08d82b6270 /fmapp2/src/com | |
parent | 6e7eaa78b6fe52acf98b3e7b8152b79bf0156b72 (diff) | |
download | android_hardware_qcom_fm-208ee64877e3eae68a21d422bf7f05ff6a747440.tar.gz android_hardware_qcom_fm-208ee64877e3eae68a21d422bf7f05ff6a747440.tar.bz2 android_hardware_qcom_fm-208ee64877e3eae68a21d422bf7f05ff6a747440.zip |
FM: Do not stop FMRadioService if FM is still on
Fix the issue: After pressing back-key or rotating DUT, FM will stop.
Change-Id: If9c3b5001963e837dde699a844a6406acd892126
Signed-off-by: juncao <juncao@codeaurora.org>
CRs-Fixed: 956792
Diffstat (limited to 'fmapp2/src/com')
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadio.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 45b68bc..7de7562 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -2993,14 +2993,21 @@ public class FMRadio extends Activity 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 |