Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does android store and run programs

Android stores it's programs in APK format, which is a modified version of ZIP/JAR.

When these APK files are installed, they are stored in /system/app/$APKNAME.apk.

Some of the apps in this dir also have a $APKNAME.obex file.

These APK files contain some of the fallowing

META-INF
    MANIFEST.MF
    CERT.RSA
    CERT.SF
SHA1-Digest
res
AndroidManifest.xml
classes.dex
resources.arsc

So what I want to know is what are the .obex files and are androids program decompressed from the APK/ZIP/JAR at runtime and how?

like image 896
Taylor Ramirez Avatar asked Mar 22 '12 03:03

Taylor Ramirez


1 Answers

The way that this works is pretty interesting, and gives some key insights into Android's runtime model. The first thing I'd recommend watching is Dalvik VM internals, if you plan on doing any serious amount of systems stuff with Android. (Although, it's obviously old.) Now, when the Android package manager gets an intent which requires starting a new app it forks off a new virtual machine from an already running zygote process. This is basically a technique which allows the system to get a lot of nice memory properties (sharing the pages mapped, etc..). Then, the system loads up a (potentially pre optimized and verified) file to load so the vm can start executing it. You should read this document, which will tell you quite a bit about how this works. (Perhaps this thread will also help.) Keep in mind that as all systems are different -- for example, if you're on a new architecture, you won't get JIT support unless you explicitly write it! -- you can't know for sure how Dalvik will load code to run your app.

like image 174
Kristopher Micinski Avatar answered Sep 23 '22 22:09

Kristopher Micinski