laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.14k stars 4.91k forks source link

Android: Nearly minute-long solid gray screen before opening on fresh launch #8096

Open stevemagruder opened 1 year ago

stevemagruder commented 1 year ago

Environment

Joplin version: 2.10.8 Platform: Android OS specifics: Android v13 on Samsung Galaxy A13 5G

Steps to reproduce

  1. Touch Joplin app icon on Android screen to open.
  2. If this is a fresh launch (Joplin not already loaded), a solid gray screen appears and lasts for about one full minute.
  3. Joplin opens and works as normal.

Describe what you expected to happen

I expected Joplin to open without the intervening solid gray screen, or at least such that doesn't last as long as a minute.

Note that when I first started experiencing this (when 2.10.x was in beta), I thought it could be related to synchronization. But today, I tried setting the synchronization target from my usual 'OneDrive' to 'None', unloading the app, and relaunching it - and I still see the minute-long solid gray screen.

Logfile

I reviewed the log from the Android app and there are no errors/warnings presented from my testing of this issue today, whether synchronization was on or off.

laurent22 commented 1 year ago

I think that may have been fixed in one of the latest releases: https://github.com/laurent22/joplin-android/tags

stevemagruder commented 1 year ago

I just tested with 2.11.2 and the exact same issue is still there. To be doubly sure, I restarted my phone before a second test, which yielded the same result.

laurent22 commented 1 year ago

Unfortunately I have no idea what's causing this, and it's not happening on my phone or emulator. Another user reported this here but on a different device: https://discourse.joplinapp.org/t/on-android-when-joplin-gets-started-offline/29951

stevemagruder commented 1 year ago

Thank you. I've added my two cents to that discussion.

roman-r-m commented 1 year ago

I've just experienced something like this. No gray screen but the app was completely unresponsive for a few seconds while sync ran. Unfortunately I haven't been able to reproduce it since.

laurent22 commented 1 year ago

Freeze can happen with webdav sync, but I think this happens before sync even starts

stevemagruder commented 1 year ago

I also believe this issue happens pre-sync, because if there's characters in a note to sync, I can see the pre-sync note after the solid gray screen is done and opens the app for me, then sync operates, bringing those characters, and I can see the post-sync note.

roman-r-m commented 1 year ago

Freeze can happen with webdav sync, but I think this happens before sync even starts

I'm using Dropbox though

UPD Reading other comments, possibly my issue is unrelated.

personalizedrefrigerator commented 1 year ago

Note that when I first started experiencing this (when 2.10.x was in beta)

We added react-native-paper as a dependency around then. We wrap the root component in a PaperProvider and this react-native-paper does work on startup. This issue might be related to that change. I'm not seeing any issues related to this in their issue tracker, however...

I should (hopefully!) have time to look into this over the weekend.

personalizedrefrigerator commented 1 year ago

I'm now able to reproduce a 6-7 second gray screen. Here's how long different tasks take on startup:

Time since app start (ms) Time since last log (ms)  Description
163 163 render
208 45 initialize
269 61 setDispatch
365 96 render
402 37 set profile
413 11 set settings constants
444 31 setup logger
447 3 setup dblogger
463 16 prepared database for opening
465 2 setup fsDriver
466 1 setup AlarmService
467 1 setRSA
568 101 opened database
627 59 render
1677 1050 loaded keychainservice and settings
1678 1 loaded master password
1678 0 set up syncShareCache
1679 1 applied migrations
1680 1 set some settings
1680 0 set PluginAssetsLoader logger
4934 3254 loaded plugin assets
4936 2 loaded revision service
4963 27 set locale
4972 9 set up e2ee
5005 33 render
5009 4 set up recurrent sync
5013 4 set up resourceservice
5015 2 set up searchengine
5027 12 ran migrations
5490 463 app initialized
5493 3 render
5494 1 render
6183 689 render

Of these, loaded plugin assets and loaded keychainservice and settings take the most time. Plugin assets are only used the first time that a note is rendered, so that could possibly be done in the background.

laurent22 commented 11 months ago

@personalizedrefrigerator, I'm surprised loaded keychainservice and settings since the keychain service is noop on mobile, and the rest if just loading the settings. Maybe there's something to optimise here?

I agree loaded plugin assets shouldn't prevent the app to starts and could probably be loaded in the background. Even then it seems quite slow - is it because we're accessing the drive? What if we save these assets to sqlite instead? (still on the drive but with possibly more optimised reading performances).

stevemagruder commented 11 months ago

To follow up, as of 2.13.2, my gray screen period is now 13-14 seconds. Definitely improved - thank you!

personalizedrefrigerator commented 10 months ago

I've looked into this again with several master keys. It seems that each master key can add more than a second on to the startup time (depending on the device). I've created a separate issue for this.

stevemagruder commented 7 months ago

Just to report, as of 2.14.7, the gray screen period is still roughly 14 seconds.

personalizedrefrigerator commented 7 months ago

@stevemagruder How many encryption master keys under Configuration > Synchronization > Encryption Config?

stevemagruder commented 7 months ago

@stevemagruder How many encryption master keys under Configuration > Synchronization > Encryption Config?

Five.