GoogleChrome / GoogleChrome/android-browser-helper

Broken caching behavior in `SplashImageTransferTask` on dark / light mode switches

Open
#461 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
832
Forks
370
Avg merge
1d 3h
Merged PRs (30d)
6

Description

In case you provide both normal (light) and dark (night) mode resources for your slash screen,` SplashImageTransferTask` does not work as expected: it keeps the splash screen for the previous mode. The only workaround is reinstalling the app.

**To Reproduce**
1. Add a folder res/drawable-night next to the existing res/drawable folder with a splash.png file.
2. Toggle the device color schema mode (light / dark).
3. The splash displayed shows still the "old" splash image.

I think I was able to find the cause of this issue:
https://github.com/GoogleChrome/android-browser-helper/blob/main/androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/splashscreens/SplashImageTransferTask.java#L107 checks the last app update time, and compares it with the persisted time when the splash got last cached (`PREF_LAST_UPDATE_TIME`). That means for the case when you update the color schema of your device, but you do not reinstall the app, it will take the shortcut and use the already cached splash setup.

**Expected behavior**
Whenever the user changes color schema of their device, the proper splash should be rendered.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.