From 729d2520cfc40d3eb461d2203a0b40ba7e259470 Mon Sep 17 00:00:00 2001 From: "fukubayashi.akio" Date: Thu, 20 Jun 2019 10:33:15 +0900 Subject: Fix area and role Signed-off-by: fukubayashi.akio --- layers.json | 2 +- policy_manager/config/roles.json.zipc.split | 10 +++--- src/main.cpp | 34 +++++++++++++++++-- src/window_manager.cpp | 1 + src/wm_layer_control.cpp | 52 ++++++++++++++++++++--------- src/wm_layer_control.hpp | 3 +- 6 files changed, 77 insertions(+), 25 deletions(-) diff --git a/layers.json b/layers.json index 622ab16..2b157ee 100644 --- a/layers.json +++ b/layers.json @@ -24,7 +24,7 @@ }, { "name": "NearApps", - "role": "receiver2", + "role": "receiver2|upleftreceiver", "id_range_begin": 2600, "id_range_end": 2999, "comment": "NearApps is the part of Apps. The z order of this layer is higher than Apps" diff --git a/policy_manager/config/roles.json.zipc.split b/policy_manager/config/roles.json.zipc.split index 2a87de8..eee2156 100644 --- a/policy_manager/config/roles.json.zipc.split +++ b/policy_manager/config/roles.json.zipc.split @@ -63,7 +63,7 @@ }, { "category": "receiver", - "role": "receiver", + "role": "receiver | ssubreceiver", "area": "split.sub | normal.full", "layer": "apps", } @@ -195,25 +195,25 @@ "roles":[ { "category": "receiver", - "role": "receiver", + "role": "receiver | fullreceiver", "area": "normal.full", "layer": "apps", }, { "category": "receiver2", - "role": "receiver2", + "role": "receiver2 | upleftreceiver", "area": "upper.left", "layer": "near_apps", }, { "category": "general", - "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | settings | hvac | dashboard", + "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | settings | hvac | hudtbt | tbtnavi | tbtnavi2 | dashboard", "area": "hud.normal.full", "layer": "remote_hud", }, { "category": "speed", - "role": "tachometer", + "role": "tachometer | speed | hudspeed", "area": "hud.upper.left", "layer": "remote_hud_upper_left", } diff --git a/src/main.cpp b/src/main.cpp index 022834b..2584da0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -/* +/*; * Copyright (c) 2017 TOYOTA MOTOR CORPORATION * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -49,6 +49,8 @@ struct afb_instance ~afb_instance() = default; int init(); + + bool testFlg; }; struct afb_instance *g_afb_instance; @@ -71,6 +73,8 @@ int _binding_init() goto error; } + g_afb_instance->testFlg = false; + atexit([] { delete g_afb_instance; }); return 0; @@ -307,6 +311,22 @@ void windowmanager_activatewindow(afb_req req) noexcept afb_req_success(req, NULL, "success"); }; + HMI_DEBUG("activateWindow role:%s area:%s", appid, a_drawing_area); + +#if 0 + std::string appidString = appid; + HMI_DEBUG("flg: %d", g_afb_instance->testFlg); + if ((appidString == "dashboard" && g_afb_instance->testFlg) || appidString == "hudspeed") + { + HMI_DEBUG("%s is remote transfer", appid); + g_afb_instance->wmgr.api_activate_surface_to_master( + appid, a_drawing_name, "hud.upper.left", reply); + + g_afb_instance->testFlg = false; + return; + } + +#endif if (!g_afb_instance->wmgr.wmcon.isRemoteArea(a_drawing_area)) { g_afb_instance->wmgr.api_activate_window( @@ -331,6 +351,12 @@ void windowmanager_activatewindow(afb_req req) noexcept appid, a_drawing_name, a_drawing_area, reply); } } +#if 0 + if (appidString == "dashboard") + { + g_afb_instance->testFlg = true; + } +#endif free(appid); } } @@ -720,7 +746,11 @@ void windowmanager_wm_subscribe(afb_req req) noexcept } afb_req_success(req, NULL, "success"); - g_afb_instance->wmgr.setSubscribed(true); + if (event_id == 7) + { + //g_afb_instance->wmgr.api_handshake(); + g_afb_instance->wmgr.setSubscribed(true); + } } catch (std::exception &e) { diff --git a/src/window_manager.cpp b/src/window_manager.cpp index f121709..52a7144 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -84,6 +84,7 @@ static sd_event_source *g_timer_ev_src = nullptr; static sd_event_source *g_timer_endInit_src = nullptr; static AppList g_app_list; static WindowManager *g_context; +static bool testFlg = false; static vector white_list_area_size_change = { "homescreen" }; diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp index 887fc58..3e3d0d5 100644 --- a/src/wm_layer_control.cpp +++ b/src/wm_layer_control.cpp @@ -861,18 +861,7 @@ bool LayerControl::moveForeGround(const shared_ptr client) bool LayerControl::moveRemote(unsigned layer, const std::string& area) { bool ret = false; - std::string remote_layer; - std::string ecu_name = area; - - if (area.find('.') != std::string::npos) - { - std::vector elements; - elements = parseString(area, '.'); - ecu_name = elements[0]; - } - - remote_layer = this->areaToRemoteLayer(ecu_name); - + std::string remote_layer = this->areaToRemoteLayer(area); auto remote = this->getWMLayer(remote_layer); if(remote != nullptr) @@ -944,13 +933,46 @@ std::string LayerControl::hasRemoteLayer(unsigned layer) return ""; } -std::string LayerControl::areaToRemoteLayer(std::string area) +std::string LayerControl::areaToRemoteLayer(const std::string& area) { + std::vector elements; + + if (area.find('.') != std::string::npos) + { + elements = parseString(area, '.'); + } + else + { + elements.push_back(area); + } + for (auto itr = wm_remoteLayerName.begin(); itr != wm_remoteLayerName.end(); ++itr) { - if (std::regex_search(*itr, std::regex(area, std::regex::icase))) + unsigned int idx = 0; + for (auto itr_elem = elements.begin(); itr_elem != elements.end(); ++itr_elem) { - return *itr; + if (std::regex_search(*itr, std::regex(*itr_elem, std::regex::icase))) + { + if (++idx == elements.size()) + { + return *itr; + } + } + else + { + // TODO: workaround, skip normal case + if ((itr_elem->compare("normal") == 0) || (itr_elem->compare("full") == 0)) + { + if (++idx == elements.size()) + { + return *itr; + } + } + else + { + break; + } + } } } diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp index 102896d..7c19e97 100644 --- a/src/wm_layer_control.hpp +++ b/src/wm_layer_control.hpp @@ -102,8 +102,7 @@ class LayerControl void dispatchLayerPropChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask); std::string hasRemoteLayer(unsigned layer); - std::string areaToRemoteLayer(std::string area); - + std::string areaToRemoteLayer(const std::string& area); private: WMError makeVisible(const std::shared_ptr client); WMError makeInvisible(const std::shared_ptr client); -- cgit 1.2.3-korg