There’s an update step that shows “Optimizing apps” during installing a system update normally. It takes a while.
- What does it do?
- Is this step skipped when flashing a full OTA via adb sideload?
- Is there any difference in regards to the effect of “Optimizing apps” between the regular system update process and full OTA flashing?
Max_P@lemmy.max-p.me 1 year ago
Android apps are still heavily based on Java. But doing Java stuff at runtime has proven to be fairly slow still.
So modern Android does something called Ahead of Time compiling (AOT) where it compiles the Java bytecode to native code at installation.
After an OTA, those are all invalidated because system libraries may have changed, so it needs to redo that. That’s what it’s doing.
If you adb shell into the device while it’s doing that, you’ll see it’s running dex2aot on all your apps.
Yes it’ll do it if you flash it directly too. For the update process purposes, there’s very little difference between regular OTAs and flashes in recovery. You just don’t see it on first boot because you’re busy doing the initial setup screens and system apps are usually precompiled and baked into the ROM anyway. No third-party apps installed, no optimization to do.
avidamoeba@lemmy.ca 1 year ago
So the implication is that during the normal system update process, the AOT compilation happens prior to rebooting whereas during OTA sideloading it happens post rebooting? This kinda makes sense because the OTA sideloading process is much faster. It also implies that post OTA sideloading, the device might show poorer battery life for a bit, yes?
Max_P@lemmy.max-p.me 1 year ago
It does it post reboot in both cases.
I don’t know why OTAs are so slow to install. Maybe it’s slow to conserve battery or not affect phone performance too much? No idea.
It does the same thing in the end.
sbv@sh.itjust.works 1 year ago
That’s a great explanation! Thanks!