#include <app_manager.h>
#include <aul.h>
+#include <aul_window.h>
#include "vcd_client_data.h"
#include "vcd_config.h"
{
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;
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) {
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) {