aboutsummaryrefslogtreecommitdiffstats
path: root/src/policy_manager
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-06-15 20:40:22 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-06-15 20:40:22 +0900
commit36098a64cf5bcac3d721f126e3d809674badc110 (patch)
tree449e95a62f881d82ee55d0de5ffdaed95462e636 /src/policy_manager
parent172c4fb3d449b908baff3111fd171b42935fbb4f (diff)
Modify format of layout information and process for updating layout
and delete unnecessary process Change-Id: I266cbc684c28b49d9855db851a56afbff3588b35 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager')
-rw-r--r--src/policy_manager/policy_manager.cpp105
-rw-r--r--src/policy_manager/policy_manager.hpp18
-rw-r--r--src/policy_manager/zipc/dummy_stm.c10
3 files changed, 32 insertions, 101 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index 2e4a6f9..23d1e29 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -262,7 +262,6 @@ static int checkPolicy(sd_event_source *source, void *data) {
crr_state.layer[stm::gStmLayerNoOnScreen].state,
stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoOnScreen].state]);
-#if 1 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// Store previous layers
pm::g_prv_layers = pm::g_crr_layers;
@@ -472,7 +471,6 @@ static int checkPolicy(sd_event_source *source, void *data) {
HMI_DEBUG("wm:pm", ">>> >>> >>> >>> ROLE:%s", as.role.c_str());
}
}
-#endif // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
json_object* json_out = json_object_new_object();
@@ -532,83 +530,36 @@ static int checkPolicy(sd_event_source *source, void *data) {
stm::gStmRestrictionModeStateNo2Name[crr_state.restriction_mode.state],
&json_out);
+ // Create layout information
+ //
// "layers": [
+ // {
+ // "homescreen": {
+ // "changed": <bool>,
+ // "areas": [
+ // {
+ // "name":<const char*>,
+ // "role":<const char*>
+ // }.
+ // ...
+ // ]
+ // }
+ // },
+ // ...
json_object* json_layer = json_object_new_array();
json_object* json_tmp;
+ for (int layer_no = stm::gStmLayerNoMin;
+ layer_no <= stm::gStmLayerNoMax; layer_no++) {
+ const char* layer_name = stm::gStmLayerName[layer_no];
+ HMI_DEBUG("wm:pm", "LAYER:%s", layer_name);
- // {
- // "homescreen": {
- // "changed": <bool>,
- // "areas": [
- // {
- // "name":<const char*>,
- // "role":<const char*>
- // }.
- // ...
- // ]
- // }
- // },
- 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);
-
- // {
- // "apps": {
- // "is_changed": <bool>,
- // "state": <const char*>
- // }
- // },
- 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);
-
- // {
- // "restriction": {
- // "is_changed": <bool>,
- // "state": <const char*>
- // }
- // },
- 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);
-
- // {
- // "on_screen": {
- // "is_changed": <bool>,
- // "state": <const char*>
- // }
- // },
- 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);
+ json_tmp = json_object_new_object();
+ addStateToJson(layer_name,
+ crr_state.layer[layer_no].is_changed,
+ pm::g_crr_layers[layer_name].layout_state.area_list,
+ &json_tmp);
+ json_object_array_add(json_layer, json_tmp);
+ }
// Add json array of layer
json_object_object_add(json_out, "layers", json_layer);
@@ -770,10 +721,6 @@ int PolicyManager::inputEvent(json_object* json_in) {
return 0;
}
-std::string PolicyManager::roleToCategory(const char* role) {
- return this->role2category_[role];
-}
-
extern const char* kDefaultRoleDb;
int PolicyManager::loadRoleDb() {
HMI_DEBUG("wm:pm", "Call");
diff --git a/src/policy_manager/policy_manager.hpp b/src/policy_manager/policy_manager.hpp
index f026edd..0e05cc0 100644
--- a/src/policy_manager/policy_manager.hpp
+++ b/src/policy_manager/policy_manager.hpp
@@ -42,7 +42,6 @@ public:
int initialize();
void registerCallback(CallbackTable callback_table);
int inputEvent(json_object* json_in);
- std::string roleToCategory(const char* role);
private:
// Disable copy and move
@@ -60,23 +59,6 @@ private:
std::unordered_map<std::string, std::string> category2role_;
std::unordered_map<std::string, std::string> role2defaultarea_;
-#if 0
- struct AreaState {
- std::string name;
- std::string role;
- } AreaState;
-
- struct LayoutState {
- std::string name;
- std::vector<AreaState> areas;
- } LayoutState;
-
- struct LayerState {
- std::string name;
- LayoutState layout;
- } LayerState;
-#endif
-
int initializeSdEventLoop();
// Load role.db
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 71dfbaa..643e11e 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -344,13 +344,15 @@ int stmTransitionState(int event, stm_state_t* state) {
if (gStmRestrictionModeStateNoOff == restriction_mode_state) {
switch (category_no) {
case STM_CTG_NO_HOMESCREEN:
- // Apps layer
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoApps].is_changed = STM_TRUE;
-
// Homescreen layer
g_crr_state.layer[gStmLayerNoHomescreen].state = gStmLayoutNoHs;
g_crr_state.layer[gStmLayerNoHomescreen].is_changed = STM_TRUE;
+
+ // Apps layer
+ if (gStmLayoutNoNone != apps_state) {
+ g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone;
+ g_crr_state.layer[gStmLayerNoApps].is_changed = STM_TRUE;
+ }
break;
case STM_CTG_NO_MAP:
switch (area_no) {