wallabag / android-app

Android application to read your articles saved in your wallabag. You can also easily add new articles.
https://www.wallabag.org
GNU General Public License v3.0
462 stars 260 forks source link

Starting TTS crashes app on Android 14 #1391

Closed geekygirlsarah closed 3 months ago

geekygirlsarah commented 3 months ago

Issue details

Duplicate?

Have you searched the issues of this repository if your issue is already known? yes/no

I have searched, #1348 is close but not the same error

Actual behaviour

After opening an article, opening Text To Speech, and clicking Play to read it, it would always crash on me. I discovered it did this after I upgraded from Android 13->14. After uninstalling and reinstalling the app, I found after logging in and trying to open the TTS pane, it would also crash.

I could replicate this in a virtual Pixel 8 Pro emulator running Android 14 as well.

It appears the android.permission.FOREGROUND_SERVICE is missing in the manifest (though android.permission.FOREGROUND_SERVICE_DATA_SYNC and android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK are in there).

Expected behaviour

The TTS pane should open and should read the the article without crashing.

Steps to reproduce the issue

  1. On an Android 14 device, open an article.
  2. Click on the triple-dot menu and check "Text To Speech". It may crash here.
  3. If the panel is open, click on Play. It should crash here.

Environment details

Logs

Logcat

2024-04-13 14:52:43.068 17779-17779 TtsService              fr.gaulupeau.apps.InThePoche         D  setForegroundAndNotification()
2024-04-13 14:52:43.068 17779-17779 TtsService              fr.gaulupeau.apps.InThePoche         V  setForegroundAndNotification() startForeground()
2024-04-13 14:52:43.072 17779-17779 AndroidRuntime          fr.gaulupeau.apps.InThePoche         D  Shutting down VM
2024-04-13 14:52:43.072 17779-17779 AndroidRuntime          fr.gaulupeau.apps.InThePoche         E  FATAL EXCEPTION: main
                                                                                                    Process: fr.gaulupeau.apps.InThePoche, PID: 17779
                                                                                                    java.lang.SecurityException: Permission Denial: startForeground from pid=17779, uid=10399 requires android.permission.FOREGROUND_SERVICE
                                                                                                        at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
                                                                                                        at android.os.Parcel.createException(Parcel.java:3041)
                                                                                                        at android.os.Parcel.readException(Parcel.java:3024)
                                                                                                        at android.os.Parcel.readException(Parcel.java:2966)
                                                                                                        at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6790)
                                                                                                        at android.app.Service.startForeground(Service.java:862)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsService$$ExternalSyntheticApiModelOutline0.m(Unknown Source:0)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsService.setForegroundAndNotification(TtsService.java:1146)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsService.setForegroundAndNotification(TtsService.java:1108)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsService.playCmd(TtsService.java:438)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsService.playPauseCmd(TtsService.java:506)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsFragment.playPauseCommand(TtsFragment.java:539)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsFragment.lambda$onCreateView$0$fr-gaulupeau-apps-Poche-tts-TtsFragment(TtsFragment.java:212)
                                                                                                        at fr.gaulupeau.apps.Poche.tts.TtsFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
                                                                                                        at android.view.View.performClick(View.java:7658)
                                                                                                        at android.view.View.performClickInternal(View.java:7635)
                                                                                                        at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
                                                                                                        at android.view.View$PerformClick.run(View.java:30167)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                        at android.os.Looper.loop(Looper.java:294)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8248)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    Caused by: android.os.RemoteException: Remote stack trace:
                                                                                                        at com.android.server.am.ActivityManagerService.enforcePermission(ActivityManagerService.java:6029)
                                                                                                        at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2033)
                                                                                                        at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1687)
                                                                                                        at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:13362)
                                                                                                        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3400)
2024-04-13 14:52:43.104 17779-17779 Process                 fr.gaulupeau.apps.InThePoche         I  Sending signal. PID: 17779 SIG: 9

Your experience with wallabag Android app

Have you had any luck using wallabag Android app before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)

I started using Wallabag as a replacement for Pocket several years ago in a push to use more open source software and reduce Big Tech Companies. I've loved it, have over 10,000 articles in it now (unread and archived combined), and it's ability to text-to-speech the articles is one of the best features I use constantly. I'm glad this project exists!