关闭

launcher app

736人阅读 评论(0) 收藏 举报

1, launcher


2, ams :: LauncherActivity


3, ams::startProcessLocked

int pid = Process.start("android.app.ActivityThread",  
                mSimpleProcessManagement ? app.processName : null, uid, uid,  
                gids, debugFlags, null); 

4, vm ?


5, ActivityThread   -> main()


6, ActivityThread 

    public static final void main(String[] args) {  
          
        .......  
  
        ActivityThread thread = new ActivityThread();  
        thread.attach(false);  
  
        ......  
  
        Looper.loop();  
  
        .......  
  
        thread.detach();  
          
        ......  
    }  


6.1 ActivityStack::resumeTopActivityLocked

startPausingLocked(userLeaving, false);

....
next.app.thread.scheduleResumeActivity(next.appToken,
                        mService.isNextTransitionForward());
....


7,  ActivityStack :: startSpecificActivityLocked(next, truetrue); 


8,. ActivityStack.realStartActivityLocked

9, ActivityThread.handleLaunchActivity


10, onCreate


11,onResume


12, completeResumeLocked

   private final void completeResumeLocked(ActivityRecord next) {
        next.idle = false;
        next.results = null;
        next.newIntents = null;

        // schedule an idle timeout in case the app doesn't do it for us.
        Message msg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
        msg.obj = next;
        mHandler.sendMessageDelayed(msg, IDLE_TIMEOUT);

        if (false) {
            // The activity was never told to pause, so just keep
            // things going as-is.  To maintain our own state,
            // we need to emulate it coming back and saying it is
            // idle.
            msg = mHandler.obtainMessage(IDLE_NOW_MSG);
            msg.obj = next;
            mHandler.sendMessage(msg);
        }

        if (mMainStack) {
            mService.reportResumedActivityLocked(next);
        }

        if (mMainStack) {
            mService.setFocusedActivityLocked(next);
        }
        next.resumeKeyDispatchingLocked();
        ensureActivitiesVisibleLocked(null, 0);
        mService.mWindowManager.executeAppTransition();
        mNoAnimActivities.clear();

        // Mark the point when the activity is resuming
        // TODO: To be more accurate, the mark should be before the onCreate,
        //       not after the onResume. But for subsequent starts, onResume is fine.
        if (next.app != null) {
            synchronized (mService.mProcessStatsThread) {
                next.cpuTimeAtResume = mService.mProcessStats.getCpuTimeForPid(next.app.pid);
            }
        } else {
            next.cpuTimeAtResume = 0; // Couldn't get the cpu time of process
        }
    }


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:22763次
    • 积分:453
    • 等级:
    • 排名:千里之外
    • 原创:16篇
    • 转载:39篇
    • 译文:0篇
    • 评论:2条
    最新评论