Skip to content

Revamped AOSP FMRadio for Android 12+ on Qualcomm/MediaTek-based SoCs

Notifications You must be signed in to change notification settings

iusmac/RevampedFMRadio

Repository files navigation

RevampedFMRadio app is a resurrection of the old but gold AOSP FMRadio app actively developed for Android 5.0 (API level 21). On the internet, you may find different variations and implementations for QCOM and MTK SoCs. Here we're using latest source codebase from LineageOS 18.1 (Android 11).

LineageOS dropped AOSP FMRadio in favor of FMApp2 (com.caf.fmradio) starting from LineageOS 19.0 (Android 12) release. Despite FMApp2 has a "freshy" codebase and API level 31 support, it doesn't work well in general (randomly stops & freezes) and provides a poor overall UI/UX.

Codebase: https://github.com/LineageOS/android_packages_apps_FMRadio

AOSP FMRadio RevampedFMRadio

What's done (click to expand spoilers):

  1. Wireless (no headset) mode

    Added support for wireless support. The RevampedFMRadio can be started without headset plugged in, instead we force use of built-in short antenna by default. Most local frequencies will work fine, but to get better quality and detailed RDS data, a long antenna (headset or just a jack cable) may be required.

  2. MPEG audio codec for recordings

    Switched to MPEG (.mp3) audio codec for recordings. This way we can play the recording in system apps (Music app, File Manager etc.). Previously, the 3GPP (.3gpp) audio codec was used, which doesn't seems to be well supported.

  3. "Recordings" as saving directory

    Changed saving directory for recordings to "Recordings". This is the proper place on Android 12+. Playlists (.m3u8) files will be stored in the "Music" directory as before.

  4. Dark mode support

    RevampedFMRadio app will by default follow system theme in all activities.

  5. "Material You" color palette

    Implemented "Material You" color palette introduced in Android 12. RevampedFMRadio app will by default follow system accent colors in all activities.

  6. Revamped UI
    • redesigned favorite tiles
    • rounded corners like in QS
    • updated icons etc.
  7. Better UX

    Improved favorites scrolling, playlist managing and many other small things.

  8. Grid view layout on the station list

    Replaced list view with grid view on station list activity. The station list now follows same layout as the favorites.

  9. File size when recording

    Added displaying in real-time of the recording file size on the recording activity.

  10. Station total

    Added displaying of the total of known stations on the station list activity.

  11. Media player notification

    Converted simple notification into a media player notification. The "stop" button was replaced with a play/pause button.

  12. Media session support
    • Full metadata support

      This way the Android OS will treat the RevampedFMRadio app as a music source. It will allow to the user to apply sound effects (Dirac, Dolby Atmos) on the output audio.

    • Full headset multimedia controls support

      Headset/headphones and other devices can now pause/resume the playback and jump/skip a station. Classic headsets with only one (hook) button, must press the hook button twice to jump to the next station and three times to jump to the previous station.

  13. Android 13 themed icons support

  14. Fixed RDS data retrieving (Qualcomm SoC only)

    This essential feature was broken on QCOM SoCs for years even on official LineageOS releases.

  15. Auto power save switch on SoC (Qualcomm SoC only)

    The driver will be switched to low power mode to improve battery life once the device enters idle state (screen off), as we know for a fact that we will have fewer interruptions.

Installation

  1. Clone the branch that corresponds to your device SoC, for example:

    • Use as an in-tree package within the device tree (Recommended):
      git clone --depth=1 -b qcom https://github.com/iusmac/RevampedFMRadio.git
    • Use as a project via Local Manifests (Not recommended):
      <remote name="iusmac" fetch="https://github.com/iusmac" revision="qcom" />
      <project path="packages/apps/RevampedFMRadio" name="RevampedFMRadio" remote="iusmac" />
      NOTE: there's a high chance of getting something broken if you always fetch upstream changes. It's recommended to go with in-tree package within your device tree, and from time to time manually merge and check upstream changes.
  2. Add app to device.mk:

PRODUCT_PACKAGES += \
    RevampedFMRadio

Note: RevampedFMRadio package will override FMRadio package if the ROM sources still ship it.

Qualcomm SoC-specific part

  1. Add JNI library to device.mk:
PRODUCT_PACKAGES += \
    libqcomfmjni
  1. Make sure you have vendor.qcom.bluetooth.soc prop in your vendor.prop file. You may already have something similar, like vendor.bluetooth.soc, but it's legacy. Rename if proprietary blobs support new prop name or duplicate the value using new prop name to ensure RevampedFMRadio can properly comunicate to your device's Bluetooth SoC.
  2. Allow app to read vendor properties mentioned in the previous step:
# sepolicy/vendor/system_app.te
get_prop(system_app, vendor_bluetooth_prop)

MediaTek SoC-specific part

  1. Add JNI library to device.mk:
PRODUCT_PACKAGES += \
    libmtkfmjni

Contributing

Contributions are welcome! Fixes and improvements for different SoCs are highly appreciated. Share your changes via PR!

Credits