Yeah I guess I was thinking that was the later part of the process. Idk it seems that there are two "stages" from a UX perspective. The latter being when it recompiles apps etc
Conversation
Replying to
I don’t remember the exact order of the steps during an OTA android update but iirc the zygote service is stopped so all the apps are recompiled before reboot
1
1
Replying to
Huh interesting. I guess I assumed otherwise because the second half of the process has a bubble with something like "optimization apps".
1
Which version of Android, on which device? If you're talking about a modern device with A/B updates, you can watch the update_engine progress with `adb logcat`. On modern, stock OS devices, they usually use a mix of interpreter + JIT + AOT compilation driven by JIT profiles.
2
1
During the update process in the background, once it finishes installing and verifying the new update, it starts redoing AOT compilation of apps driven by the JIT profiles gathered from the existing usage. It also recompiles code daily when not low battery + plugged in and idle.
1
1
The update it installed to the alternate set of partitions, so it mounts the alternate system partition and then uses that to recompile the apps for the upcoming reboot into the newly updated OS. It can't reuse the existing AOT compiled code.
1
1
This avoids blocking the boot process for it (which was the initial implementation) or doing it in the background after reboot which results in poor performance due to only having the interpreter / JIT compiler. GrapheneOS doesn't use the JIT and we just use full AOT compilation.
1
It's ideally run on an efficiency core with a single thread to cause the least possible disruption to users. The update_engine update process is very efficient so that doesn't take very long and it really spends most of the time recompiling apps.
1
It doesn't have to recompile system apps that are shipped with pre-compiled code and don't have an out-of-band update installed. However, it's increasingly uncommon to include pre-compiled code in the OS images for everything but the core privileged code (for verified boot).
1
GrapheneOS ships fully pre-optimized code and we don't have out-of-band updates to any of the bundled apps other than Vanadium (WebView, browser, library), Auditor and PDF Viewer which are signed with their own keys. All other apps share the AOSP release cycle so no reason to.
Samsung probably has a huge number of bundled apps and they probably don't ship pre-compiled code, so your device has to go through all of them and recompile them. If they leave AOT compilation on speed-profile, it will only actually AOT compile code being used at runtime.
1
I guess the thing is that it sort of feels like a lot of that work doesn't have to happen strictly offline with my phone off, though perhaps that's done more as a precaution? Obviously at some point the phone is going to have to restart.
1
Show replies


