| ee57fd9f | 17-May-2023 |
Kudo Chien <[email protected]> |
[updates] Prevent launch ANR by delayed loadApp (#20273)
# Why
experimenting solution for expo-updates ANR mentioned in #19918
close ENG-7652
# How
in #19918 case, the app has a large numb
[updates] Prevent launch ANR by delayed loadApp (#20273)
# Why
experimenting solution for expo-updates ANR mentioned in #19918
close ENG-7652
# How
in #19918 case, the app has a large number of assets. when the app is updated from google play store, expo-updates will copy these assets from app internal storage (apk/aab) to file system and also doing database updates / asset checksums. that may take longer time.
there is a main thread lock in [`UpdatesController.launchAssetFile`](https://github.com/expo/expo/blob/c0e29be13c8d012256bdd6fd2ec751f78a8ab7c6/packages/expo-updates/android/src/main/java/expo/modules/updates/UpdatesController.kt#L148) to wait for loading finish. it is the root cause of ANR.
after visiting several ways toward the problem, this pr is my last attempt - to delay the call to react-native's `loadApp`. at this point, we can initialize expo-updates and do some heavy work in the background thread. since we don't call `setContentView(ReactRootView)`, expo-splash-screen will keep the splash screen showing. at this result, even splash screen is there, we can still send touch events and back key without ANR.
## Note
the solution is getting a little tricky and is still experimenting. to disable this feature, please add `EX_UPDATES_ANDROID_DELAY_LOAD_APP=false` to gradle.properties.
# Test Plan
- ci passed
- test eas update from the build geneated through `./gradlew :app:assembleRelease`
show more ...
|