FMRadio: fix listen to recordings
FM app used to use file:// Uri to start a music player. However, in
recent Android versions, this became a crashable offense
(android.os.FileUriExposedException).
To fix the crash, we can either:
1. Disable StrictMode check -> won't help if music app cannot read video
files (3gpp counts as video)
2. Cleanly expose via FileProvider -> we can't, because uid=system
cannot give out uri permissions for security reasons
3. Not be uid=system anymore -> breaks on dirty flash/upgrade path
because file ownership user is still system, and also breaks existing
device trees that chmod /dev/fm to system
4. impersonate one of the system-whitelisted file providers (settings
and tvsettings) -> HACK
5. Remove the feature -> No thanks
6. Make FM not systemUid -> Proper fix! but requires all maintainers to
edit their trees, which is a longer-term project, that said a later
patch preliminarily addresses this by adding this app into media GID
7. Implement stub app which hosts the FileProvider but isn't uid=system
And that's why I implemented a tiny, no-UI stub app for making listen
possible. To avoid security holes, the stub app is gated behind
"signature" permission.
Change-Id: Ibf3f3c06967dda025d489e6612678f38b549cbcb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 12a6f31..b161ee7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -40,6 +40,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="com.android.fmradio.recordings.permission.PLAY_RECORDING" />
<application
android:hardwareAccelerated="true"