android - does dexed file persistent in the system ? Does it exist after rebooting the device ? if yes where stored? -
android - does dexed file persistent in the system ? Does it exist after rebooting the device ? if yes where stored? -
question:
does dex optimization happens each time reboot device ? or dex files stored scheme itself, , used sec time ?
directory : system/framework
files : core.jar, core-junit.jar , framework.jar , etc...
source code analysis:
it looks like, scheme check if there dex file in cache, if exist, ignores, if not creates dex file.
http://androidxref.com/4.1.2/xref/dalvik/vm/rawdexfile.cpp :
optfd = dvmopencacheddexfile(filename, cachedname, modtime, adler32, isbootstrap, &newfile, /*createifmissing=*/true); 'newfile' flag tells if dex file exists in cache, below code invokes dex optimization on file.
if (newfile) { ...... result = dvmoptimizedexfile(optfd, dexoffset, filesize, filename, modtime, adler32, isbootstrap); logcat output:
03-29 12:16:59.617 d/dalvikvm( 1071): dexopt: --- end 'core.jar' (success) --- 03-29 12:16:59.617 d/dalvikvm( 1071): dex prep '/system/framework/core.jar': unzip in 239ms, rewrite 3943ms 03-29 12:16:59.617 d/dalvikvm( 1071): dexopt: --- begin 'core-junit.jar' (bootstrap=1) --- 03-29 12:16:59.664 d/dalvikvm( 1372): dexopt: load 4ms, verify+opt 10ms, 137044 bytes 03-29 12:17:00.250 d/dalvikvm( 1071): dexopt: --- end 'core-junit.jar' (success) --- 03-29 12:17:00.250 d/dalvikvm( 1071): dex prep '/system/framework/core-junit.jar': unzip in 0ms, rewrite 627ms 03-29 12:17:00.304 d/dalvikvm( 1071): dexopt: --- begin 'bouncycastle.jar' (bootstrap=1) --- 03-29 12:17:00.882 d/dalvikvm( 1373): dexopt: load 25ms, verify+opt 463ms, 598508 bytes 03-29 12:17:01.507 d/dalvikvm( 1071): dexopt: --- end 'bouncycastle.jar' (success) --- 03-29 12:17:01.507 d/dalvikvm( 1071): dex prep '/system/framework/bouncycastle.jar': unzip in 49ms, rewrite 1204ms 03-29 12:17:01.632 d/dalvikvm( 1071): dexopt: --- begin 'ext.jar' (bootstrap=1) ---
the output of dexopt stored in /data/dalvik-cache.
on production devices, apps , bootstrap classes on scheme partition have ".odex" files stored next .dex files. if built-in app updated, apk stored on info partition, , odex go dalvik-cache usual.
dexopt run bundle manager. app process doesn't have permission create files in /data/dalvik-cache, bundle manager has create file , run dexopt before app starts. exception bootstrap classes, dexopt run zygote, , happens on development builds.
the dexopt documentation bit out of date accurate.
android dalvik dex android-framework
Comments
Post a Comment