ELi5: When doing a software update on my Android phone it reboots and says it’s optimizing and or initializing apps. What is it actually doing?

695 views

So Im in IT and can only rationalize the massive time (sometimes longer than the update itself) it takes to do this task before my phone is utilized it has something to do with indexing. Sort of like NTFS? But then again even computer drivers do not take as long to install and reboot as these phone updates take.
Can someone please explain what Android is doing when optimising and or initializing apps?

In: Technology

3 Answers

Anonymous 0 Comments

Android caches a LOT of stuff in databases. It’s purging and re-populating those databases.

Anonymous 0 Comments

Is this really worth an ELI5? It’s not really worth explaining, but I’ll sum up.

Android apps are written in Java. One of Java’s main features is that is doesn’t need to run on any particular kind of hardware. It is compiled into intermediate “bytecode” that runs on any type of computer that can support java in its basic form. That’s great and all, but most people want apps to just work on their device as fast as possible and aren’t really transferring them between different systems.

Android fixes this by transforming that java bytecode into program instructions optimized specifically for the hardware you are running it on. This takes a lot of computer cycles to accomplish and can only be done on the same kind of hardware the program is to be run on. The original operating system component in Android that did this, called Dalvik, would only do this transformation from java to your android device when absolutely necessary. It just wasn’t fast enough. The new system, Android Runtime Transform (ART) is specifically designed to be as fast as possible when apps are running. The downside is that ART has to completely work through each app ahead of time. That’s exactly what’s happening when you see that message–your device is converting Java into code that is the best possible for your device. The “just in time”, only when needed aspect of Java’s portability is lost, but those few minutes doing the conversion makes everything more effective in the end.

The end result does kind of suck for the customer. The software downloaded isn’t optimized for your device ahead of time and has to be converted from legacy Java goo into something useful. The advantage is that developers can create Android programs on any type of computer and have them run on any hardware remotely capable of supporting Android. And Android does still support massively different system architectures from MIPS, IBM, ARM and Intel even if ARM has become nearly ubiquitous. For comparison, Apple can’t even support their own hardware past a few years, and Microsoft end up with similar “bytecode” (MSIL) to hardware instruction issues with all the version of .Net framework.

Anonymous 0 Comments

When updating, it will clear all installed apps dalvik-cache to avoid any issues and start with fresh cache. What this optimizing does is rebuilding dalvik-cache for the all installed apps since updating will most probably includes updated system apps.

In an Adroid apk, there is the excutable file with .dex format, when installing/updating an apps, this dex file will get optimized and put into dalvik-cache directory/partition.