Fix METADATA_TICK_PER_SECOND logic
authorHyunho Kang <hhstark.kang@samsung.com>
Fri, 30 Jun 2017 02:33:04 +0000 (11:33 +0900)
committerhyunho <hhstark.kang@samsung.com>
Wed, 13 Dec 2017 07:58:59 +0000 (16:58 +0900)
METADATA_TICK_PER_SECOND's value is int type

Change-Id: Iefac963b3dfed20ebb93c705b8a9b31c76146336
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
Signed-off-by: hyunho <hhstark.kang@samsung.com>
src/watch_app_main.c

index 9040d25..86f6adb 100755 (executable)
@@ -456,6 +456,7 @@ static void __set_default_tick_by_metadata()
        char *second_tick = NULL;
        char *minute_tick = NULL;
        int ret;
+       int tick;
 
        ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
        if (ret < 0) {
@@ -477,13 +478,16 @@ static void __set_default_tick_by_metadata()
                return;
        }
 
-       ret = pkgmgrinfo_appinfo_get_metadata_value(handle, METADATA_TICK_PER_SECOND, &second_tick);
-       if (ret == PMINFO_R_OK) {
-               _D("set default tick 1, type %d", WATCH_APP_TIME_TICKS_PER_SECOND);
-               app_tick_type = WATCH_APP_TIME_TICKS_PER_SECOND;
-               app_tick_resolution = 1;
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return;
+       pkgmgrinfo_appinfo_get_metadata_value(handle, METADATA_TICK_PER_SECOND, &second_tick);
+       if (second_tick) {
+               sscanf(second_tick, "%d", &tick);
+               if (tick > 0) {
+                       _D("set default tick %d, type %d", tick, WATCH_APP_TIME_TICKS_PER_SECOND);
+                       app_tick_type = WATCH_APP_TIME_TICKS_PER_SECOND;
+                       app_tick_resolution = tick;
+                       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+                       return;
+               }
        }
 
        pkgmgrinfo_appinfo_destroy_appinfo(handle);