Add SM_INIT_CMD.

The enter methods of the initial states are now executed
in response to a message and therefore run in the handler
associated with the StateMachine. Previously these would
run in the thread that start() was called from.

I ran into a problem where in an Activities onCreate I called
StateMachine#start(), which called the default states enter,
which invoked Context#bindService. But bindService never
completed because onCreate hadn't returned. But invoking the
enter methods on the StateMachines handler this problem does
not occur.

Change-Id: I2c2e52e5de29a987c098196a0efdba446cbc29d0
1 file changed