StatMachine的setInitialState方法,用于设置状态机的初始优先级,代码如下:
//frameworks/base/core/java/com/android/internal/util/StateMachine.java
public class StateMachine {
private SmHandler mSmHandler;
public final void setInitialState(State initialState) {
mSmHandler.setInitialState(initialState);
}
}
调用SmHandler的setInitialState方法:
//frameworks/base/core/java/com/android/internal/util/StateMachine.java
public class StateMachine {
private static class SmHandler extends Handler {
/** The initial state that will process the first message */
private State mInitialState;
private final void setInitialState(State initialState) {
if (mDbg) mSm.log("setInitialState: initialState=" + initialState.getName());
mInitialState = initialState;
}
}
}
方法中就一个赋值,将传入的initialState赋值给mInitialState变量。