Get focused pid to set foreground 46/119546/1
authorWonnam Jang <wn.jang@samsung.com>
Fri, 17 Mar 2017 08:17:21 +0000 (17:17 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Fri, 17 Mar 2017 08:18:03 +0000 (17:18 +0900)
Change-Id: I73848b36bb8472b1bcd4ec364607a27c22e84c63
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
server/vcd_client_data.c

index 9b2a00f897ad7d7305382aacf6bff365a38836f4..b03395098ffcbf222c6ea30606a3ba93a73b6363 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <app_manager.h>
 #include <aul.h>
+#include <aul_window.h>
 
 #include "vcd_client_data.h"
 #include "vcd_config.h"
@@ -1396,9 +1397,14 @@ void vcd_client_update_foreground_pid()
 {
        int tmp_pid = VC_RUNTIME_INFO_NO_FOREGROUND;
        vcd_config_get_foreground(&tmp_pid);
-       SLOG(LOG_INFO, TAG_VCD, "[INFO] foreground pid (%d)", tmp_pid);
 
-       char appid[255] = {'\0',};
+       int pid = VC_RUNTIME_INFO_NO_FOREGROUND;
+       int ret = aul_window_get_focused_pid(&pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get focused pid, ret(%d)", ret);
+       }
+       SLOG(LOG_INFO, TAG_VCD, "[INFO] Foreground pid (%d), Focused pid (%d)", tmp_pid, pid);
+
        GSList *iter = NULL;
        vc_client_info_s *data = NULL;
 
@@ -1417,10 +1423,7 @@ void vcd_client_update_foreground_pid()
 
                        if (NULL != data) {
                                SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, data->pid);
-                               memset(appid, 0, 255);
-                               aul_app_get_appid_bypid(data->pid, appid, sizeof(appid));
-                               int status = aul_app_get_status(appid);
-                               if (status == STATUS_FOCUS) {
+                               if (pid == data->pid) {
                                        SLOG(LOG_INFO, TAG_VCD, "[INFO] foreground pid (%d)", data->pid);
                                        vcd_config_set_foreground(data->pid, true);
                                        if (tmp_pid != data->pid) {
@@ -1448,10 +1451,7 @@ void vcd_client_update_foreground_pid()
 
                        if (NULL != widget_data) {
                                SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, widget_data->pid);
-                               memset(appid, 0, 255);
-                               aul_app_get_appid_bypid(widget_data->pid, appid, sizeof(appid));
-                               int status = aul_app_get_status(appid);
-                               if (status == STATUS_FOCUS) {
+                               if (pid == widget_data->pid) {
                                        SLOG(LOG_INFO, TAG_VCD, "[INFO] foreground pid (%d)", widget_data->pid);
                                        vcd_config_set_foreground(widget_data->pid, true);
                                        if (tmp_pid != widget_data->pid) {