Fix default tick logic 63/150563/3
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 20 Jun 2017 02:19:40 +0000 (11:19 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2017 04:54:32 +0000 (13:54 +0900)
Ignore metadata value, only consider metadata key is declared or not

Change-Id: I8d4d0cfcfb5067bf806ffec92809180d75902c7d
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/watch_app_main.c

index 5a7c991..079c173 100755 (executable)
@@ -411,7 +411,6 @@ 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) {
@@ -424,28 +423,22 @@ static void __set_default_tick_by_metadata()
                return;
 
        /* If both minute tick & second tick are declared, only minute tick has to be applied */
-       pkgmgrinfo_appinfo_get_metadata_value(handle, METADATA_MINUTE_TICK, &minute_tick);
-       if (minute_tick) {
-               sscanf(minute_tick, "%d", &tick);
-               if (tick > 0) {
-                       _D("set default tick %d, type %d", tick, WATCH_APP_TIME_TICKS_PER_MINUTE);
-                       app_tick_type = WATCH_APP_TIME_TICKS_PER_MINUTE;
-                       app_tick_resolution = tick;
-                       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-                       return;
-               }
+       ret = pkgmgrinfo_appinfo_get_metadata_value(handle, METADATA_MINUTE_TICK, &minute_tick);
+       if (ret == PMINFO_R_OK) {
+               _D("set default tick 1, type %d", WATCH_APP_TIME_TICKS_PER_MINUTE);
+               app_tick_type = WATCH_APP_TIME_TICKS_PER_MINUTE;
+               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;
-               }
+       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_destroy_appinfo(handle);