aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/policy_manager/policy_manager.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index 6f80131..390aa51 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -260,9 +260,9 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
category_no = ((event_data & STM_MSK_CTG_NO) >> 8) - 1;
area_no = ((event_data & STM_MSK_ARA_NO) >> 16) - 1;
- std::string req_evt = std::string(stm::gStmEventName[event_no]);
- std::string req_ctg = std::string(stm::gStmCategoryName[category_no]);
- std::string req_area = std::string(stm::gStmAreaName[area_no]);
+ std::string req_evt = std::string((event_no < 0) ? "-" : stm::gStmEventName[event_no]);
+ std::string req_ctg = std::string((category_no < 0) ? "-" : stm::gStmCategoryName[category_no]);
+ std::string req_area = std::string((area_no < 0) ? "-" : stm::gStmAreaName[area_no]);
std::string req_role = pm::g_req_role_list[event_data];
HMI_DEBUG("wm:pm", "REQ: event:%s role:%s category:%s area:%s",
req_evt.c_str(), req_role.c_str(), req_ctg.c_str(), req_area.c_str());
@@ -294,9 +294,11 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
}
#endif
-
// This layer is changed?
- if (crr_state.layer[layer_no].changed) {
+ int changed = crr_state.layer[layer_no].changed;
+ if (changed) {
+ HMI_DEBUG("wm:pm", "This layer is changed");
+
// Get previous layout name of this layer
pm::LayoutState prv_layout_state = pm::g_prv_layers[layer_name].layout_state;
std::string prv_layout_name = prv_layout_state.name;
@@ -312,20 +314,32 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
// If restriction mode is changed on -> off,
// restore state of restriction mode off
HMI_DEBUG("wm:pm", "Restriction mode is changed on -> off, so restore state of restriction mode off");
- crr_layout_state = pm::g_prv_layers_car_stop[layer_name].layout_state;
#else
if ((crr_state.car_element[gStmCarElementNoRunning].changed)
&& (stm::gStmCarElementNoStop == crr_state.car_element[gStmCarElementNoRunning].state)) {
// If car state is changed car_run -> car_stop,
// restore state of car stop
HMI_DEBUG("wm:pm", "Car state is changed car_run -> car_stop, so restore state of car stop");
- crr_layout_state = pm::g_prv_layers_car_stop[layer_name].layout_state;
#endif
+ crr_layout_state = pm::g_prv_layers_car_stop[layer_name].layout_state;
+ crr_layout_name = crr_layout_state.name;
+ if ((prv_layout_name == crr_layout_name)
+ && (stm::gStmAreaName[stm::gStmAreaNoNone] == crr_layout_name)) {
+ changed = 0;
+ }
+ }
+ else if ((prv_layout_name == crr_layout_name)
+ && (stm::gStmAreaName[stm::gStmAreaNoNone] == crr_layout_name)) {
+ // Copy previous layout state for current
+ crr_layout_state = prv_layout_state;
+ changed = 0;
}
else {
// Copy previous layout state for current
crr_layout_state = prv_layout_state;
+ HMI_DEBUG("wm:pm", "layout name previous:%s current:%s",
+ prv_layout_name.c_str(), crr_layout_name.c_str());
if (prv_layout_name == crr_layout_name) {
HMI_DEBUG("wm:pm", "Previous layout is same with current");
}
@@ -405,7 +419,7 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
area_state.name = "";
area_state.category = ctg;
if (0 != crr_layout_state.role_history[ctg].size()) {
- HMI_ERROR("wm:pm", "Use role in history stack:%s",
+ HMI_DEBUG("wm:pm", "Use role in history stack:%s",
crr_layout_state.role_history[ctg].back().c_str());
area_state.role = crr_layout_state.role_history[ctg].back();
crr_layout_state.role_history[ctg].pop_back();
@@ -454,8 +468,9 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
}
// Update current layout of this layer
pm::g_crr_layers[layer_name].layout_state = crr_layout_state;
- pm::g_crr_layers[layer_name].changed = crr_state.layer[layer_no].changed;
}
+ // Update changed flag
+ pm::g_crr_layers[layer_name].changed = changed;
}
// Erase role for the event_data from list
@@ -576,9 +591,9 @@ static int checkPolicy(sd_event_source *source, void *data) {
category_no = ((event_data & STM_MSK_CTG_NO) >> 8) - 1;
area_no = ((event_data & STM_MSK_ARA_NO) >> 16) - 1;
HMI_DEBUG("wm:pm", ">>>>>>>>>> event:%s category:%s area:%s",
- stm::gStmEventName[event_no],
- stm::gStmCategoryName[category_no],
- stm::gStmAreaName[area_no]);
+ (event_no < 0) ? "-" : stm::gStmEventName[event_no],
+ (category_no < 0) ? "-" : stm::gStmCategoryName[category_no],
+ (area_no < 0) ? "-" : stm::gStmAreaName[area_no]);
// Transition state
stm::stm_state_t crr_state;