Waiting for the surface of new app is created before setting the size
[apps/agl-service-windowmanager.git] / src / layout_manager / layout.cpp
index e469e30..c888b0e 100644 (file)
@@ -69,21 +69,6 @@ bool LayoutManager::updateLayout(json_object* obj,
 
     bool ret = false;
 
-    // Check accelerator pedal state change
-    json_object* json_accel_pedal;
-    if (!json_object_object_get_ex(obj, "accel_pedal", &json_accel_pedal)) {
-        HMI_ERROR("wm:lm", "Parse Error!!");
-        return -1;
-    }
-
-    json_bool is_accel_pedal_state_changed;
-    std::string accel_pedal_state = "";
-    is_accel_pedal_state_changed = jh::getBoolFromJson(json_accel_pedal, "is_changed");
-    if (is_accel_pedal_state_changed) {
-        // If car state is changed, get car state
-        accel_pedal_state = jh::getStringFromJson(json_accel_pedal, "state");
-    }
-
     // Check car state change
     json_object* json_car;
     if (!json_object_object_get_ex(obj, "car", &json_car)) {
@@ -127,11 +112,8 @@ bool LayoutManager::updateLayout(json_object* obj,
         std::string prv_layout_name = this->prv_layers_[layer].begin()->first;
 
         // If car state is changed car_stop -> car_run,
-        // OR accel pedal state is changed accel_pedal_off -> accel_pedal_on,
         // store current state for state of car stop
-        if (((is_car_state_changed) && ("car_run" == car_state))
-            || ((is_accel_pedal_state_changed)
-                && ("accel_pedal_on" == accel_pedal_state))) {
+        if ((is_car_state_changed) && ("car_run" == car_state)) {
             HMI_DEBUG("wm:lm", "Store current state for state of car stop");
             this->prv_layers_car_stop_[layer] = this->crr_layers_[layer];
         }
@@ -157,50 +139,59 @@ bool LayoutManager::updateLayout(json_object* obj,
             HMI_DEBUG("wm:lm", "crr state: %s", crr_layout_name);
 
             TypeLayouts crr_layout;
-            if (((is_car_state_changed) && ("car_stop" == car_state))
-                || ((is_accel_pedal_state_changed)
-                    && ("accel_pedal_off" == accel_pedal_state))) {
+            if ((is_car_state_changed) && ("car_stop" == car_state)) {
                 // If car state is changed car_run -> car_stop,
-                // OR accel pedal state is changed accel_pedal_on -> accel_pedal_off,
                 // restore state of car stop
-                HMI_DEBUG("wm:lm", "Restore state of car stop");
+                HMI_DEBUG("wm:lm", "Car state is changed car_run -> car_stop, so restore state of car stop");
                 crr_layout = this->prv_layers_car_stop_[layer];
             }
             else if ("none" == std::string(crr_layout_name)) {
-              // If current layout is "none",
-              // current areas is set with "none"
-              TypeAreas area;
-              TypeRolCtg rol_ctg;
-              rol_ctg["none"] = "none";
-              area["none"] = rol_ctg;
-              crr_layout["none"] = area;
+                // If current layout is "none",
+                // current areas is set with "none"
+                HMI_DEBUG("wm:lm", "Current layout is \"none\"");
+                TypeAreas area;
+                TypeRolCtg rol_ctg;
+                rol_ctg["none"] = "none";
+                area["none"] = rol_ctg;
+                crr_layout["none"] = area;
             }
             else {
                 if (std::string(crr_layout_name) == prv_layout_name) {
                     // If previous layout is same with current,
                     // previous areas are copied to current
+                    HMI_DEBUG("wm:lm", "Previous layout is same with current");
                     crr_layout[crr_layout_name] = this->prv_layers_[layer][crr_layout_name];
                 }
                 else {
                     // If previous layout is NOT same with current,
                     // current areas is set with default value
+                    HMI_DEBUG("wm:lm", "Previous layout is NOT same with current");
                     crr_layout[crr_layout_name] = this->layout_define_[crr_layout_name];
                 }
 
                 // Update role in new area
-                if (is_car_state_changed || is_accel_pedal_state_changed) {
+                if (is_car_state_changed) {
                     // Updating role is not necessary
                     // because new_role is not specified
-                    // when car or accel pedal state is changed
+                    // when car state is changed
+                    HMI_DEBUG("wm:lm", "Updating role is not necessary because new_role is not specified when car state is changed");
                 }
                 else {
+                    HMI_DEBUG("wm:lm", "Get new_area for new role");
                     // Get new_area for new role
                     std::string new_area = this->getAreaName(this->layout_define_[crr_layout_name],
                                                              new_role, category);
 
-                    TypeRolCtg crr_role;
-                    crr_role["role"] = std::string(new_role);
-                    crr_layout[crr_layout_name][new_area] = crr_role;
+                    if ("none" == new_area) {
+                        HMI_DEBUG("wm:lm", "It is not necessary to update role of areas in this layer, because new_role is not specified for this layer");
+                    }
+                    else {
+                        // Update role in new area
+                        // because new_role is specified for this layer
+                        TypeRolCtg crr_role;
+                        crr_role["role"] = std::string(new_role);
+                        crr_layout[crr_layout_name][new_area] = crr_role;
+                    }
                 }
             }