breautek commented on issue #1510:
URL: 
https://github.com/apache/cordova-android/issues/1510#issuecomment-1284178606

   > It seems weird to me that a long splash screen would count as ANR. It 
didn't used to. 
   
   Older Android devices had no actual concept of splashscreens. It was just 
something people implemented in the app itself, as part of the app activity, 
which is exactly what cordova-android@10 / cordova-plugin-splashscreen did and 
is why there was a lot of flexibility before.
   
   Google's Splashscreen system that is implemented on Android 12 and later 
occurs immediately before app code is launched, which is why it's quite 
limiting. At least that is our best guess, I don't know if we know that for 
100% certain. But if that is the case, then it makes sense on why Google may 
consider delaying the Splashscreen an ANR.
   
   Cordova-android@11 uses a compatibility library (which is maintained and 
provided by Google) to bring Android 12's splashscreen system to older devices. 
Without it, it wouldn't be possible to support both Android 12 and older 
android devices at the same time (due to the differences in the Splashscreen 
API).
   
   I think Erisu's hunch is on point though.
   
   The [Android 
Docs](https://developer.android.com/develop/ui/views/launch/splash-screen) 
states:
   
   > When a user launches an app while the app's process is not running (a 
[cold 
start](https://developer.android.com/topic/performance/vitals/launch-time#cold))
 or the Activity has not been created (a [warm 
start](https://developer.android.com/topic/performance/vitals/launch-time#warm)),
 the following events occur. (The splash screen is never shown during a [hot 
start](https://developer.android.com/topic/performance/vitals/launch-time#hot).)
   >
   >1. The system shows the splash screen using themes and any animations that 
you've defined.
   >
   >2. When the app is ready, the splash screen is dismissed and the app is 
displayed.
   
   So on a cold start, I believe what happens is the Android OS will begin the 
launch of the application, starting with the `AndroidManifest.xml` which is 
what contains details on how to display the splashscreen, and this is shown 
pretty much immediately, before any App code is invoked.
   
   By default, when the App Activity is created and after the first draw of the 
UI, the splashscreen is dismissed, but Google does offer an API to delay the 
splashscreen dismissal (indicating that the app is not ready), which is what 
Cordova uses to keep the splashscreen displayed for longer (until `hide` is 
called or after the configured delay).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to