Update managing layout information
authorYuta Doi <yuta-d@witz-inc.co.jp>
Mon, 11 Jun 2018 10:44:27 +0000 (19:44 +0900)
committerYuta Doi <yuta-d@witz-inc.co.jp>
Mon, 11 Jun 2018 10:44:27 +0000 (19:44 +0900)
Change-Id: I9e1e3f5c7d0f1815ef3d4ea1045eb67db35ad787
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
src/policy_manager/policy_manager.cpp

index 0af8398..6f12795 100644 (file)
@@ -330,6 +330,7 @@ static int checkPolicy(sd_event_source *source, void *data) {
                 }
 
                 // Update role in new area
+#if 0
 #if 1
                 if (crr_state.restriction_mode.is_changed) {
                     // Updating role is not necessary
@@ -345,7 +346,7 @@ static int checkPolicy(sd_event_source *source, void *data) {
 #endif
                 }
                 else {
-
+#endif
                     std::map<std::string, std::vector<pm::AreaState>> ctg_list;
                     for (int ctg_no=stm::gStmCategoryNoMin;
                          ctg_no<=stm::gStmCategoryNoMax; ctg_no++) {
@@ -358,7 +359,8 @@ static int checkPolicy(sd_event_source *source, void *data) {
                             if (std::string(ctg) == area_state.category) {
                                 // If there is the category which is same with new category in previous layout,
                                 // push it to area list
-                                HMI_DEBUG("wm:pm", "push area_state to prv list");
+                                HMI_DEBUG("wm:pm", "push area_state to prv list category:%s role:%s",
+                                    area_state.category.c_str(), area_state.role.c_str());
                                 area_list.push_back(area_state);
                             }
                         }
@@ -451,7 +453,9 @@ static int checkPolicy(sd_event_source *source, void *data) {
 
                     // Update areas
                     for (pm::AreaState &as : crr_layout_state.area_list) {
-                        if (as.role != role) {  // This conditional expression is useful in only when requested activate event
+                        HMI_DEBUG("wm:pm", "current area info area:%s category:%s role:%s",
+                                  as.name.c_str(), as.category.c_str(), as.role.c_str());
+                        if ((as.role != role) || ("" == as.role)) {
                             HMI_DEBUG("wm:pm", "update areas for category:%s", as.category.c_str());
                             if (0 != ctg_list[as.category].size()) {
                                 HMI_DEBUG("wm:pm", "update role to %s by using area list this category",
@@ -466,7 +470,9 @@ static int checkPolicy(sd_event_source *source, void *data) {
                             }
                         }
                     }
+#if 0
                 }
+#endif
             }
             // Update current layout of this layer
             pm::g_crr_layers[layer_name].layout_state = crr_layout_state;
@@ -560,7 +566,11 @@ static int checkPolicy(sd_event_source *source, void *data) {
     json_tmp = json_object_new_object();
     addStateToJson("homescreen",
                    crr_state.layer[stm::gStmLayerNoHomescreen].is_changed,
+#if 1
+                   pm::g_crr_layers["homescreen"].layout_state.name.c_str(),
+#else
                    stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoHomescreen].state],
+#endif
                    &json_tmp);
     json_object_array_add(json_layer, json_tmp);
 
@@ -573,7 +583,11 @@ static int checkPolicy(sd_event_source *source, void *data) {
     json_tmp = json_object_new_object();
     addStateToJson("apps",
                    crr_state.layer[stm::gStmLayerNoApps].is_changed,
+#if 1
+                   pm::g_crr_layers["apps"].layout_state.name.c_str(),
+#else
                    stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoApps].state],
+#endif
                    &json_tmp);
     json_object_array_add(json_layer, json_tmp);
 
@@ -586,7 +600,11 @@ static int checkPolicy(sd_event_source *source, void *data) {
     json_tmp = json_object_new_object();
     addStateToJson("restriction",
                    crr_state.layer[stm::gStmLayerNoRestriction].is_changed,
+#if 1
+                   pm::g_crr_layers["restriction"].layout_state.name.c_str(),
+#else
                    stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoRestriction].state],
+#endif
                    &json_tmp);
     json_object_array_add(json_layer, json_tmp);
 
@@ -599,7 +617,11 @@ static int checkPolicy(sd_event_source *source, void *data) {
     json_tmp = json_object_new_object();
     addStateToJson("on_screen",
                    crr_state.layer[stm::gStmLayerNoOnScreen].is_changed,
+#if 1
+                   pm::g_crr_layers["on_screen"].layout_state.name.c_str(),
+#else
                    stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoOnScreen].state],
+#endif
                    &json_tmp);
     json_object_array_add(json_layer, json_tmp);