diff --git a/system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp b/system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp index 3d6a52bfd3d86..4133be8e15a63 100644 --- a/system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp +++ b/system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp @@ -184,11 +184,17 @@ void MrmHandler::operateMrm() if (current_mrm_behavior == mrm_state_.behavior) { return; } - if (requestMrmBehavior(current_mrm_behavior, RequestType::CALL)) { - mrm_state_.behavior = current_mrm_behavior; - } else { + // First: cancel the previous behavior + if (!requestMrmBehavior(mrm_state_.behavior, RequestType::CANCEL)) { + handleFailedRequest(); + return; + } + // Second: call the current behavior + if (!requestMrmBehavior(current_mrm_behavior, RequestType::CALL)) { handleFailedRequest(); + return; } + mrm_state_.behavior = current_mrm_behavior; return; } if (mrm_state_.state == MrmState::MRM_SUCCEEDED) {