Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

does dexed file persistent in the system ? Does it exist after rebooting the device ?

OP keestupillo

20th June 2014, 10:49 AM   |  #1  
OP Junior Member
Thanks Meter: 0
 
8 posts
Join Date:Joined: Jan 2014
Question:

Does Dex Optimization happens each time we reboot the device ? Or the dex files are stored into the system itself, and used for second time ?

Directory : system/framework

Files : core.jar, core-junit.jar , framework.jar , etc...

Source Code Analysis:

It looks like, the system check if there is already dex file in the cache, if exist, it just ignores, if not it creates a dex file.

http://androidxref.com/4.1.2/xref/da...RawDexFile.cpp :

optFd = dvmOpenCachedDexFile(fileName, cachedName, modTime,
adler32, isBootstrap, &newFile, /*createIfMissing=*/true);


This 'newFile' flag tells if dex file exists in the cache,

Below is the code which actually invokes dex optimization over the 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) ---
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes