summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/window_manager.cpp32
-rw-r--r--src/window_manager.hpp5
2 files changed, 37 insertions, 0 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index 28ef868..fcc0906 100644
--- a/src/window_manager.cpp
+++ b/src/window_manager.cpp
@@ -50,6 +50,7 @@ const char kKeyWidthPixel[] = "width_pixel";
const char kKeyHeightPixel[] = "height_pixel";
const char kKeyWidthMm[] = "width_mm";
const char kKeyHeightMm[] = "height_mm";
+const char kKeyIds[] = "ids";
static sd_event_source *g_timer_ev_src = nullptr;
static AppList g_app_list;
@@ -414,6 +415,7 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
{
//this->emit_error();
}
+ this->emitScreenUpdated(current_req);
HMI_SEQ_INFO(current_req, "Finish request status: %s", errorDescription(ret));
g_app_list.removeRequest(current_req);
@@ -1363,6 +1365,36 @@ WMError WindowManager::changeCurrentState(unsigned req_num)
return WMError::SUCCESS;
}
+void WindowManager::emitScreenUpdated(unsigned req_num)
+{
+ // Get visible apps
+ HMI_SEQ_DEBUG(req_num, "emit screen updated");
+ bool found = false;
+ auto actions = g_app_list.getActions(req_num, &found);
+
+ // create json object
+ json_object *j = json_object_new_object();
+ json_object *jarray = json_object_new_array();
+
+ for(const auto& action: actions)
+ {
+ if(action.visible != TaskVisible::INVISIBLE)
+ {
+ json_object_array_add(jarray, json_object_new_string(action.appid.c_str()));
+ }
+ }
+ json_object_object_add(j, kKeyIds, jarray);
+ HMI_SEQ_INFO(req_num, "Visible app: %s", json_object_get_string(j));
+
+ int ret = afb_event_push(
+ this->map_afb_event[kListEventName[Event_ScreenUpdated]], j);
+ if (ret != 0)
+ {
+ HMI_DEBUG("wm", "afb_event_push failed: %m");
+ }
+ json_object_put(jarray);
+}
+
void WindowManager::setTimer()
{
HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Timer set activate");
diff --git a/src/window_manager.hpp b/src/window_manager.hpp
index 00a798c..b5b1c4d 100644
--- a/src/window_manager.hpp
+++ b/src/window_manager.hpp
@@ -64,6 +64,7 @@ extern const char kKeyWidthPixel[];
extern const char kKeyHeightPixel[];
extern const char kKeyWidthMm[];
extern const char kKeyHeightMm[];
+extern const char kKeyIds[];
struct id_allocator
{
@@ -152,6 +153,8 @@ class WindowManager
Event_SyncDraw,
Event_FlushDraw,
+ Event_ScreenUpdated,
+
Event_Error,
Event_Val_Max = Event_Error,
@@ -164,6 +167,7 @@ class WindowManager
"invisible",
"syncdraw",
"flushdraw",
+ "screen_updated",
"error"};
struct controller_hooks chooks;
@@ -255,6 +259,7 @@ class WindowManager
WMError visibilityChange(const WMAction &action);
WMError setSurfaceSize(unsigned surface, const std::string& area);
WMError changeCurrentState(unsigned req_num);
+ void emitScreenUpdated(unsigned req_num);
void setTimer();
void stopTimer();