Select wakeup engine that has reported wakeup event 20/201920/5
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 21 Mar 2019 02:47:40 +0000 (11:47 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 26 Mar 2019 07:25:48 +0000 (16:25 +0900)
Change-Id: I8b7698361aa8a6c5279e6e62615046f3148280e0

plugins/wakeup-manager/src/wakeup_manager.cpp

index c7314ad..3458d89 100644 (file)
@@ -81,8 +81,7 @@ typedef struct {
        std::vector<std::string> assistant_list;
 } wakeup_engine_info;
 
-//static int g_wakeup_engine_selected = -1;
-static int g_wakeup_engine_selected = 0;
+static int g_wakeup_engine_selected = -1;
 static wakeup_engine_info g_wakeup_engine_info[MAX_WAKEUP_ENGINE_NUM];
 
 static char* g_current_language = NULL;
@@ -458,6 +457,16 @@ void CWakeupEventObserver::on_wakeup(wakeup_event_info info)
 {
        if (NULL != g_wakeup_event_cb) {
                g_last_wakeup_event_info = info;
+               for (int loop = 0;loop < g_engine_count;loop++) {
+                       auto iter = std::find(
+                               g_wakeup_engine_info[loop].assistant_list.begin(),
+                               g_wakeup_engine_info[loop].assistant_list.end(),
+                               std::string{info.wakeup_appid});
+                       if (iter != g_wakeup_engine_info[loop].assistant_list.end()) {
+                               g_wakeup_engine_selected = loop;
+                               MWR_LOGD("Selected : %s", g_wakeup_engine_info[loop].engine_name);
+                       }
+               }
                g_wakeup_event_cb(info, g_wakeup_event_user_data);
        }
 }