/frameworks/base/cmds/installd和/frameworks/base/services/java/com/android/server/PackageManagerService.java负责新程序的安装,检查,优化等,父进程等优化完毕后。
关于/data/dalvik-cache/
当Android启动时,DalvikVM监视所有的程序(APK文件)和框架,并且为他们创建一个依存关系树。DalvikVM通过这个依存关系树来为每个程序优化代码并存储在Dalvik缓存中。这样,所有程序在运行时都会使用优化过的代码。这就是当你刷一个新的ROM时,有时候第一次启动时间非常非常长的原因。当一个程序(或者框架库)发生变更,DalvikVM将会重新优化代码并且再次将其存在缓存中。
下面是安装一个APK的过程看到的LOG:
I/ActivityManager( 129): Starting: Intent { dat=/sdcard/apk/Tank Hero.apk cmp=com.android.packageinstaller/.InstallAppProgress (has extras) } from pid 1414
W/ActivityManager( 129): No content provider found for: null
I/ActivityManager( 129): Displayed com.android.packageinstaller/.InstallAppProgress: +339ms
W/ActivityManager( 129): No content provider found for: null
D/PackageParser( 129): Scanning package: /data/app/vmdl-491066460.tmp
D/PackageManager( 129): Scanning package com.clapfootgames.tankhero
I/PackageManager( 129): Unpacking native libraries for /data/app/com.clapfootgames.tankhero-1.apk
D/installd( 100): DexInv: --- BEGIN '/data/app/com.clapfootgames.tankhero-1.apk' ---
D/dalvikvm( 2151): DexOpt: load 77ms, verify+opt 269ms
D/installd( 100): DexInv: --- END '/data/app/com.clapfootgames.tankhero-1.apk' (success) ---
D/PackageManager( 129): Receivers: com.admob.android.ads.analytics.InstallReceiver
D/PackageManager( 129): Activities: com.clapfootgames.tankhero.Application com.admob.android.ads.AdMobActivity
I/installd( 100): move /data/dalvik-cache/data@
[email protected]@classes.dex -> /data/dalvik-cache/data@
[email protected]@classes.dex
D/PackageManager( 129): New package installed in /data/app/com.clapfootgames.tankhero-1.apk