Preventing Crashes

There are several things that can cause Privacy Browser to crash.

1  Custom OEM Power Management

Google produces Android as an open source project. It is already unstable as it comes from Google. But then OEMs get a hold of it and decide they need to do a whole bunch of customizations to differentiate themselves. Often, they aren’t very good at modifying Android, resulting in systems that are less stable, have worse battery life, and generally are not very impressive (but they have pretty graphics).

The tweaks to Android that cause the greatest problems are those that affect the power management. This has caused problems with VLC running on recent Huawei devices. The Huawei P20 seems to be particularly problematic. One user reported to me that disabling Huawei’s “Smart resolution” resolved a crash that happened most of the time when Privacy Browser was first started. Another user had issues with the data saver feature on a particular ROM (Android Settings  > Network & Internet > Data usage > Data saver).

As a general rule, if some ill conceived power management feature is the root cause of the problem, the crash will likely be fairly easy to replicate, meaning that performing the same series of steps will result in a crash the majority of the time. The cause of the variation is that how the system handles power management depends in part on what is happening with other apps in the background. Because every OEM does different things with different settings, it is impossible to make a complete list of where to find everyone’s custom settings, but has made a fairly significant attempt at doing so. If you are experiencing crashes with Privacy Browse, try tweaking/disabling the custom OEM power management features.

2  WebView Bugs

A large number of crash reports I receive are caused by crashes in Android’s WebView. As described on the page about WebView, beginning with Android 7.0 (Nougat) the WebView code can be provided by either the WebView app or by Google Chrome. They are both built form the same codebase. WebView just builds the backend. Chrome builds the backend and the front end. However, it appears that there is some difference between the resulting backends that each package provides. At least one person was able to get rid of frequent crashes by switching their WebView provider from Chrome to Android System WebView (instructions for doing so can be found on the WebView page).

If you have an older version of WebView (the Chrome version number in About -> Version) you might consider upgrading to see if that fixes the problem. Sometimes, however, the current version is more buggy than the older ones.

Problems with WebView fall into two categories. Those where WebView has a problem with the coding on a specific website.  These can usually be triggered reliably (every time you go to that website Privacy Browser crashes). The other type of problem is that WebView gets really busy, forgets what it is doing, and crashes. These types of crashes are intermittent and difficult to reproduce, but they tend to happen on large websites with lots of JavaScript and other stuff going on.

3  Problems with Android Runtime

Android Runtime (also known as ART) is the runtime environment that runs Android programs.  ART converts Privacy Browser’s bytecode into executable code specific to the device. But in addition to that, it also handles memory allocation and garbage collection (freeing up old memory that the program is no longer using). Privacy Browser uses about 256 MB of RAM and fairly minimal CPU usage (as long as JavaScript is disabled). Usually this isn’t a problem. But if the device is running out of RAM, or if the the power management settings are misbehaving, ART will sometimes remove important parts of Privacy Browser from RAM, which will cause it to crash when it tries to use them. For example, this is a crash caused because some of the information for the sliding drawers was removed from RAM by the OS.

It may be possible to minimize these types of problems by telling the battery management features to leave Privacy Browser a little bit alone. Note that this doesn’t fully prevent Android from shutting down parts of Privacy Browser if it gets the whim. It is just a polite request.

The way you get to this screen varies on different Android devices, but on stock Android 8.1.0 it is Android Settings > Battery > Options Menu (upper-right corner) > Battery optimization > Spinner (drop down) > All apps > find Privacy Browser in the list. This type of crash will be almost entirely random and will be difficult to reproduce with a set sequence of actions.

 4  Bug in Privacy Browser

Sometimes there is a bug in Privacy Browser’s code, at times only manifesting on particular devices or versions of Android. If in doubt, please file a bug report. Bugs with Privacy Browser tend to be easy to reproduce, meaning that performing the same series of steps always produces the crash.