Source:
public boolean processMessage(Message message) { switch (message.what) { case CMD_RECEIVE_REQUEST_FOR_CHILD: handleRequestIkeMessage( (IkeMessage) message.obj, message.arg1 , null ); return HANDLED; case CMD_OUTBOUND_CHILD_PAYLOADS_READY: int exchangeType = message.arg1; boolean isResp = message.arg2 == CHILD_PAYLOADS_DIRECTION_RESPONSE; int messageId = isResp ? mCurrentIkeSaRecord.getRemoteRequestMessageId() - 1 : mCurrentIkeSaRecord.getLocalRequestMessageId(); IkeHeader ikeHeader = new IkeHeader( mCurrentIkeSaRecord.getInitiatorSpi(), mCurrentIkeSaRecord.getResponderSpi(), IkePayload.PAYLOAD_TYPE_SK, exchangeType, isResp, mCurrentIkeSaRecord.isLocalInit, messageId); IkeMessage ikeMessage = new IkeMessage(ikeHeader, (List<IkePayload>) message.obj); sendEncryptedIkeMessage(ikeMessage); return HANDLED; case CMD_CHILD_PROCEDURE_FINISHED: ChildSessionStateMachine childSession = (ChildSessionStateMachine) message.obj; if (mChildInLocalProcedure == childSession) { mChildInLocalProcedure = null; } if (mChildInRemoteProcedure == childSession) { mChildInRemoteProcedure = null; } if (mChildInLocalProcedure == null && mChildInRemoteProcedure == null) { transitionTo(mIdle); } return HANDLED; case CMD_HANDLE_FIRST_CHILD_NEGOTIATION: FirstChildNegotiationData childData = (FirstChildNegotiationData) message.obj; mChildInLocalProcedure = buildChildSession(childData.childSessionOptions); mChildInLocalProcedure.handleFirstChildExchange( childData.reqPayloads, childData.respPayloads); return HANDLED; case CMD_EXECUTE_LOCAL_REQ: executeLocalRequest((ChildLocalRequest) message.obj); return HANDLED; default: return super.processMessage(message); } }

Target:
public boolean processMessage(Message message) { switch (message.what) { case CMD_RECEIVE_REQUEST_FOR_CHILD: handleRequestIkeMessage( (IkeMessage) message.obj, message.arg1 , null ); return HANDLED; case CMD_OUTBOUND_CHILD_PAYLOADS_READY: int exchangeType = message.arg1; boolean isResp = (message.arg2 == CHILD_PAYLOADS_DIRECTION_RESPONSE); int messageId = isResp ? mLastInboundRequestMsgId : mCurrentIkeSaRecord.getLocalRequestMessageId(); IkeHeader ikeHeader = new IkeHeader( mCurrentIkeSaRecord.getInitiatorSpi(), mCurrentIkeSaRecord.getResponderSpi(), IkePayload.PAYLOAD_TYPE_SK, exchangeType, isResp, mCurrentIkeSaRecord.isLocalInit, messageId); IkeMessage ikeMessage = new IkeMessage(ikeHeader, (List<IkePayload>) message.obj); sendEncryptedIkeMessage(ikeMessage); return HANDLED; case CMD_CHILD_PROCEDURE_FINISHED: ChildSessionStateMachine childSession = (ChildSessionStateMachine) message.obj; if (mChildInLocalProcedure == childSession) { mChildInLocalProcedure = null; } if (mChildInRemoteProcedure == childSession) { mChildInRemoteProcedure = null; } if (mChildInLocalProcedure == null && mChildInRemoteProcedure == null) { transitionTo(mIdle); } return HANDLED; case CMD_HANDLE_FIRST_CHILD_NEGOTIATION: FirstChildNegotiationData childData = (FirstChildNegotiationData) message.obj; mChildInLocalProcedure = buildChildSession(childData.childSessionOptions); mChildInLocalProcedure.handleFirstChildExchange( childData.reqPayloads, childData.respPayloads); return HANDLED; case CMD_EXECUTE_LOCAL_REQ: executeLocalRequest((ChildLocalRequest) message.obj); return HANDLED; default: return super.processMessage(message); } }