Open kitadai31 opened 1 month ago
Thanks for finding this. The best way to solve this would probably be to ask the user to grant the permission before allowing the user to patch anything.
That seems to be a weird fix, because it doesn't fix the problem, the patching process is unnecessarily triggered after the permission is granted, even though the out.apk is still available to use
I am speculating it's caused by the activity being "restarted"
It turned out that some devices force stop the app completely when asking the permission. This record is from OPPO A73 (Android 11).
https://github.com/user-attachments/assets/1c615718-88e4-4aa1-bda6-9054cfc4899f
When the first dialog (For your security, ...) appeared, the app was killed.
There is no other way than asking the install permission before starts patching.
Bug description
After patching is complete, if you press the "Install" button and allow the "Install unknown apps" permission, the patching will start again.
https://github.com/user-attachments/assets/9307078c-8d25-49ff-ab87-6c707f70c64a
This problem occurs only on Android 11. Android 11 has a issue that when user grant the "Install unknown apps" permission, the app will be force stopped, or the last Activity will be recreated.
Reference: https://issuetracker.google.com/issues/154157387 https://issuetracker.google.com/issues/168293637 https://www.androidpolice.com/2020/08/24/android-11-install-unknown-apps-more-cumbersome/ https://mobilesyrup.com/2020/06/03/android-11-change-apps-force-quite-install-apk/
This does not occur on Android 10 or earlier and Android 12 or later. (This is entirely an issue with Android 11 itself, and VendettaManager also have this issue that patching starts again, by the way.)
Possible solution
Ask the permission when the first launch, only on Android 11. (Like the Flutter Manager asks the install apps permission on the first launch)
Because the docs says that apps should request special permissions in-context when the user requests a specific action that requires the permission. https://developer.android.com/training/permissions/requesting-special#in-context For other versions of Android, you can continue to request the permission on the exact timing (when user pressed the "Install" button).
Version of ReVanced Manager and version & name of app you are patching
ReVanced Manager Compose, compose-dev branch e992a99
Installation method
None
ReVanced Manager logs
Patch logs
No response
Acknowledgements