That's actually pretty slick.
Conversation
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.
1
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
It doesn't - it happens in the background while you're using the phone. I now realize that Samsung probably isn't using the current official Android update system (A/B updates) yet. Are they still doing updates with a legacy recovery-based system? Not really what Android does.
2
Yeah, that's what it looked like to me, a lot of the time it was sitting in what looks a lot like a recovery screen.
1
Yeah, that's the legacy update system replaced with update_engine on the Nexus 5X / 6P and which other vendors were supposed to have adopted ages ago. Seems Samsung still hasn't adopted it. The OS is designed around the A/B update system for atomic updates in the background.
Got it, ok so yeah, basically then the legacy system is doing a lot of stuff offline that, in the new system, is done online.
1
Using update_engine launched with the Nexus 5X / 6P in October 2015 so I'm not so sure I would call it the new one, since they've since moved to a more advanced form of it (streaming updates) and are migrating to another revision of it. Samsung still isn't caught up to 2015/2016.
1
Show replies

