Wait mountpoints before calling create callback 28/164128/2
authorSemun Lee <semun.lee@samsung.com>
Fri, 15 Dec 2017 10:37:29 +0000 (19:37 +0900)
committerSemun Lee <semun.lee@samsung.com>
Fri, 15 Dec 2017 10:45:56 +0000 (19:45 +0900)
resources are usually needed in app's create callback.

Change-Id: I3646f35ea4fd50ffc430c6ffed9d5963fa9144fd
Signed-off-by: Semun Lee <semun.lee@samsung.com>
src/base/appcore_base.c

index c8617d5..da4d63a 100644 (file)
@@ -1048,27 +1048,12 @@ EXPORT_API int appcore_base_flush_memory(void)
 
 EXPORT_API int appcore_base_on_receive(aul_type type, bundle *b)
 {
-       int ret;
-       const char **tep_path;
-       int len = 0;
-       int i;
        const char *bg;
        int dummy = 0;
 
        switch (type) {
        case AUL_START:
                _DBG("[APP %d]     AUL event: AUL_START", getpid());
-               tep_path = bundle_get_str_array(b, AUL_TEP_PATH, &len);
-               if (tep_path) {
-                       for (i = 0; i < len; i++) {
-                               ret = aul_check_tep_mount(tep_path[i]);
-                               if (ret == -1) {
-                                       _ERR("mount request not completed within 1 sec");
-                                       exit(-1);
-                               }
-                       }
-               }
-
                if (TIZEN_FEATURE_BACKGROUND_MANAGEMENT) {
                        bg = bundle_get_val(b, AUL_K_ALLOWED_BG);
                        if (bg && !strcmp(bg, "ALLOWED_BG")) {
@@ -1147,6 +1132,12 @@ EXPORT_API int appcore_base_on_receive(aul_type type, bundle *b)
 EXPORT_API int appcore_base_on_create(void)
 {
        int r;
+       bundle *b;
+       int ret;
+       int i;
+       int len = 0;
+       const char **tep_path;
+
        r = aul_launch_init(__context.ops.receive, NULL);
        if (r < 0) {
                _ERR("Aul init failed: %d", r);
@@ -1159,6 +1150,25 @@ EXPORT_API int appcore_base_on_create(void)
                return -1;
        }
 
+       b = bundle_import_from_argv(__context.argc, __context.argv);
+       if (b == NULL) {
+               _ERR("Failed to import bundle");
+               return 0;
+       }
+
+       tep_path = bundle_get_str_array(b, AUL_TEP_PATH, &len);
+       if (tep_path) {
+               for (i = 0; i < len; i++) {
+                       ret = aul_check_tep_mount(tep_path[i]);
+                       if (ret == -1) {
+                               _ERR("mount request not completed within 1 sec");
+                               exit(-1);
+                       }
+               }
+       }
+
+       bundle_free(b);
+
        return 0;
 }