Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a2b9f61 authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Add handler callbacks to StateMachine"

parents fb912e0b 0c71404e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -778,6 +778,7 @@ public class StateMachine {
         */
        @Override
        public final void handleMessage(Message msg) {
            mSm.onPreHandleMessage(msg);
            if (!mHasQuit) {
                if (mDbg) mSm.log("handleMessage: E msg.what=" + msg.what);

@@ -803,6 +804,7 @@ public class StateMachine {
                // We need to check if mSm == null here as we could be quitting.
                if (mDbg && mSm != null) mSm.log("handleMessage: X");
            }
            mSm.onPostHandleMessage(msg);
        }

        /**
@@ -1273,6 +1275,21 @@ public class StateMachine {
        initStateMachine(name, handler.getLooper());
    }

    /**
     * Notifies subclass that the StateMachine handler is about to process the Message msg
     * @param msg The message that is being handled
     */
    protected void onPreHandleMessage(Message msg) {
    }

    /**
     * Notifies subclass that the StateMachine handler has finished processing the Message msg and
     * has possibly transitioned to a new state.
     * @param msg The message that is being handled
     */
    protected void onPostHandleMessage(Message msg) {
    }

    /**
     * Add a new state to the state machine
     * @param state the state to add