Fixed some RPMlint errors - group name, duplicate files, etc.
[profile/ivi/ico-uxf-homescreen.git] / ico-app-framework / ico_uxf_conf_app.c
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   user experiance library(read apprication's configuration file)
11  *
12  * @date    Feb-28-2013
13  */
14
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <unistd.h>
20 #include <string.h>
21 #include <sys/time.h>
22 #include <sys/file.h>
23 #include <errno.h>
24 #include <ail.h>
25
26 #include <package-manager.h>
27
28 #include "ico_apf_log.h"
29 #include "ico_apf_apimacro.h"
30 #include "ico_uxf_conf_common.h"
31
32 /*==============================================================================*/
33 /* define                                                                       */
34 /*==============================================================================*/
35 #define APP_CONF_AIL_NULL_STR   "(NULL)"
36
37 #define APP_CONF_EVENT_OK           (0)
38 #define APP_CONF_EVENT_FAIL         (1)
39
40 typedef struct _conf_pkgmgr_event conf_pkgmgr_event_t;
41
42 struct _conf_pkgmgr_event {
43     conf_pkgmgr_event_t *next;
44     char pkg_name[ICO_UXF_MAX_PROCESS_NAME];
45     int type;
46 };
47
48 /*==============================================================================*/
49 /* define static function prototype                                             */
50 /*==============================================================================*/
51 static Ico_Uxf_App_Config *readAilApplist(void);
52 static void ico_uxf_conf_remakeAppHash(void);
53 static int ico_uxf_conf_pkgmgrEvent(int req_id, const char *pkg_type,
54                     const char *pkg_name, const char *key, const char *val,
55                     const void *pmsg, void *data);
56 static int ico_uxf_conf_addPkgmgrEventListener(void);
57 static int ico_uxf_conf_startEvent(const char *pkg_name, int type);
58 static int ico_uxf_conf_endEvent(const char *pkg_name, int status);
59
60 /*==============================================================================*/
61 /* static tables                                                                */
62 /*==============================================================================*/
63 static Ico_Uxf_App_Config   *_ico_app_config = NULL;
64 static Ico_Uxf_App_Config   *_ico_app_config_update = NULL;
65 static Ico_Uxf_Sys_Config   *sys_config = NULL;
66 static GKeyFile             *sappfile = NULL;
67 static char                 *default_icon = NULL;
68
69 static pkgmgr_client        *conf_pc = NULL;
70 static conf_pkgmgr_event_t  *conf_prog_event = NULL;
71 static Ico_Uxf_AppUpdata_Cb conf_cb_func = NULL;
72
73 /*--------------------------------------------------------------------------*/
74 /**
75  * @brief   ico_uxf_getAppConfig: get application configurations
76  *
77  * @param       none
78  * @return      application configuration table
79  * @retval      !=NULL          success(application configuration table address)
80  * @retval      ==NULL          error(can not read configuration files)
81  */
82 /*--------------------------------------------------------------------------*/
83 ICO_APF_API const Ico_Uxf_App_Config *
84 ico_uxf_getAppConfig(void)
85 {
86     if (_ico_app_config) {
87         return _ico_app_config;
88     }
89     _ico_app_config = g_new0(Ico_Uxf_App_Config,1);
90     _ico_app_config_update = _ico_app_config;
91     return readAilApplist();
92 }
93
94 /*--------------------------------------------------------------------------*/
95 /**
96  * @brief   infoAilpkg: callback function for configuration from AppCore(static function)
97  *
98  * @param[in]   appinfo         AppCore(AIL) application information
99  * @param[in]   data            user data(application index)
100  * @return      result
101  * @retval      AIL_CB_RET_CONTINUE success(continue next application)
102  * @retval      AIL_CB_RET_CANCEL   error(stop all application search)
103  */
104 /*--------------------------------------------------------------------------*/
105 static ail_cb_ret_e
106 infoAilpkg(const ail_appinfo_h appinfo, void *data)
107 {
108     int     num = (int)data;
109     char    *package;
110     char    *icon;
111     char    *name;
112     char    *category;
113     char    *type;
114     char    *exec;
115     GError  *error;
116     char    *app_category;
117     int     app_category_type;
118     char    add_category[400];
119     int     add_category_len;
120     char    work[80];
121     int     i;
122     bool    bval;
123     struct stat buff;
124     Ico_Uxf_conf_application *apptbl;
125
126     _ico_app_config_update->ailNum++;
127
128     /* get package name for appid */
129     ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
130     if (strcasecmp(package, APP_CONF_AIL_NULL_STR) == 0) {
131         package = NULL;
132     }
133     /* get icon path */
134     ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icon);
135     if (strcasecmp(icon, APP_CONF_AIL_NULL_STR) == 0) {
136         icon = NULL;
137     }
138     if ((icon == NULL) || (*icon == 0)) {
139         icon = default_icon;
140     }
141     /* get name */
142     ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name);
143     if (strcasecmp(name, APP_CONF_AIL_NULL_STR) == 0) {
144         name = NULL;
145     }
146
147     /* get default category of this application */
148     add_category[0] = 0;
149     error = NULL;
150     app_category = g_key_file_get_string(sappfile, "app-attributes", package, &error);
151     if (error == NULL)  {
152         app_category_type = 0;
153     }
154     else    {
155         g_clear_error(&error);
156         error = NULL;
157         app_category = g_key_file_get_string(sappfile, "app-attributes", name, &error);
158         if (error == NULL)  {
159             app_category_type = 1;
160         }
161     }
162     add_category_len = 0;
163     if (error != NULL)  {
164         g_clear_error(&error);
165         apfw_trace("infoAilpkg: %s(%s) dose not has app-attributes", package, name);
166     }
167     else    {
168         for (i = 1;; i++)   {
169             strncpy(&add_category[add_category_len], 
170                     app_category, sizeof(add_category)-add_category_len-2);
171             add_category[sizeof(add_category)-2] = 0;
172             add_category_len = strlen(add_category);
173             if (add_category_len > 0)  {
174                 if (add_category[add_category_len-1] != ';')   {
175                     strcpy(&add_category[add_category_len++], ";");
176                 }
177             }
178             snprintf(work, sizeof(work)-1, "%s.%d",
179                      app_category_type == 0 ? package : name, i);
180             error = NULL;
181             app_category = g_key_file_get_string(sappfile, "app-attributes", work, &error);
182             if (error != NULL)  {
183                 g_clear_error(&error);
184                 break;
185             }
186         }
187         apfw_trace("infoAilpkg: %s(%s) has app-category=%s", package, name, add_category);
188     }
189     g_clear_error(&error);
190
191     /* get category */
192     ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &category);
193     if (strcasecmp(category, APP_CONF_AIL_NULL_STR) != 0) {
194         apfw_trace("infoAilpkg: %s + %s", add_category, category);
195         strncpy(&add_category[add_category_len],
196                 category, sizeof(add_category)-add_category_len-1);
197         add_category[sizeof(add_category)-1] = 0;
198     }
199     if (add_category[0])    {
200         category = add_category;
201     }
202     else    {
203         category = NULL;
204     }
205
206     /* get type */
207     ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &type);
208     /* get exec */
209     ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exec);
210     if (strcasecmp(exec, APP_CONF_AIL_NULL_STR) == 0) {
211         exec = NULL;
212     }
213
214     if ((package != NULL) && (*package != 0))   {
215         apptbl = &_ico_app_config_update->application[_ico_app_config_update->applicationNum];
216         apptbl->appid = strdup(package);
217         if (icon)   {
218             if ((stat(icon, &buff) == 0) &&
219                 (! S_ISDIR(buff.st_mode))) {
220                 apptbl->icon_key_name = strdup(icon);
221             }
222             else    {
223                 apptbl->icon_key_name = "\0";
224             }
225         }
226         else    {
227             apptbl->icon_key_name = "\0";
228         }
229         if ((name != NULL) && (*name != 0)) {
230             apptbl->name = strdup(name);
231         }
232         else    {
233             apptbl->name = strdup(package);
234         }
235         if (strcasecmp(type, APP_CONF_AIL_NULL_STR) == 0) {
236             apptbl->type = NULL;
237         }
238         else    {
239             apptbl->type = strdup(type);
240         }
241
242         /* set default values       */
243         apptbl->hostId = sys_config->misc.default_hostId;
244         apptbl->kindId = sys_config->misc.default_kindId;
245         apptbl->categoryId = sys_config->misc.default_categoryId;
246         apptbl->invisiblecpu = 100;
247
248         /* get NoDisplay    */
249         if ((apptbl->icon_key_name != NULL) && (*apptbl->icon_key_name != 0)) {
250             bval = false;
251             ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bval);
252             apptbl->noicon = (int)bval;
253         }
254         else    {
255             apfw_trace("infoAilpkg: %s(%s) has no icon", package, name);
256             apptbl->noicon = 1;
257         }
258
259         /* analize categorys for extended attributes    */
260         if (category)   {
261             int     i, j, k, m, n;
262             int     found;
263             int     dispidx = sys_config->misc.default_displayId;;
264             int     soundidx = sys_config->misc.default_soundId;;
265             int     inputidx = sys_config->misc.default_inputdevId;
266             Ico_Uxf_conf_display    *display;
267             Ico_Uxf_conf_sound      *sound;
268             char    work[64];
269
270             apfw_trace("Ail.%d category=%s", _ico_app_config_update->applicationNum, category);
271
272             j = 0;
273             for (i = 0;; i++)   {
274                 if ((category[i] == 0) || (category[i] == ';')) {
275                     k = i - j;
276                     if (k >= ((int)sizeof(work)-1)) k = sizeof(work)-1;
277                     memcpy(work, &category[j], k);
278                     work[k] = 0;
279                     found = 0;
280
281                     /* find running host        */
282                     if (strncasecmp(work, "run=", 4) == 0)  {
283                         found = 4;
284                     }
285                     for (k = 0; k < sys_config->hostNum; k++)  {
286                         if (strcasecmp(&work[found], sys_config->host[k].name) == 0)   {
287                             apptbl->hostId = sys_config->host[k].id;
288                             found = 1;
289                             break;
290                         }
291                     }
292                     if (found > 1)  {
293                         apfw_error("infoAilpkg: [%s] unknown running host", work);
294                     }
295                     /* find kind                */
296                     if (found == 0) {
297                         if (strncasecmp(work, "kind=", 5) == 0) {
298                             found = 5;
299                         }
300                         for (k = 0; k < sys_config->kindNum; k++)  {
301                             if (strcasecmp(&work[found],
302                                            sys_config->kind[k].name) == 0)   {
303                                 apptbl->kindId = sys_config->kind[k].id;
304                                 found = 1;
305                                 break;
306                             }
307                         }
308                     }
309                     if (found > 1)  {
310                         apfw_error("infoAilpkg: [%s] unknown kind", work);
311                     }
312                     /* find category            */
313                     if (found == 0) {
314                         if (strncasecmp(work, "category=", 9) == 0) {
315                             found = 9;
316                         }
317                         for (k = 0; k < sys_config->categoryNum; k++)  {
318                             if (strcasecmp(&work[found],
319                                            sys_config->category[k].name) == 0)   {
320                                 apptbl->categoryId = sys_config->category[k].id;
321                                 found = 1;
322                                 break;
323                             }
324                         }
325                     }
326                     if (found > 1)  {
327                         apfw_error("infoAilpkg: [%s] unknown category", work);
328                     }
329                     /* find type                */
330                     if (found == 0) {
331                         if (strncasecmp(work, "type=", 5) == 0) {
332                             found = 1;
333                             if (apptbl->type)   {
334                                 free(apptbl->type);
335                             }
336                             apptbl->type = strdup(&work[5]);
337                         }
338                     }
339                     /* find display             */
340                     if ((found == 0) &&
341                         (strncasecmp(work, "display", 7) == 0))   {
342                         if (work[7] == '=') {
343                             dispidx = 0;
344                             found = 8;
345                         }
346                         else if ((work[7] == '.') && (work[9] == '='))  {
347                             dispidx = work[8] - '0';
348                             found = 10;
349                             if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
350                                 apfw_error("infoAilpkg: [%s] unknown display number", work);
351                                 dispidx = 0;
352                                 break;
353                             }
354                         }
355                         else    {
356                             apfw_error("infoAilpkg: [%s] unknown display number", work);
357                             dispidx = 0;
358                             break;
359                         }
360                         if (apptbl->displayzoneNum <= dispidx)  {
361                             apptbl->display[dispidx].displayId
362                                     = sys_config->misc.default_displayId;
363                             apptbl->display[dispidx].layerId
364                                     = sys_config->misc.default_layerId;
365                             apptbl->display[dispidx].zoneId
366                                     = sys_config->misc.default_dispzoneId;
367                         }
368                         for (k = 0; k < sys_config->displayNum; k++)   {
369                             if (strcasecmp(&work[found],
370                                            sys_config->display[k].name) == 0)    {
371                                 apptbl->display[dispidx].displayId
372                                         = sys_config->display[k].id;
373                                 if (apptbl->displayzoneNum <= dispidx)  {
374                                     apptbl->displayzoneNum = dispidx + 1;
375                                 }
376                                 found = 1;
377                                 break;
378                             }
379                         }
380                     }
381                     if (found > 1)  {
382                         apfw_error("infoAilpkg: [%s] unknown display", work);
383                     }
384                     /* find display layer       */
385                     if ((found == 0) &&
386                         (strncasecmp(work, "layer", 5) == 0)) {
387                         if (work[5] == '=') {
388                             dispidx = 0;
389                             found = 6;
390                         }
391                         else if ((work[5] == '.') && (work[7] == '='))  {
392                             dispidx = work[6] - '0';
393                             found = 8;
394                             if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
395                                 apfw_error("infoAilpkg: [%s] unknown display number", work);
396                                 dispidx = 0;
397                                 break;
398                             }
399                         }
400                         else    {
401                             apfw_error("infoAilpkg: [%s] unknown display number", work);
402                             dispidx = 0;
403                             break;
404                         }
405                         if (apptbl->displayzoneNum <= dispidx)  {
406                             apptbl->display[dispidx].displayId
407                                     = sys_config->misc.default_displayId;
408                             apptbl->display[dispidx].layerId
409                                     = sys_config->misc.default_layerId;
410                             apptbl->display[dispidx].zoneId
411                                     = sys_config->misc.default_dispzoneId;
412                         }
413                         display = &sys_config->display[apptbl->display[dispidx].displayId];
414
415                         for (k = 0; k < display->layerNum; k++) {
416                             if (strcasecmp(&work[found], display->layer[k].name) == 0)  {
417                                 apptbl->display[dispidx].layerId = display->layer[k].id;
418                                 if (apptbl->displayzoneNum <= dispidx)  {
419                                     apptbl->displayzoneNum = dispidx + 1;
420                                 }
421                                 found = 1;
422                                 break;
423                             }
424                         }
425                     }
426                     if (found > 1)  {
427                         apfw_error("infoAilpkg: [%s] unknown layer", work);
428                     }
429                     /* find display zone        */
430                     if ((found == 0) &&
431                         (strncasecmp(work, "dispzone", 8) == 0))  {
432                         if (work[8] == '=') {
433                             dispidx = 0;
434                             found = 9;
435                         }
436                         else if ((work[8] == '.') && (work[10] == '=')) {
437                             dispidx = work[9] - '0';
438                             found = 11;
439                             if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
440                                 apfw_error("infoAilpkg: [%s] unknown display number", work);
441                                 dispidx = 0;
442                                 break;
443                             }
444                         }
445                         else    {
446                             apfw_error("infoAilpkg: [%s] unknown display number", work);
447                             dispidx = 0;
448                             break;
449                         }
450                         if (apptbl->displayzoneNum <= dispidx)  {
451                             apptbl->display[dispidx].displayId
452                                     = sys_config->misc.default_displayId;
453                             apptbl->display[dispidx].layerId
454                                     = sys_config->misc.default_layerId;
455                             apptbl->display[dispidx].zoneId
456                                     = sys_config->misc.default_dispzoneId;
457                         }
458                         display = &sys_config->display[apptbl->display[dispidx].displayId];
459
460                         for (k = 0; k < display->zoneNum; k++)  {
461                             if (strcasecmp(&work[found], display->zone[k].name) == 0)   {
462                                 apptbl->display[dispidx].zoneId = display->zone[k].id;
463                                 if (apptbl->displayzoneNum <= dispidx)  {
464                                     apptbl->displayzoneNum = dispidx + 1;
465                                 }
466                                 found = 1;
467                                 break;
468                             }
469                         }
470                     }
471                     if (found > 1)  {
472                         apfw_error("infoAilpkg: [%s] unknown display zone", work);
473                     }
474
475                     /* find sound zone      */
476                     if ((found == 0) &&
477                         (strncasecmp(work, "soundzone", 9) == 0)) {
478                         if (work[9] == '=') {
479                             soundidx = 0;
480                             found = 10;
481                         }
482                         else if ((work[9] == '.') && (work[11] == '=')) {
483                             soundidx = work[10] - '0';
484                             found = 12;
485                             if ((soundidx < 0) || (soundidx >= ICO_UXF_APPSOUND_MAX))   {
486                                 apfw_error("infoAilpkg: [%s] unknown sound number", work);
487                                 soundidx = 0;
488                                 break;
489                             }
490                         }
491                         else    {
492                             apfw_error("infoAilpkg: [%s] unknown sound number", work);
493                             soundidx = 0;
494                             break;
495                         }
496                         if (apptbl->soundzoneNum <= soundidx)   {
497                             apptbl->sound[soundidx].soundId
498                                     = sys_config->misc.default_soundId;
499                             apptbl->sound[soundidx].zoneId
500                                     = sys_config->misc.default_soundzoneId;
501                         }
502                         sound = &sys_config->sound[apptbl->sound[soundidx].soundId];
503
504                         for (k = 0; k < sound->zoneNum; k++)    {
505                             if (strcasecmp(&work[found], sound->zone[k].name) == 0) {
506                                 apptbl->sound[soundidx].zoneId = sound->zone[k].id;
507                                 if (apptbl->soundzoneNum <= soundidx)   {
508                                     apptbl->soundzoneNum = soundidx + 1;
509                                 }
510                                 found = 1;
511                                 break;
512                             }
513                         }
514                     }
515                     if (found > 1)  {
516                         apfw_error("infoAilpkg: [%s] unknown sound zone", work);
517                     }
518
519                     /* find sound           */
520                     if ((found == 0) &&
521                         (strncasecmp(work, "sound", 5) == 0)) {
522                         if (work[5] == '=') {
523                             soundidx = 0;
524                             found = 5;
525                         }
526                         else if ((work[5] == '.') && (work[7] == '='))  {
527                             soundidx = work[6] - '0';
528                             found = 8;
529                             if ((soundidx < 0) || (soundidx >= ICO_UXF_APPSOUND_MAX))   {
530                                 apfw_error("infoAilpkg: [%s] unknown sound number", work);
531                                 soundidx = 0;
532                                 break;
533                             }
534                         }
535                         else    {
536                             apfw_error("infoAilpkg: [%s] unknown sound number", work);
537                             soundidx = 0;
538                             break;
539                         }
540                         if (apptbl->soundzoneNum <= soundidx)   {
541                             apptbl->sound[soundidx].soundId
542                                     = sys_config->misc.default_soundId;
543                             apptbl->sound[soundidx].zoneId
544                                     = sys_config->misc.default_soundzoneId;
545                         }
546                         for (k = 0; k < sys_config->soundNum; k++) {
547                             if (strcasecmp(&work[found], sys_config->sound[k].name) == 0)  {
548                                 apptbl->sound[soundidx].soundId = sys_config->sound[k].id;
549                                 if (apptbl->soundzoneNum <= soundidx)   {
550                                     apptbl->soundzoneNum = soundidx + 1;
551                                 }
552                                 found = 1;
553                                 break;
554                             }
555                         }
556                     }
557                     if (found > 1)  {
558                         apfw_error("infoAilpkg: [%s] unknown sound", work);
559                     }
560
561                     /* find input device    */
562                     if ((found == 0) &&
563                         (strncasecmp(work, "input", 5) == 0)) {
564                         if (work[5] == '=') {
565                             inputidx = 0;
566                             found = 6;
567                         }
568                         else if ((work[5] == '.') && (work[7] == '='))  {
569                             inputidx = work[6] - '0';
570                             if ((inputidx < 0) || (inputidx >= ICO_UXF_APPINPUT_MAX))   {
571                                 apfw_error("infoAilpkg: [%s] unknown input number", work);
572                                 found = 1;
573                                 break;
574                             }
575                             found = 8;
576                         }
577                         else    {
578                             apfw_error("infoAilpkg: [%s] unknown input number", work);
579                             break;
580                         }
581                         if (apptbl->inputdevNum <= inputidx)    {
582                             apptbl->input[inputidx].inputdevId
583                                     = sys_config->misc.default_inputdevId;
584                         }
585                         for (k = 0; k < sys_config->inputdevNum; k++)  {
586                             m = strlen(sys_config->inputdev[k].name);
587                             if (strncasecmp(&work[found],
588                                             sys_config->inputdev[k].name, m) == 0)  {
589                                 if (work[found+m] != '.')   {
590                                     apfw_error("infoAilpkg: [%s] unknown input sw", work);
591                                     break;
592                                 }
593                                 apptbl->input[inputidx].inputdevId
594                                         = sys_config->inputdev[k].id;
595                                 m += (found + 1);
596                                 for (n = 0; n < sys_config->inputdev[k].inputswNum; n++)   {
597                                     if (strcasecmp(&work[m],
598                                                    sys_config->inputdev[k].inputsw[n].name)
599                                             == 9) {
600                                         apptbl->input[inputidx].inputswId = n;
601                                         break;
602                                     }
603                                 }
604                                 if (n < sys_config->inputdev[k].inputswNum)    {
605                                     if (apptbl->inputdevNum <= inputidx)   {
606                                         apptbl->inputdevNum = inputidx + 1;
607                                     }
608                                 }
609                                 else    {
610                                     apfw_error("infoAilpkg: [%s] unknown input sw", work);
611                                 }
612                                 found = 1;
613                                 break;
614                             }
615                         }
616                         if (k >= sys_config->inputdevNum)  {
617                             apfw_error("infoAilpkg: [%s] unknown input device", work);
618                             found = 1;
619                             break;
620                         }
621                     }
622                     if (found > 1)  {
623                         apfw_error("infoAilpkg: [%s] unknown input", work);
624                     }
625
626                     /* NoDisplay                */
627                     if ((found == 0) && (work[0] != 0)) {
628                         if (strncasecmp(work, "NoDisplay", 9) == 0)  {
629                             apptbl->noicon = 1;
630                             if (work[9] == '=') {
631                                 if (strcasecmp(&work[10], "false") == 0)    {
632                                     apptbl->noicon = 0;
633                                 }
634                             }
635                             found = 9;
636                         }
637                     }
638
639                     /* surface animation        */
640                     if ((found == 0) && (work[0] != 0)) {
641                         if (strncasecmp(work, "Animation=", 10) == 0)  {
642                             apptbl->animation = strdup(&work[10]);
643                             found = 9;
644                         }
645                     }
646                     /* surface animation time   */
647                     if ((found == 0) && (work[0] != 0)) {
648                         if (strncasecmp(work, "Animation_time=", 15) == 0)  {
649                             apptbl->animation_time = strtol(&work[15], (char **)0, 0);
650                             found = 9;
651                         }
652                     }
653
654                     /* cpu % at invisible       */
655                     if ((found == 0) && (work[0] != 0)) {
656                         if (strncasecmp(work, "invisiblecpu", 12) == 0)  {
657                             apptbl->invisiblecpu = 0;
658                             if (work[12] == '=')    {
659                                 if (strcasecmp(&work[13], "yes") == 0)  {
660                                     apptbl->invisiblecpu = 100;
661                                 }
662                                 else if (strcasecmp(&work[13], "no") != 0)  {
663                                     apptbl->invisiblecpu = strtol(&work[13], (char **)0, 0);
664                                     if (apptbl->invisiblecpu > 100)
665                                         apptbl->invisiblecpu = 100;
666                                 }
667                             }
668                             found = 9;
669                         }
670                     }
671
672                     /* configure event          */
673                     if ((found == 0) && (work[0] != 0)) {
674                         if (strcasecmp(work, "noconfigure") == 0)  {
675                             apptbl->noconfigure = 1;
676                             found = 9;
677                         }
678                     }
679
680                     /* overlap on HomeScreen menu   */
681                     if ((found == 0) && (work[0] != 0)) {
682                         if (strcasecmp(work, "menuoverlap") == 0)  {
683                             apptbl->menuoverlap = 1;
684                             found = 9;
685                         }
686                     }
687
688                     /* start mode               */
689                     if ((found == 0) && (work[0] != 0)) {
690                         if (strncasecmp(work, "auto", 4) == 0)  {
691                             apptbl->autostart = 1;
692                         }
693                         else if (strncasecmp(work, "noauto", 6) == 0)   {
694                             apptbl->autostart = 0;
695                         }
696                         else    {
697                             apfw_error("infoAilpkg: [%s] unknown key", work);
698                         }
699                     }
700                     if (category[i] == 0)   break;
701                     j = i + 1;
702                 }
703             }
704         }
705         apptbl->exec = strdup(exec);
706         if (apptbl->displayzoneNum == 0)    {
707             apptbl->displayzoneNum = 1;
708             apptbl->display[0].displayId = sys_config->misc.default_displayId;
709             apptbl->display[0].layerId = sys_config->misc.default_layerId;
710             apptbl->display[0].zoneId = sys_config->misc.default_dispzoneId;
711         }
712         if (apptbl->soundzoneNum == 0)  {
713             apptbl->soundzoneNum = 1;
714             apptbl->sound[0].soundId = sys_config->misc.default_soundId;
715             apptbl->sound[0].zoneId = sys_config->misc.default_soundzoneId;
716         }
717         apfw_trace("Ail.%d: appid=%s name=%s exec=%s icon=%s type=%s",
718                    _ico_app_config_update->applicationNum, apptbl->appid, apptbl->name,
719                    apptbl->exec, apptbl->icon_key_name, apptbl->type);
720         apfw_trace("Ail.%d: categ=%d kind=%d disp=%d layer=%d zone=%d "
721                    "sound=%d zone=%d auto=%d noicon=%d anim=%s.%d overlap=%d cpu=%d",
722                    _ico_app_config_update->applicationNum, apptbl->categoryId, apptbl->kindId,
723                    apptbl->display[0].displayId, apptbl->display[0].layerId,
724                    apptbl->display[0].zoneId, apptbl->sound[0].soundId,
725                    apptbl->sound[0].zoneId, apptbl->autostart, apptbl->noicon,
726                    apptbl->animation ? apptbl->animation : "(none)",
727                    apptbl->animation_time, apptbl->menuoverlap, apptbl->invisiblecpu);
728         _ico_app_config_update->applicationNum++;
729     }
730
731     if (_ico_app_config_update->applicationNum > num)
732         return AIL_CB_RET_CANCEL;
733
734     return AIL_CB_RET_CONTINUE;
735 }
736
737 /*--------------------------------------------------------------------------*/
738 /**
739  * @brief   readAilApplist: get all application configuration from AppCore(static function)
740  *
741  * @param       none
742  * @return      application configuration table
743  * @retval      !=NULL          success(application configuration table address)
744  * @retval      ==NULL          error(can not read configuration files)
745  */
746 /*--------------------------------------------------------------------------*/
747 static Ico_Uxf_App_Config *
748 readAilApplist(void)
749 {
750     int     ret, num, wnum;
751     ail_filter_h filter;
752     GError  *error = NULL;
753
754     _ico_app_config_update->applicationNum = 0;
755
756     /* get system configuration */
757     sys_config = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
758     if (! sys_config)   {
759         apfw_error("readAilApplist: can not read system configuration");
760         return NULL;
761     }
762
763     /* read system configuration file for application default category  */
764     sappfile = g_key_file_new();
765
766     GString* filepath = g_string_new("xx");
767     g_string_printf(filepath, "%s/%s", sys_config->misc.confdir, ICO_UXF_CONFIG_APPATTR);
768
769     if (g_key_file_load_from_file(sappfile, filepath->str,
770                                   G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
771                                   &error)) {
772         error = NULL;
773         default_icon = g_key_file_get_string(sappfile, "app-icon", "default-icon", &error);
774         if (error != NULL)  {
775             g_clear_error(&error);
776             default_icon = NULL;
777         }
778     }
779     else    {
780         apfw_error("readAilApplist: %s %s", (char *)filepath->str, error->message);
781         g_key_file_free(sappfile);
782         sappfile = NULL;
783     }
784     g_string_free(filepath, TRUE);
785
786     /* count packages */
787     ret = ail_filter_count_appinfo(NULL, &num);
788     if (ret != AIL_ERROR_OK) {
789         if( sappfile)   {
790             g_key_file_free(sappfile);
791             sappfile = NULL;
792         }
793         apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo) = %d", ret);
794         return NULL;
795     }
796     apfw_trace("readAilApplist: number of off AIL package = %d", num);
797
798     ail_filter_new(&filter);
799     ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "menu");
800     ret = ail_filter_count_appinfo(filter, &num);
801     if (ret != AIL_ERROR_OK) {
802         if( sappfile)   {
803             g_key_file_free(sappfile);
804             sappfile = NULL;
805         }
806         apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo(menu)) = %d", ret);
807         return NULL;
808     }
809     apfw_trace("readAilApplist: number of menu AIL package = %d", num);
810     ail_filter_destroy(filter);
811
812     ail_filter_new(&filter);
813     ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
814     ret = ail_filter_count_appinfo(filter, &wnum);
815     if (ret != AIL_ERROR_OK) {
816         if( sappfile)   {
817             g_key_file_free(sappfile);
818             sappfile = NULL;
819         }
820         apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo(Application)) = %d", ret);
821         return NULL;
822     }
823     apfw_trace("readAilApplist: number of Application AIL package = %d", wnum);
824     ail_filter_destroy(filter);
825     num += wnum;
826
827     _ico_app_config_update->application = g_new0(Ico_Uxf_conf_application, num);
828
829     ail_filter_new(&filter);
830     ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "menu");
831     ret = ail_filter_list_appinfo_foreach(filter, infoAilpkg, (void *)num);
832     if (ret != AIL_ERROR_OK) {
833         if( sappfile)   {
834             g_key_file_free(sappfile);
835             sappfile = NULL;
836         }
837         ail_filter_destroy(filter);
838         apfw_trace("readAilApplist: Leave(Ail:cannot get appinfo(menu)) = %d", ret);
839         return NULL;
840     }
841     ail_filter_destroy(filter);
842
843     ail_filter_new(&filter);
844     ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
845     ret = ail_filter_list_appinfo_foreach(filter, infoAilpkg, (void *)num);
846     if (ret != AIL_ERROR_OK) {
847         if( sappfile)   {
848             g_key_file_free(sappfile);
849             sappfile = NULL;
850         }
851         ail_filter_destroy(filter);
852         apfw_trace("readAilApplist: Leave(Ail:cannot get appinfo(Application)) = %d", ret);
853         return NULL;
854     }
855     ail_filter_destroy(filter);
856
857     if (_ico_app_config_update->ailNum != num) {
858         if( sappfile)   {
859             g_key_file_free(sappfile);
860             sappfile = NULL;
861         }
862         apfw_trace("readAilApplist: Leave(cannot read ail correctly %d =! %d",
863                     _ico_app_config_update->ailNum, num);
864         return NULL;
865     }
866
867     /* create Hash Table                    */
868     ico_uxf_conf_remakeAppHash();
869
870     if( sappfile)   {
871         g_key_file_free(sappfile);
872     }
873
874     apfw_trace("readAilApplist: Leave");
875
876     return _ico_app_config_update;
877 }
878
879 /*--------------------------------------------------------------------------*/
880 /**
881  * @brief   ico_uxf_closeAppConfig: close application configuration table
882  *
883  * @param       none
884  * @return      none
885  */
886 /*--------------------------------------------------------------------------*/
887 ICO_APF_API void
888 ico_uxf_closeAppConfig(void)
889 {
890     if(_ico_app_config != NULL){
891         g_free(_ico_app_config->application);
892         g_free(_ico_app_config);
893         _ico_app_config = NULL;
894     }
895 }
896
897 /*--------------------------------------------------------------------------*/
898 /**
899  * @brief   ico_uxf_conf_remakeAppHash: make application hash table(static function)
900  *
901  * @param       none
902  * @return      none
903  */
904 /*--------------------------------------------------------------------------*/
905 static void
906 ico_uxf_conf_remakeAppHash(void)
907 {
908     int         i;
909     int         hash;
910     Ico_Uxf_conf_application    *app;
911
912     memset(_ico_app_config_update->hashnametable, 0, sizeof(_ico_app_config_update->hashnametable));
913
914     for (i = 0; i < _ico_app_config_update->applicationNum; i++)  {
915
916         _ico_app_config_update->application[i].nextidhash = NULL;
917         hash = ICO_UXF_MISC_HASHBYID(i);
918         app = _ico_app_config_update->hashidtable[hash];
919         if (! app) {
920             _ico_app_config_update->hashidtable[hash] = &_ico_app_config_update->application[i];
921         }
922         else    {
923             while (app->nextidhash)    {
924                 app = app->nextidhash;
925             }
926             app->nextidhash = &_ico_app_config_update->application[i];
927         }
928
929         _ico_app_config_update->application[i].nextnamehash = NULL;
930         hash = ICO_UXF_MISC_HASHBYNAME(_ico_app_config_update->application[i].appid);
931         app = _ico_app_config_update->hashnametable[hash];
932         if (! app) {
933             _ico_app_config_update->hashnametable[hash] = &_ico_app_config_update->application[i];
934         }
935         else    {
936             while (app->nextnamehash)  {
937                 app = app->nextnamehash;
938             }
939             app->nextnamehash = &_ico_app_config_update->application[i];
940         }
941     }
942 }
943
944 /*--------------------------------------------------------------------------*/
945 /**
946  * @brief   ico_uxf_getAppByAppid: get application configuration by application Id
947  *
948  * @param[in]   appid       application Id
949  * @return      application configuration table
950  * @retval      !=NULL          success(application configuration table address)
951  * @retval      ==NULL          error(application dose not exist)
952  */
953 /*--------------------------------------------------------------------------*/
954 ICO_APF_API const Ico_Uxf_conf_application *
955 ico_uxf_getAppByAppid(const char *appid)
956 {
957     Ico_Uxf_conf_application    *app;
958
959     if (!_ico_app_config)  {
960         (void)ico_uxf_getAppConfig();
961     }
962     app = _ico_app_config->hashnametable[ICO_UXF_MISC_HASHBYNAME(appid)];
963
964     while (app)    {
965         if (strcasecmp(app->appid, appid) == 0)   break;
966         app = app->nextnamehash;
967     }
968     if (! app)  {
969         apfw_warn("ico_uxf_getAppByAppid: appid(%s) dose not exist", appid);
970     }
971     return app;
972 }
973
974 /*--------------------------------------------------------------------------*/
975 /**
976  * @brief   ico_uxf_getAppByName: get application configuration by application name
977  *
978  * @param[in]   name            application name
979  * @return      application configuration table
980  * @retval      !=NULL          success(application configuration table address)
981  * @retval      ==NULL          error(application dose not exist)
982  */
983 /*--------------------------------------------------------------------------*/
984 ICO_APF_API const Ico_Uxf_conf_application *
985 ico_uxf_getAppByName(const char *name)
986 {
987     int     i;
988     Ico_Uxf_conf_application    *app = NULL;
989
990     if (!_ico_app_config)  {
991         (void)ico_uxf_getAppConfig();
992     }
993
994     for (i = 0; i < _ico_app_config->applicationNum; i++)   {
995         if (strcasecmp(_ico_app_config->application[i].name, name) == 0)    {
996             app = &_ico_app_config->application[i];
997             break;
998         }
999     }
1000     if (! app)  {
1001         apfw_warn("ico_uxf_getAppByName: name(%s) dose not exist", name);
1002     }
1003     return app;
1004 }
1005
1006 /*--------------------------------------------------------------------------*/
1007 /**
1008  * @brief   ico_uxf_getAppDisplay: get application display
1009  *
1010  * @param[in]   app         application configuration table
1011  * @param[in]   idx         display zone index
1012  * @param[out]  x           zone X coodinate
1013  * @param[out]  y           zone Y coodinate
1014  * @param[out]  width       zone width
1015  * @param[out]  height      zone height
1016  * @return      result
1017  * @retval      ICO_UXF_EOK     succes
1018  * @retval      ICO_UXF_EINVAL  error(illegal idx)
1019  * @retval      ICO_UXF_ENOSYS  error(can not read configuration files)
1020  */
1021 /*--------------------------------------------------------------------------*/
1022 ICO_APF_API int
1023 ico_uxf_getAppDisplay(const Ico_Uxf_conf_application *app, const int idx,
1024                       int *x, int *y, int *width, int *height)
1025 {
1026     Ico_Uxf_conf_display_zone *zone;
1027
1028     if (! sys_config)  {
1029         return ICO_UXF_ENOSYS;
1030     }
1031     if ((! app) || (idx < 0) || (idx >= app->displayzoneNum))  {
1032         return ICO_UXF_EINVAL;
1033     }
1034
1035     zone = &sys_config->display[app->display[idx].displayId].zone[app->display[idx].zoneId];
1036
1037     if (x)      *x = zone->x;
1038     if (y)      *y = zone->y;
1039     if (width)  *width = zone->width;
1040     if (height) *height = zone->height;
1041
1042     return 0;
1043 }
1044
1045 /*--------------------------------------------------------------------------*/
1046 /**
1047  * @brief   ico_uxf_conf_addPkgmgrEventListener:
1048  *          request to listen the pkgmgr's broadcasting.
1049  *
1050  * @param       none
1051  * @return      result
1052  * @retval      ICO_UXF_EOK     success
1053  * @retval      ICO_UXF_ENOSYS  cannot regist listener
1054  */
1055 /*--------------------------------------------------------------------------*/
1056 static int
1057 ico_uxf_conf_addPkgmgrEventListener(void)
1058 {
1059     int     ret;
1060
1061     if (conf_pc) {
1062         /* already registied listener */
1063         return ICO_UXF_EOK;
1064     }
1065
1066     conf_pc = pkgmgr_client_new(PC_LISTENING);
1067     if (conf_pc == NULL) {
1068         apfw_trace("ico_uxf_conf_addPkgmgrEventListener: cannot create pkgmgr client");
1069         return ICO_UXF_ENOSYS;
1070     }
1071
1072     ret = pkgmgr_client_listen_status(conf_pc, ico_uxf_conf_pkgmgrEvent, NULL);
1073     if (ret < 0) {
1074         apfw_trace("ico_uxf_conf_addPkgmgrEventListener: "
1075                    "cannot register listener of pkgmgr(%d)", ret);
1076         pkgmgr_client_free(conf_pc);
1077         conf_pc = NULL;
1078         return ICO_UXF_ENOSYS;
1079     }
1080
1081     return ICO_UXF_EOK;
1082 }
1083
1084 /*--------------------------------------------------------------------------*/
1085 /**
1086  * @brief   ico_uxf_conf_pkgmgrEvent:
1087  *          This is callback function from pkgmgr.
1088  *
1089  * @param[in]   req_id          request id
1090  * @param[in]   pkg_type        package type
1091  * @param[in]   pkg_name        package name
1092  * @param[in]   key             broadcast key(=start/end/...)
1093  * @param[in]   val             broadcast value(=install/uninstall/ok/fail)
1094  * @param[in]   pmsg            broadcast comment
1095  * @param[in]   data            user data
1096  * @return      always 0
1097  */
1098 /*--------------------------------------------------------------------------*/
1099 static int
1100 ico_uxf_conf_pkgmgrEvent(int req_id, const char *pkg_type, const char *pkg_name,
1101                     const char *key, const char *val, const void *pmsg, void *data)
1102 {
1103     apfw_trace("ico_uxf_conf_PkgmgrEvent: "
1104                "Enter(pkg_type=%s, pkg_name=%s, key=%s, val=%s, pmsg=%s)",
1105                pkg_type, pkg_name, key, val, pmsg);
1106
1107     if (strcasecmp(key, "start") == 0) {
1108         if (strcasecmp(val, "install") == 0) {
1109             ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_INSTALL);
1110         }
1111         else if (strcasecmp(val, "uninstall") == 0) {
1112             ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_UNINSTALL);
1113         }
1114     }
1115     else if (strcasecmp(key, "install_percent") == 0) {
1116         ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_INSTALL);
1117     }
1118     else if (strcasecmp(key, "progress_percent") == 0) {
1119
1120     }
1121     else if (strcasecmp(key, "error") == 0) {
1122     }
1123     else if (strcasecmp(key, "end") == 0) {
1124         if (strcasecmp(val, "ok") == 0) {
1125             ico_uxf_conf_endEvent(pkg_name, APP_CONF_EVENT_OK);
1126         }
1127         else if (strcasecmp(val, "fail") == 0) {
1128             ico_uxf_conf_endEvent(pkg_name, APP_CONF_EVENT_FAIL);
1129         }
1130     }
1131
1132     return 0;
1133 }
1134
1135 /*--------------------------------------------------------------------------*/
1136 /**
1137  * @brief   ico_uxf_conf_startEvent: mark event is start
1138  *
1139  * @param[in]   pkg_name        package name
1140  * @param[in]   type            event type
1141  * @return      result
1142  * @retval      ICO_UXF_EOK     success
1143  * @retval      ICO_UXF_ENOMEM  cannot allocate memory
1144  */
1145 /*--------------------------------------------------------------------------*/
1146 static int
1147 ico_uxf_conf_startEvent(const char *pkg_name, int type)
1148 {
1149     conf_pkgmgr_event_t *new = NULL;
1150     conf_pkgmgr_event_t *event = NULL;
1151
1152     /* check the queue whether the package' event is exist */
1153     event = conf_prog_event;
1154     while (event) {
1155         if (strncmp(event->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME) == 0) {
1156             new = event;
1157             break;
1158         }
1159         event = event->next;
1160     }
1161
1162     if (!new) {
1163         new = malloc(sizeof(conf_pkgmgr_event_t));
1164         if (!new) {
1165             apfw_warn("ico_uxf_conf_startEvent: cannot allocate memory");
1166             return ICO_UXF_ENOMEM;
1167         }
1168         memset(new, 0, sizeof(new));
1169         /* insert queue */
1170         event = conf_prog_event;
1171         while (event) {
1172             if (!event->next) {
1173                 break;
1174             }
1175             event = event->next;
1176         }
1177         if (!event) {
1178             conf_prog_event = new;
1179         }
1180         else {
1181             event->next = new;
1182         }
1183         strncpy(new->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME);
1184         new->type = type;
1185     }
1186
1187
1188
1189     return ICO_UXF_EOK;
1190 }
1191
1192 /*--------------------------------------------------------------------------*/
1193 /**
1194  * @brief   ico_uxf_conf_endEvent: mark event is end
1195  *
1196  * @param[in]   pkg_name        package name
1197  * @param[in]   status          end status
1198  * @return      result
1199  * @retval      ICO_UXF_EOK     success
1200  */
1201 /*--------------------------------------------------------------------------*/
1202 static int
1203 ico_uxf_conf_endEvent(const char *pkg_name, int status)
1204 {
1205     int     type;
1206     int     cnt;
1207     int     ii, jj;
1208     int     exist = 0;
1209     conf_pkgmgr_event_t *current = NULL;
1210     conf_pkgmgr_event_t *event;
1211     conf_pkgmgr_event_t *bevent;
1212     static Ico_Uxf_App_Config *config = NULL;
1213     static Ico_Uxf_App_Config *tmp = NULL;
1214
1215     apfw_trace("ico_uxf_conf_endEvent: Enter(pkg=%s, stat=%d)", pkg_name, status);
1216     /* get start event from queue */
1217     event = conf_prog_event;
1218     bevent = NULL;
1219     while (event) {
1220         if (strncmp(event->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME) == 0) {
1221             current = event;
1222             break;
1223         }
1224         bevent = event;
1225         event = event->next;
1226     }
1227     if (current) {
1228         if (!bevent) {
1229             /* top */
1230             conf_prog_event = current->next;
1231             current->next = NULL;
1232         }
1233         else {
1234             bevent->next = current->next;
1235             current->next = NULL;
1236         }
1237     }
1238     else {
1239         return ICO_UXF_ENOSYS;
1240     }
1241
1242     type = current->type;
1243     free(current);
1244
1245     if (status == APP_CONF_EVENT_OK) {
1246         config = g_new0(Ico_Uxf_App_Config, 1);
1247         _ico_app_config_update = config;
1248         config = readAilApplist();
1249         cnt = 0;
1250         while (! config) {
1251             usleep(10000);
1252             apfw_trace("ico_uxf_conf_endEvent: Retry %d", cnt);
1253             config = readAilApplist();
1254             if (cnt > 500) {
1255                 break;
1256             }
1257             else {
1258                 cnt++;
1259             }
1260         }
1261         if (! config) {
1262             apfw_warn("ico_uxf_getAppByAppid: cannot access ail normally");
1263             return ICO_UXF_EBUSY;
1264         }
1265         tmp = config;
1266         /* old list */
1267         config = _ico_app_config;
1268         /* new list */
1269         _ico_app_config = tmp;
1270
1271         if (type == ICO_UXF_CONF_EVENT_INSTALL) {
1272             for (ii = 0; ii < _ico_app_config->applicationNum; ii++) {
1273                 exist = 0;
1274                 for (jj = 0; jj < config->applicationNum; jj++) {
1275                     if (strcmp(_ico_app_config->application[ii].appid,
1276                                config->application[jj].appid) == 0) {
1277                         exist = 1;
1278                         break;
1279                     }
1280                 }
1281                 if ((exist == 0) && conf_cb_func) {
1282                     conf_cb_func(_ico_app_config->application[ii].appid,
1283                                  ICO_UXF_CONF_EVENT_INSTALL);
1284                 }
1285             }
1286         }
1287         else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
1288             for (jj = 0; jj < config->applicationNum; jj++) {
1289                 exist = 0;
1290                 for (ii = 0; ii < _ico_app_config->applicationNum; ii++) {
1291                     if (strcmp(config->application[jj].appid,
1292                                _ico_app_config->application[ii].appid) == 0) {
1293                         exist = 1;
1294                         break;
1295                     }
1296                 }
1297                 if ((exist == 0) && conf_cb_func) {
1298                     conf_cb_func(config->application[jj].appid,
1299                                  ICO_UXF_CONF_EVENT_UNINSTALL);
1300                 }
1301             }
1302         }
1303         /* free old list */
1304         if (config != NULL) {
1305             g_free(config->application);
1306             g_free(config);
1307         }
1308     }
1309
1310     apfw_trace("ico_uxf_conf_endEvent: Leave");
1311
1312     return ICO_UXF_EOK;
1313 }
1314
1315 /*--------------------------------------------------------------------------*/
1316 /**
1317  * @brief   ico_uxf_setAppUpdateCb:
1318  *
1319  * @param       none
1320  * @return      result
1321  * @retval      ICO_UXF_EOK     success
1322  * @retval      ICO_UXF_ENOSYS  cannot regist callback
1323  */
1324 /*--------------------------------------------------------------------------*/
1325 ICO_APF_API int
1326 ico_uxf_conf_setAppUpdateCb(Ico_Uxf_AppUpdata_Cb func)
1327 {
1328     int     ret;
1329
1330     ret = ico_uxf_conf_addPkgmgrEventListener();
1331
1332     if (ret != ICO_UXF_EOK) {
1333         apfw_trace("ico_uxf_conf_setAppUpdateCb: cannot add listener");
1334         return ICO_UXF_ENOSYS;
1335     }
1336     conf_cb_func = func;
1337
1338     return ICO_UXF_EOK;
1339 }
1340