http://blog.csdn.net/yujun411522/article/details/46659413
本文出自:【yujun411522的博客】
在ActivityManagerService 的启动过程中出现了ActivityStack的这么一个类,这个类的作用是什么呢?
enum ActivityState { INITIALIZING,//正在初始化 RESUMED,//获得焦点 PAUSING,//正在暂停 PAUSED,//已经暂停 STOPPING,//正在停止 STOPPED,//已经停止 FINISHING,//正在完成 DESTROYING,//正在摧毁 DESTROYED//已经摧毁 }
/** * The back history of all previous (and possibly still running) activities. It contains HistoryRecord objects. */ //所有被返回的Activity final ArrayList<ActivityRecord> mHistory = new ArrayList<ActivityRecord>(); /** * List of running activities, sorted by recent usage. The first entry in the list is the least recently used. * It contains HistoryRecord objects. */ // 正在运行的Activity,按照LRU来排序,第一个是最近最少使用的 final ArrayList<ActivityRecord> mLRUActivities = new ArrayList<ActivityRecord>(); /** * List of activities that are waiting for a new activity to become visible before completing whatever operation they are * supposed to do. */ //正在等待一个新的Activity变成Visible时的Activity集合 final ArrayList<ActivityRecord> mWaitingVisibleActivities = new ArrayList<ActivityRecord>(); /** * List of activities that are ready to be stopped, but waiting for the next activity to settle down before doing so. It contains * HistoryRecord objects. */ //正准备被Stop,但是在等待另一个Activity完全stop时的Activity集合 final ArrayList<ActivityRecord> mStoppingActivities = new ArrayList<ActivityRecord>(); /** * List of activities that are in the process of going to sleep. */ // app进程中将要处于sleep的Activity集合 final ArrayList<ActivityRecord> mGoingToSleepActivities= new ArrayList<ActivityRecord>(); /** * Animations that for the current transition have requested not to be considered for the transition animation. */ // 需不要迁移动画的Activity集合 final ArrayList<ActivityRecord> mNoAnimActivities = new ArrayList<ActivityRecord>(); /** * List of activities that are ready to be finished, but waiting for the previous activity to settle down before doing so. It contains * HistoryRecord objects. */ // 正要别finished的,但是等待上一个Activityfinished完毕的Activity集合 final ArrayList<ActivityRecord> mFinishingActivities = new ArrayList<ActivityRecord>();
/** * When we are in the process of pausing an activity, before starting the next one, this variable holds the activity that is currently being paused. */ //当要暂定一个Activity时且没有启动一个新的Activity之前,用这个变量来保存正在处于暂停的Activity ActivityRecord mPausingActivity = null; /** * This is the last activity that we put into the paused state. This is used to determine if we need to do an activity transition while sleeping, * when we normally hold the top activity paused. */ //最近一个被暂停的Activity ActivityRecord mLastPausedActivity = null; /** * Current activity that is resumed, or null if there is none. */ //正在处于resume状态的Activity ActivityRecord mResumedActivity = null; /** * This is the last activity that has been started. It is only used to identify when multiple activities are started at once so that the user * can be warned they may not be in the activity they think they are. */ //最近被启动的Activity。 ActivityRecord mLastStartedActivity = null;