14
submitted 8 months ago by avidamoeba@lemmy.ca to c/askandroid

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?
top 4 comments
sorted by: hot top controversial new old
[-] Max_P@lemmy.max-p.me 15 points 8 months ago* (last edited 8 months 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.

They could probably just do it in the background silently, but it does give an indication to the user that heavy stuff is going on in the background and thus explains why the device is running a bit slower, a bit hotter and using more battery than normal. A lot of things a regular user could be concerned about immediately after an update, so you're better off letting the user know stuff is happening and that it'll settle down.

[-] sbv@sh.itjust.works 1 points 8 months ago

That's a great explanation! Thanks!

[-] avidamoeba@lemmy.ca 1 points 8 months 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 points 8 months 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.

this post was submitted on 12 Nov 2023
14 points (93.8% liked)

Ask Android

2045 readers
1 users here now

A place to ask your questions and seek help related to your Android device and the Android ecosystem.

Whether you're looking for app recommendations, phone buying advice, or want to explore rooting and tutorials, this is the place for you!

Rules
  1. Be descriptive: Help us help you by providing as many details as you can.
  2. Be patient: You're getting free help from Internet strangers, so you may have to wait for an answer.
  3. Be helpful: If someone asks you for more information, tell us what you can. If someone asks you for a screenshot, please provide one!
  4. Be nice: Treat others with respect, even if you don't agree with their advice. Accordingly, you should expect others to be nice to you as well. Report intentionally rude answers.
  5. No piracy: Sharing or discussing pirated content is strictly prohibited. Do not ask others for a paid app or about how to acquire one.
  6. No affiliate/marketing links: Posting affiliate links is not allowed.
  7. No URL shorteners: These can hide the true location of the page and lead people to malicious places.
  8. No lockscreen bypasses: Please do not comment, link, or assist with bypassing lock screens or factory reset protection.
  9. No cross-posting: Please take the time to make a proper post instead of cross-posting.
Other Communities

founded 1 year ago
MODERATORS