Browser crashes when switching from it while a page is starting to load
there's a bug that's been... bugging (sorry for the pun) me for quite a while now.
Android 8.1 Resurrection Remix w/ Magisk and Xposed
Privacy Browser 2,12 from FDroid
Android WebView 61.0.3163.98
If I start loading a webpage in Privacy Browser, but the progress bar doesn't get further than the menu button in the top left corner, when I switch away from the app (e.g. open recents or switch to another app), PB crashes as soon as the webpage starts to "really load" (signified by increased network activity in the statusbar).
I'm going to attach a log. It's also easily reproducible, at least for me, so I can even do a screen recording if it's needed.
#1 Updated by Soren Stoutner 4 months ago
- Assignee set to Soren Stoutner
Thank you for the stack trace. This crash is caused because `Can not perform this action after onSaveInstanceState` is crashing the system when the webpage finishes loading `onPageFinished`. `onSaveInstanceState` is called every time you switch away from the app, which matches your description. However, it isn't clear why this is a problem, as it doesn't happen on my test device.
It is possible that this might be caused because you are using an older WebView. You might try upgrading to the most recent (18.104.22.16841.85), but I don't think this is the root of the problem.
It is more likely that there is something specific about your ROM or the modifications (Magisk and Xposed) that is causing problems.
Attached is a debug build of Privacy Browser Free (you can install it without having to uninstall your current Privacy Browser and lose all your settings). Could you please get a stack track of this crashing? Hopefully it will tell us the line number of the command that is not working after `onSaveInstanceState`.
#3 Updated by Rayleigh Rayleigh 4 months ago
Hmm... it seems that neither the debug free app nor the normal free app that I just downloaded using Yalp Store crash.
They don't crash, because they don't load the webpages in the background for some reason.
I've also updated my WebView to the Bromite-privacy-enhanced webview, but it didn't change a thing in how PB behaves. (Before you create privacy WebView, what about using Bromite's?)
I'll just wait until the next release to see if it'll magicaly fix itself, seen as I seem to be the only one experiencing the issue.
I've also got a question. If the Librem 5 becomes a successful libre phone, would you consider making a version of PB for it?
#4 Updated by Soren Stoutner 4 months ago
I don't think the problem has to do with loading the web pages in the background. When switching away from Privacy Browser all WebView activity is paused. When switching back to the app the activity is resumed. The crash is caused because of some unspecified command that is run when the page finishes loading says it can't run after the app has been paused (`onSaveInstanceState`). It isn't clear to me which command this could be. I have reviewed the code that runs in `onPageFinished` and it all looks fine to me.
Could you try resetting all your settings to default by clearing Privacy Browser's data and see if you can still replicate the problem? There might be some combination of settings that cause this bug to appear. If using the default settings work, you could slowly re-enable your custom settings and see if you can duplicate the issue. (You might want to backup your settings/bookmarks first if you have a lot of them.)
There is also some possibility that there is a problem with the APK hosted by F-Droid. But I downloaded it onto one of my testing devices and was not able to replicate the bug. If nothing else works, try downloading the APK hosted at https://www.stoutner.com/privacy-browser/changelog/.
#7 Updated by Rayleigh Rayleigh 4 months ago
And now I've become even more confused.
The browser stopped crashing, but I haven't done anything at all, except for uninstaling Brevent, linstalling Greenify and enablng it as an Xposed module, but this should all be unrelated.
On one side, I am glad it has fixed itself, but I'd still like to know what caused this bug.
My hypothesises are:
1. Brevent stopped working for me and maybe it was causing some conflict on the system level, as it had root access
2. Installing another Xposed module changed something during the loading of Xposed which was causing this random bug
3. It might have also been related to the fact that I've been internationally roaming for the whole time.
Either way, I'm glad this has fixed itself and I'm also glad I could bring your attention to Bromite's WebView.
#9 Updated by Soren Stoutner 4 months ago
- Status changed from New to Closed
That is interesting. I am not able to reproduce the problem with data saver enabled on my Pixel 2 XL running stock Android 8.1.0. However, I have discovered that a lot of crashes are related to how individual ROMs/OEMs customize Android's power/data/RAM management features.
Thanks for the followup info.