Project

General

Profile

Actions

Bug #605

closed

The app doesn't initialize correctly when the theme is forced to be the opposite of the OS theme.

Added by Soren Stoutner over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Next Release
Start date:
08/24/2020
Due date:
% Done:

0%

Estimated time:

Description

The symptom is that the current page reloads instead of the bookmark.

Actions #1

Updated by Soren Stoutner over 3 years ago

  • Tracker changed from Feature to Bug

I haven't yet been able to replicate this bug on any of my devices, but I have received a smattering of reports from various users across several Android releases. It might have something do to with Domain Settings enabling JavaScript on the current page not switching correctly to JavaScript being disabled on the new page. If anyone would like to help troubleshoot the problem, please reply below.

Actions #2

Updated by Soren Stoutner over 3 years ago

The two devices that I know experience these problem are a Moto E (4) Plus and a Moto G (5). Perhaps it relates to some customization that Motorola has done to their devices.

Actions #3

Updated by Soren Stoutner over 3 years ago

This also affects a Moto G (6). It is discussed at https://redmine.stoutner.com/boards/1/topics/37.

Actions #4

Updated by Soren Stoutner over 3 years ago

According to https://redmine.stoutner.com/issues/606 this also affects LineageOS 16.0.

Actions #5

Updated by Soren Stoutner over 3 years ago

Those experiencing this problem who would like to help test a possible fix can download a debug build of Privacy Browser Free from the following URL (will expire in a few days):

https://owncloud.stoutner.com/index.php/s/KQrSrpSoMsI3I9M

This can be installed alongside your current Privacy Browser app without causing problems. This debug build changes the order that things are loaded during app initialization to make it more similar to the 3.4.1 release.

Actions #6

Updated by Anonymous over 3 years ago

It did not fix it for me.

For what it's worth, I noticed that when using the system's light theme, I first have to open a new tab to be able to open a URL or bookmark (both tabs will then work). On the other hand, switching to using the system's dark theme doesn't have this issue, it behaves like the previous versions w/o the theme support.

Further, when starting PrivacyBrowser with the light theme, then going to "Settings" and switching to "Dark", it restarts and now has three empty tabs open. Going from dark to light doesn't, it still has only one tab open after restarting.

Actions #7

Updated by Soren Stoutner over 3 years ago

Correct. What is happening is that the app isn't initializing correctly, causing the tabs and the WebView displayed to not be the ones that the system things they are. So, when it tries to load a bookmark or perform some other function, it doesn't work correctly (it is updating a WebView that either doesn't exist or isn't displayed on the screen).

Switching tabs resets the current WebView, which can fix some of the problems depending on exactly what is wrong. Similarly, changing the theme restarts the activity which also resets a large number of items, and sometimes they come back in the right order. If not, you can end up with things like three empty tabs.

For some people it works better if they are using the light theme. For some people it works better if they are using the dark theme. This is because, with the new Day/Night theme, when the app starts, if it is running a different theme than the OS (prior to Android 9, the OS is always running the light theme unless battery saver is enabled, in which case it is always running the dark theme), the app stops and restarts into the new theme during initialization. Depending on what is going on, this double initialization either helps or hurts.

But none of this gets to the core of the problem. I still have no idea why three Motorola phones and one LineageOS device have problems when it works perfectly well for everyone else. And unless we can get to the root of what is causing the problem, it is very difficult to resolve it. Short of getting ahold of a Motorola phone for testing, I'm not sure where to proceed from here.

Actions #8

Updated by Soren Stoutner over 3 years ago

  • Subject changed from Bookmarks won't load in certain circumstances to The app doesn't initialize correctly with the Day/Night theme on some devices.
Actions #9

Updated by Soren Stoutner over 3 years ago

I borrowed a Motorola XT1585 (Droid Turbo 2) and was able to replicate the problem. The root cause is that the Populate Bookmarks AsyncTask would start but not finish before the app was restarted. This caused two tasks to run simultaneously, which would populate 2 initial tabs (only 1 visible), making the loading of bookmarks unhappy.

I have created another debug build of Privacy Browser Free that cancels the AsyncTask if the instance state is saved.

https://owncloud.stoutner.com/index.php/s/4bg6TUyYqqSJwaO

This does cause a problem if someone navigates away from Privacy Browser while the blocklists are loading (they end up stuck on the loading screen). But that is an uncommon enough scenario that I don't think many people will run into it. The permanent solution is to switch the Blocklists to a ViewModel (https://redmine.stoutner.com/issues/597), but that is a complex enough tasks that I would prefer to push it off.

Can someone who has this problem test the above debug build? If it works for you, I will release 3.5.1.

Actions #10

Updated by Soren Stoutner over 3 years ago

Now that I know the root cause of the problem, I have been able to recreate symptoms on non-Motorola devices, like a Pixel 2 XL and a Pixel 4 depending on the theme settings used.

Actions #11

Updated by Anonymous over 3 years ago

Thank you, Mr. Stoutner, for your detailed explanation of the problem at hand.

All I can say is that yes, I am able to open bookmarks/URLs right away using the light theme with your new build. However, it gets stuck on the blocklist load screen when switching from dark to light and vice versa. I then have to forcibly close and re-open it.

I also noticed that the WebView theme doesn't always get honored. I have set the UI to "dark" and WebView to "light", though sometimes WebView's dark theme gets applied instead. This affects 3.5 and the debug build.

Actions #12

Updated by Soren Stoutner over 3 years ago

  • Status changed from New to In Progress

Thanks for the further information. I have created another debug build that I think should address the the problems you describe. Regarding the incorrect WebView theme, it was not being applied correctly for domains with domain settings:

https://owncloud.stoutner.com/index.php/s/gv5wytWhwXRNpPU

Actions #13

Updated by Anonymous over 3 years ago

Thank you, Mr. Stoutner, the issues I described above seem to have been resolved with the newest build. It no longer gets stuck loading blocklists either when switching themes.

Actions #14

Updated by Richard Lucassen over 3 years ago

Downloaded latest free version and this one works well as far as I can see.

Richard

Actions #15

Updated by Richard Lucassen over 3 years ago

Oh, BTW, LineageOS-16

Actions #16

Updated by Soren Stoutner over 3 years ago

  • Subject changed from The app doesn't initialize correctly with the Day/Night theme on some devices. to The app doesn't initialize correctly when the theme is forced to be the opposite of the OS theme.
Actions

Also available in: Atom PDF