summaryrefslogtreecommitdiffstats
path: root/src/com/android/fmradio/FmService.java
Commit message (Collapse)AuthorAgeFilesLines
* Keep main activity when recording is cancelledKhalid Zubair2016-06-281-1/+12
| | | | | | | | | | | | | | | | | | | | 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
* Handle recording without using MediaRecorderKhalid Zubair2016-06-281-18/+47
| | | | | | | | | | | | | | | | | | | | | MediaRecorder creates a new AudioRecord for the tuner internally and causes two audio input devices to be in-use during recording. Replace MediaRecorder with a custom recorder that gets fed by the same AudioRecord instance used for playback when SW rendering is in affect. This change helps workaround some bugs in the Audio HAL during fm recording (two tuner input devices) and concurrent mic recording. Force SW rendering when recording starts so that the recorder works and attempt to start the audio patch when recording ends. In onAudioPatchListUpdate there is no need to call initAudioRecordSink() before calling startRender() because startRender() will call initAudioRecordSink(). CYNGNOS-2819, KIPPER-687, FEIJ-1372 Change-Id: Iddd9f325892ca4482c3977dcadc627352e6f5bb2
* Fix stuck recording ui when recording is abortedKhalid Zubair2016-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the recording activity is paused and recording is canceled (e.g. loss of audio focus), the recording UI appears frozen when the activity resumes. This happens due to two issues: 1. When the activity is paused it ignores the cancellation MSG_FM_EXIT event. 2. When the activity is destroyed, it does not check the current state of the Recorder when it resumes. In both these cases, the activity assumes that the recording is still ongoing but the stop button fails silently when there is no recording to stop. Fix these issues by querying the recording status when the activity resumes and show the save dialog if the recording was stopped. oResume() and onServiceConnected() have been consolidated in to onResumeWithService() and handles checking the status of the service, starting recording and revisiting the activity. In FmService, the recording state returns 'INVALID' before the first recording starts because the recorder has not yet been created. Querying the recording state before starting the 2nd recording returns 'IDLE'. Treat the 1st and 2nd cases the same and return 'IDLE'. FEIJ-1373 Change-Id: I8a6f85f067a4c5737c5e00e6c035ba743c373e8f
* Remove false log warningsKhalid Zubair2016-06-251-1/+0
| | | | | | | The log should not be a warning as it occurs often during normal operation, Change-Id: I7e8fc3b8499dfa48988c8949d9527c905f44cbe3
* FmService: Fix crash when plug-in/out headsetKeith Mok2016-06-161-1/+9
| | | | | | | | | | | | There is race condition between the RenderThread and main thread using the object mAudioTrack and mAudioRecord. Stop and re-create the RenderThread when we need to create new instance of mAudioTrack and mAudioRecord to avoid the race condition. CYNGNOS-2775 FEIJ-1227 Change-Id: I919010fdcc8aad76f1fc5debe6729b4d2a6954dc
* Revert "tracks: Check track states before transitioning states"Keith Mok2016-06-161-7/+4
| | | | | | | | | | This does not fix the race condition problem CYNGNOS-2775 FEIJ-1227 This reverts commit 0445f98ed0ba3c3fe682eb617660ae5d385a0216. Change-Id: I8c4f5fb7f064286b6895e084ec726bcbfcce0484
* tracks: Check track states before transitioning statesDiogo Ferreira2016-05-101-4/+7
| | | | | | | | | | Prevents sporadic crashes when the user plugs/unplugs the headset rapidly. These were caused by performing track operations such as start, stop and record before checking whether the tracks had been stopped before. Change-Id: I54b5ba102ffbed4c453ee5f15533467e5f4771fd Ticket: CYNGNOS-2775
* improve audio startup performaceAndré Rivotti Casimiro2016-05-091-1/+3
| | | | | | | Create the needed audio patches as soon as possible, executing the visual transition only after they are created. Change-Id: Ic4ac4bb146836cb17ff144652b8f2d0f8dd612a9
* fmradio: Add an optional static library targetDiogo Ferreira2016-05-031-1/+1
| | | | | | | | | | FMRadio is not exposed as a framework functionality and this makes it harder to expose it to some use cases such as testing. This patch turns the non-ui components of the app into a static library that can be linked by other apps. Change-Id: Ifafd105461303cbaea5f1e788e1c0af95ad894c9
* FmService: Make usage of audiopatch a build-time optionRicardo Cerqueira2016-05-021-21/+23
| | | | | | | | | Change Ib732c8e8328035d2b3e60b7823446d1d75b3c107 assumes all devices have issues with direct volume configuration and require audiopatching to be disabled in favor of soft rendering. Don't do that, make it configurable. Change-Id: Ia334052043a292d37b44e727769232e55a673d35
* Fix incomplete app terminationRicardo Cerqueira2016-04-051-0/+1
| | | | | | | | | | | | | When dismissing the task from the recents list, the app would go away but the service would stay up. Relaunching the app would then complete the termination and result in a second shutdown. Stop the service on task removal to avoid the weird double-start artifact. Ref CRACKLING-1025 Change-Id: I3bc3be75501294da4a526f0634149449f645edc2
* FMRadio: Immediately mute AudioTrack once stopRender is calledEthan Chen2016-03-241-0/+3
| | | | | | | | | | | | * This is kind of a hack, to squelch any possible output from when stopRender is called to when AudioTrack.stop is called. This is because the render thread may be playing audio and not respond immediately to a stopRender call, resulting in garbage being written to the output once the FM input is shut down. (such as in the case of the headphone/antenna being removed). REF: KIPPER-560 Change-Id: Id9dab17ca95a41e5a98c16fc8bc58d9e414e4efc
* FMRadio: Pause and stop AudioTrack before stoppingEthan Chen2016-03-241-0/+2
| | | | | | | | | * According to documentation, stop will continue to play the last buffer, while pause immediately halts playback. * Pause to reduce latency to stop, then flush the AudioTrack buffer before actually stopping in the render thread. Change-Id: I0b497cd6b95b0921f63796746c7279a4f931dbd3
* FMRadio: Run render thread at THREAD_PRIORITY_AUDIOEthan Chen2016-03-241-0/+2
| | | | Change-Id: Ia7c558bb02b424e96e0af4d01684b7e51fd85bd4
* [FM] Temporary: use software rendering for FM-to-earphone playbackMatt Wagantall2015-11-231-0/+4
| | | | | | | | | | | | | | | | The Qualcomm audio HAL does not yet support volume control when direct FM-to-sink patches are created. Force use of software rendering (reading from AudioRecord and writing to AudioTrack) for now, as this has working software volume control. This change is obviously bad for power, as it requires SW involvement in the audio path. The change should be reverted when source HW volume control is available with audio patches. Playback through speaker, BT, and other sinks already go use software rendering and should be unaffected by this change. Change-Id: Ib732c8e8328035d2b3e60b7823446d1d75b3c107
* [FM] Fallback if createAudioPatch failsDhananjay Kumar2015-04-071-5/+21
| | | | | | | | | CreatePatch returns error if a port is connected to an output device on a hal version less than 3.0. Hence on error fallback same path for HEADSET/Headphone as is implemented for speaker. Change-Id: I7f165849038cb867ce6799777e92052ced147ef4
* am 06ba26e7: am 3e855750: am 4f33aa31: [FM] Earphone mode incoming call ↵Benson Huang2015-03-251-0/+18
|\ | | | | | | | | | | | | ringtone issue in loudspeaker * commit '06ba26e7da989bfab8e49fe7fae03efd563472ae': [FM] Earphone mode incoming call ringtone issue in loudspeaker
| * [FM] Earphone mode incoming call ringtone issue in loudspeakerBenson Huang2015-03-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | Listen to FM -> switch to loudspeaker mode -> now go to music player to listen to music with earphone connected, Music switches to loudspeaker mode automatically even when the earphones are connected. Bug 19729515 from: https://partner-android-review.googlesource.com/#/c/209191/ Change-Id: I17f84a6ceb63783ca7627eab2b8dd6bf59fe151b Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* | renaming of MediaRecorder.AudioSource.FM_TUNEREric Laurent2015-03-091-1/+1
|/ | | | | | | Update after renaming of MediaRecorder.AudioSource.FM_TUNER to MediaRecorder.AudioSource.RADIO_TUNER. Change-Id: I350404e502796bb68533ae26d729dbe8f522319b
* [FM] There is no sound output after resuming playing when FM is over BTBenson Huang2015-01-281-13/+10
| | | | | | | | | | | | Launch FM radio and play -> Stop FM -> Turn on BT and connect with BT earphone with A2DP -> Open FM and resume playing, there is no sound output after step 4. Bug 19171819 from: https://partner-android-review.googlesource.com/#/c/199683/ Change-Id: I01d3975387840d9356c6f80d1f411eeb8526f930 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Fix 18847131 There is no sound output from BT earphone while BT ↵Hochi Huang2015-01-131-12/+45
| | | | | | | | | | earphone is connected Review: https://partner-android-review.git.corp.google.com/#/c/192445 Signed-off-by: Hochi Huang <hochi.huang@mediatek.com> Change-Id: Ic762271f980b61503ae4e1b32118bf34ad40577f
* [FM] There is no sound in speaker while playing FM in speaker modeBenson Huang2015-01-061-1/+21
| | | | | | | | | | | | | Launch FM and play a station -> Plug out headphones -> Plug in headphones -> Switch to speaker mode, There is no sound via speaker. The fix is to let FM sound output via speaker. from: https://partner-android-review.googlesource.com/#/c/192523/3 Bug 18795162 Change-Id: I16fce6914ea0b3d463c1205708d11265925097e4 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* Merge "[FM] "Speaker on/headset" should not be available while BT earphone ↵Nicholas Sauer2014-12-311-0/+13
|\ | | | | | | is connected" into lmp-mr1-dev
| * [FM] "Speaker on/headset" should not be available while BT earphone is connectedBenson Huang2014-12-311-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Launch FM Radio and play -> Turn on BT and connect with BT earphone -> Enter FM again and check "Speaker on/headset" , "Speaker on/headset" will be available. The fix is to also check BT headset is connected or not when enabling menu item. Bug 18795153 from: https://partner-android-review.googlesource.com/#/c/192377/2 Change-Id: Ia6d78b85563389f193860820447273a27e76d050 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* | [FM] There is a pop noise when tapping stop button to resume playingBenson Huang2014-12-301-12/+28
|/ | | | | | | | | | | | | | | | Launch FM and play -> Tap stop button to stop playing -> Tap stop button to resume playing -> Check the audio when tapping stop button in step 3, there is a pop noise when tapping start button to resume playing. The fix is to check if it needs to ignore first three frames of audio data from AudioRecord to avoid pop noise. from: https://partner-android-review.googlesource.com/#/c/192415/2 Bug 18809647 Change-Id: I09ffc058ee3e87296e8d3d98fc2909ec77046e1d Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] FM will not resume playing after replugging in headphonesBenson Huang2014-12-231-5/+5
| | | | | | | | | | | | | | | | | | Launch FM and play -> Tap more button and select "Start recording" -> Plug out headphones while recording -> Plug in headphones and check the audio -> Tap "Save" button and check the audio -> Tap play button and check the audio, FM can not resume playing after step 4(5 and 6). The fix is to add FmRecordActivity foreground control. Bug 18794870 https://partner-android-review.git.corp.google.com/#/c/189795/ Change-Id: I565c641413836f34c88e2643afd9972f198177da Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Radio text should not display in notification bar after changing channelBenson Huang2014-12-221-5/+5
| | | | | | | | | | | | | | | | | | | Launch FM and play a channel that has radio text -> Change to other channel that doesn't radio text -> Press home button and pull down notification bar -> Check the FM information in notification bar, Radio text will display in notification bar after changing channel. The fix is to update notification when the channel doesn't have radio text. https://partner-android-review.git.corp.google.com/#/c/189803/ Bug 18826692 Change-Id: I8746f223acdbf5a316e3b6553f494d1f30bd84f4 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM]Fix Bug 18809496 It will pop a sound of noise when switching FM from ↵Hochi Huang2014-12-221-180/+17
| | | | | | | | | earphone mode to speaker mode https://partner-android-review.git.corp.google.com/#/c/189743/ Signed-off-by: Hochi Huang <hochi.huang@mediatek.com> Change-Id: Ib78347817a340be22686511f4340acfa186571df
* [FM] FM volume will not be changed after stop and resumeBenson Huang2014-12-161-1/+4
| | | | | | | | | | | | | | | | | | | | | Launch FM Radio and play -> Change volume via keyboard from maximal to minimal/minimal to maximal -> Tap "Stop" button to stop FM -> Tap "Stop" button to resume FM -> Check the volume after resuming FM, FM volume will not change to the corresponding volume. We use MediaSession.setPlaybackToRemove(VolumeProvider vp) for audio patch getting volume update event from audio framework. The initial volume is not right, it needs to keep the same with stream STREAM_MUSIC. Bug 18762406 Review: https://partner-android-review.git.corp.google.com/#/c/188807 Signed-off-by: Benson Huang <benson.huang@mediatek.com> Change-Id: Ibbd82de6cf9e510a0c8e2cb9ded2fc34ca2db16e
* [FM] Sometimes FM icon will not appear in the notification bar after ↵Benson Huang2014-12-161-1/+2
| | | | | | | | | | | | | | | | | | | searching out stations in the background Launch FM and play -> Search stations -> Tap "Home" key and wait for searching out stations -> Repeat step2~3 several times -> Check the notification bar every time, sometimes FM icon will not appear in the notification bar after searching out stations in the background. The fix is to set mIsScanning false before notifying activity. https://partner-android-review.git.corp.google.com/#/c/189364/ Bug 18760881 Change-Id: I46ae2e679d40b8200fbf52209ef79afe5bc3dc40 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] The radio text will disappear when stopping FMBenson Huang2014-12-161-2/+0
| | | | | | | | | | | | | | | | | Launch FM and play a station with radio text -> Press stop button -> Check the radio text, radio text disappear when stopping FM. The fix is not to change radio text when stopping FM. Do not set RDS DB empty when stopping RDS thread because we will read it from DB. https://partner-android-review.git.corp.google.com/#/c/188805/ Bug 18762207 Change-Id: Ib450806e96b28c02f1af02fcd084ede1ea5a056c Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Radio text is not updated in notification barBenson Huang2014-12-161-0/+3
| | | | | | | | | | | | | | | | | | Launch FM and play a station with program service(PS) and radio text(RT) -> Use siliab tool to rename the PS and RT as null string -> Press home button and pull down notification bar -> Check the FM information in notification bar, radio text is not updated in notification bar. The fix is to let radio text been updated in notifcation bar when radio text is changed. https://partner-android-review.git.corp.google.com/#/c/188806/ Bug 18762405 Change-Id: I77f4ec5cd9459fabfec63f7e236a7bc96cd79f13 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Fix typo of anntenna to antennaBenson Huang2014-12-151-11/+11
| | | | | | | | | | | | | | There are many typos of antenna (e.g. ANNTENNA, anntenna). The CL is to fix the typos. Bug: 18737759 Review: https://partner-android-review.git.corp.google.com/#/c/188580 Signed-off-by: Benson Huang <benson.huang@mediatek.com> Change-Id: Ic8454a4b9678d60a734a59af65d6bbefbca1411a
* [FM] FM Radio should reduce volume when getting ↵Benson Huang2014-12-091-0/+13
| | | | | | | | | | | | | | | AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK When using Talkback (a11y app for visually impaired end users) with the FM Radio app, it can be hard to hear the Talkback audio feedback as the FM Radio output is mixed in with Talkback. The fix is to handle this issue with AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK. Bug 16737172 Change-Id: I836c6a298918829645f153768c0f0fa6afc5429c Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Remove some unnecessary mediatek keywordsBenson Huang2014-12-041-3/+3
| | | | | | | | | | | | | | There are some unnecessary mediatek keywords in FmService.java. The fix is to remove unnecessary mediatek keywords. https://partner-android-review.git.corp.google.com/#/c/187896/2 Bug: 18590163 Change-Id: I9e846ac80753ecae5e2a0804fa7d090328463cdb Signed-off-by: Benson Huang <benson.huang@mediatek.com>
* [FM] Move FM Radio sources - Part 4Benson Huang2014-12-021-0/+2738
Move FM Radio sources From: vendor/mediatek/proprietary/packages/apps/FmRadio/ To: packages/apps/FMRadio Bug 18057506 https://partner-android-review.googlesource.com/#/c/187247/ Change-Id: Ia6b8b2dfac58a55cffa8d5223ca2ca5a8ca1f9b1 Signed-off-by: Benson Huang <benson.huang@mediatek.com>