ReVanced / revanced-manager

💊 Application to use ReVanced on Android
https://revanced.app
GNU General Public License v3.0
18.24k stars 748 forks source link

bug: crash on Android 14 when try to start FGS #1854

Open Howard20181 opened 7 months ago

Howard20181 commented 7 months ago

Bug description

Patch any app on Android 14 can reproduce

Version of ReVanced Manager and version & name of app you are patching

1.20.0-dev.1 YouTube 19.09.37

Installation method

Regular

ReVanced Manager logs

Generated by AppErrorsTracking 1.3(6)
Project URL: https://github.com/KitsunePie/AppErrorsTracking
===============
[Device Brand]: Xiaomi
[Device Model]: 23127PN0CC
[Display]: UKQ1.230804.001 release-keys
[Android Version]: 14
[Android API Level]: 34
[System Locale]: zh_CN
[Process ID]: 24983
[User ID]: 0
[CPU ABI]: arm64-v8a
[Package Name]: app.revanced.manager.flutter
[Version Name]: 1.20.0-dev.1
[Version Code]: 101800014
[Target SDK]: 34
[Min SDK]: 26
[Error Type]: JVM
[Crash Time]: 2024-04-05T09:53:16.462
[Stack Trace]:
java.lang.RuntimeException: Unable to start service de.julianassmann.flutter_background.IsolateHolderService@243de with Intent { act=START cmp=app.revanced.manager.flutter/de.julianassmann.flutter_background.IsolateHolderService }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{45d88a8 24983:app.revanced.manager.flutter/u0a483} targetSDK=34
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5046)
    at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2418)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:224)
    at android.os.Looper.loop(Looper.java:318)
    at android.app.ActivityThread.main(ActivityThread.java:8677)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{45d88a8 24983:app.revanced.manager.flutter/u0a483} targetSDK=34
    at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
    at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
    at android.os.Parcel.readParcelableInternal(Parcel.java:4870)
    at android.os.Parcel.readParcelable(Parcel.java:4852)
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3052)
    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:7270)
    at android.app.Service.startForeground(Service.java:775)
    at de.julianassmann.flutter_background.IsolateHolderService.startService(Unknown Source:200)
    at de.julianassmann.flutter_background.IsolateHolderService.onStartCommand(Unknown Source:38)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5028)
    ... 9 more

Patch logs

No response

Acknowledgements

Howard20181 commented 7 months ago

Cause by 7833a0d552d05946f50434e799c46272e6eb30a3

oSumAtrIX commented 7 months ago

This commit only switches repos. The previous repo branch was merged into the new repo, so that commit should not make a difference.

Ushie commented 7 months ago

Looking into it, hopefully hotfix tonight

Ushie commented 7 months ago

I reverted https://github.com/ReVanced/revanced-manager/commit/7833a0d552d05946f50434e799c46272e6eb30a3 in the meantime, this is not a permanent fix as this means that notifications on Android 14 are broken

Notifications weren't working on Android 14, which was fixed upstream by https://github.com/JulianAssmann/flutter_background/commit/65cf0ec93486b3a6c74339aadaeb384cf2c9a24b but they failed to address the required notification types, causing the app to crash. Previously, the absence of necessary foreground service permission prevented the app from reaching the notification creation stage, thus avoiding the crash