diff options
author | Ayaz Ahmad <aahmad@codeaurora.org> | 2013-09-30 18:30:16 +0530 |
---|---|---|
committer | Ayaz Ahmad <aahmad@codeaurora.org> | 2013-09-30 20:05:29 +0530 |
commit | 6b86f449f52ab28f249ffeceee513828ebcb8548 (patch) | |
tree | d6a26694f065db6a7ea6a6df1aecad15e8c3a599 /qcom | |
parent | de72140788f0aa978f0d9186a5955ce9ffbf6f3e (diff) | |
download | android_hardware_qcom_fm-6b86f449f52ab28f249ffeceee513828ebcb8548.tar.gz android_hardware_qcom_fm-6b86f449f52ab28f249ffeceee513828ebcb8548.tar.bz2 android_hardware_qcom_fm-6b86f449f52ab28f249ffeceee513828ebcb8548.zip |
fm: Handle seek event properly
FM application layer receives wrong frequency
on seek up/down completion. Inform registered
client about seek completion when tune event is
received after seek complete event.
Change-Id: I1f8ecb1f1a35400e99e67987e86577acf85c08e0
CRs-Fixed: 549726
Diffstat (limited to 'qcom')
-rw-r--r-- | qcom/fmradio/FmReceiver.java | 8 | ||||
-rw-r--r-- | qcom/fmradio/FmRxEventListner.java | 22 | ||||
-rw-r--r-- | qcom/fmradio/FmTransceiver.java | 3 |
3 files changed, 25 insertions, 8 deletions
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java index 533814b..b1bdb31 100644 --- a/qcom/fmradio/FmReceiver.java +++ b/qcom/fmradio/FmReceiver.java @@ -39,7 +39,7 @@ import android.os.SystemProperties; public class FmReceiver extends FmTransceiver { - public static int mSearchState = 0; + public static int mSearchState = subSrchLevel_NoSearch; static final int STD_BUF_SIZE = 256; static final int GRP_3A = 64; @@ -630,8 +630,14 @@ public class FmReceiver extends FmTransceiver break; case subSrchLevel_SrchComplete: /* Update the state of the FM device */ + mSearchState = subSrchLevel_NoSearch; setFMPowerState(FMState_Rx_Turned_On); break; + case subSrchLevel_SrchAbort: + break; + default: + mSearchState = subSrchLevel_NoSearch; + break; } } diff --git a/qcom/fmradio/FmRxEventListner.java b/qcom/fmradio/FmRxEventListner.java index 376e430..f4613e8 100644 --- a/qcom/fmradio/FmRxEventListner.java +++ b/qcom/fmradio/FmRxEventListner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009,2012, The Linux Foundation. All rights reserved. + * 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: @@ -104,16 +104,26 @@ class FmRxEventListner { case 1: Log.d(TAG, "Got TUNE_EVENT"); freq = FmReceiverJNI.getFreqNative(fd); - if (freq > 0) - cb.FmRxEvRadioTuneStatus(freq); - else - Log.e(TAG, "get frequency command failed"); + state = FmReceiver.getSearchState(); + switch(state) { + case FmTransceiver.subSrchLevel_SeekInPrg : + Log.v(TAG, "Current state is " + state); + FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); + Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn"); + cb.FmRxEvSearchComplete(freq); + break; + default: + if (freq > 0) + cb.FmRxEvRadioTuneStatus(freq); + else + Log.e(TAG, "get frequency command failed"); + break; + } break; case 2: Log.d(TAG, "Got SEEK_COMPLETE_EVENT"); state = FmReceiver.getSearchState(); switch(state) { - case FmTransceiver.subSrchLevel_SeekInPrg : case FmTransceiver.subSrchLevel_ScanInProg: Log.v(TAG, "Current state is " + state); FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); diff --git a/qcom/fmradio/FmTransceiver.java b/qcom/fmradio/FmTransceiver.java index 8a02c2d..20f0544 100644 --- a/qcom/fmradio/FmTransceiver.java +++ b/qcom/fmradio/FmTransceiver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. + * 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: @@ -57,6 +57,7 @@ public class FmTransceiver * These are the sub-levels of FM Search operations : seek/scan/auto-preset. * Used internally for distinguishing between the various search operations. */ + public static final int subSrchLevel_NoSearch = -1; public static final int subSrchLevel_SeekInPrg = 0; public static final int subSrchLevel_ScanInProg = 1; public static final int subSrchLevel_SrchListInProg = 2; |