Launcher启动的流程图【AndroidICS4.0——>Launcher系列四】

先画一个Launche启动的流程图,虽然不是特别规范,但是勉强能看看,我也整理下Launcher的一系列的流程图,最近修改Launcher,又对Launcher加深了一些了解,

转载请标明出处:http://blog.csdn.net/wdaming1986/article/details/8267156

 

              大明图(1)

 

说明:loadWorkspaceFirst,这个是个boolean值,加入代码:

 

[java]  view plain copy print ?
  1. public void run() {  
  2.             // Optimize for end-user experience: if the Launcher is up and // running with the  
  3.             // All Apps interface in the foreground, load All Apps first. Otherwise, load the  
  4.             // workspace first (default).  
  5.             final Callbacks cbk = mCallbacks.get();  
  6.             final boolean loadWorkspaceFirst = cbk != null ? (!cbk.isAllAppsVisible()) : true;  
  7.   
  8.             keep_running: {  
  9.                 // Elevate priority when Home launches for the first time to avoid  
  10.                 // starving at boot time. Staring at a blank home is not cool.  
  11.                 synchronized (mLock) {  
  12.                     if (DEBUG_LOADERS) Log.d(TAG, "Setting thread priority to " +  
  13.                             (mIsLaunching ? "DEFAULT" : "BACKGROUND"));  
  14.                     android.os.Process.setThreadPriority(mIsLaunching  
  15.                             ? Process.THREAD_PRIORITY_DEFAULT : Process.THREAD_PRIORITY_BACKGROUND);  
  16.                 }  
  17.                 // First Step  
  18.                 if (loadWorkspaceFirst) {  
  19.                     if (DEBUG_LOADERS) Log.d(TAG, "step 1: loading workspace");  
  20.                     loadAndBindWorkspace();  
  21.                 } else {  
  22.                     if (DEBUG_LOADERS) Log.d(TAG, "step 1: special: loading all apps");  
  23.                     loadAndBindAllApps();  
  24.                 }  
  25.   
  26.                 if (mStopped) {  
  27.                     break keep_running;  
  28.                 }  
  29.   
  30.                 // Whew! Hard work done.  Slow us down, and wait until the UI thread has  
  31.                 // settled down.  
  32.                 synchronized (mLock) {  
  33.                     if (mIsLaunching) {  
  34.                         if (DEBUG_LOADERS) Log.d(TAG, "Setting thread priority to BACKGROUND");  
  35.                         android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);  
  36.                     }  
  37.                 }  
  38.                 waitForIdle();  
  39.   
  40.                 // Second step  
  41.                 if (loadWorkspaceFirst) {  
  42.                     if (DEBUG_LOADERS) Log.d(TAG, "step 2: loading all apps");  
  43.                     loadAndBindAllApps();  
  44.                 } else {  
  45.                     if (DEBUG_LOADERS) Log.d(TAG, "step 2: special: loading workspace");  
  46.                     loadAndBindWorkspace();  
  47.                 }  
  48.   
  49.                 // Restore the default thread priority after we are done loading items  
  50.                 synchronized (mLock) {  
  51.                     android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);  
  52.                 }  
  53.             }  
  54.   
  55.   
  56.             // Update the saved icons if necessary  
  57.             if (DEBUG_LOADERS) Log.d(TAG, "Comparing loaded icons to database icons");  
  58.             for (Object key : sDbIconCache.keySet()) {  
  59.                 updateSavedIcon(mContext, (ShortcutInfo) key, sDbIconCache.get(key));  
  60.             }  
  61.             sDbIconCache.clear();  
  62.   
  63.             // Clear out this reference, otherwise we end up holding it until all of the  
  64.             // callback runnables are done.  
  65.             mContext = null;  
  66.   
  67.             synchronized (mLock) {  
  68.                 // If we are still the last one to be scheduled, remove ourselves.  
  69.                 if (mLoaderTask == this) {  
  70.                     mLoaderTask = null;  
  71.                 }  
  72.             }  
  73.         }  


这个有Frist Step和Second Step,意思就是,

当loadWorkspaceFirst=true:先加载Workspace,后加载AllApps

当loadWorkspaceFirst=false:或者先加载AllApps,后加载Workspace;

所以我画图的时候用True/False,  False/True;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值