From: dyamy-lee Date: Fri, 6 Nov 2020 02:36:05 +0000 (+0900) Subject: fota_gui - common, wearable : terminate binary, when progress is -1. X-Git-Tag: submit/tizen/20201106.052508~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F247009%2F1;p=profile%2Fcommon%2Fapps%2Fnative%2Ffirmware-update-system-ui.git fota_gui - common, wearable : terminate binary, when progress is -1. Even if it doesn't reach 100 percent, if progress is -1, it terminate. But, when it is just stared with progress -1 (remain previous update content), do not terminate. Change-Id: I836f9d0d0fcd0eb7b7a6641e8cb657690d721b77 --- diff --git a/fota_gui_common/fota_gr_direct_ro_common.c b/fota_gui_common/fota_gr_direct_ro_common.c index 38f209e..a685fa4 100644 --- a/fota_gui_common/fota_gr_direct_ro_common.c +++ b/fota_gui_common/fota_gr_direct_ro_common.c @@ -385,7 +385,6 @@ static void _gr_direct_progress_bar(FbInfo *fbi, int progress) s_saved_percent = prog_pre; count++; - if (count > 3) break; } @@ -431,6 +430,10 @@ int fota_gr_direct_ro_update_progress(void) if (fp) { if (fscanf(fp, "%d", &percent) == EOF) LOG("Error occurs at reading ro_progress"); + if (percent == -1 && s_saved_percent > 0) { + LOG("END ro update\n"); + return -1; + } if (percent < 0) percent = 0; if (percent > 0xffffff) @@ -440,7 +443,8 @@ int fota_gr_direct_ro_update_progress(void) percent = s_percent_to_draw; } - s_percent_to_draw = percent; + if (s_percent_to_draw < percent) + s_percent_to_draw = percent; if (s_saved_percent < s_percent_to_draw) { LOG("s_saved_percent %d , s_percent_to_draw %d \n", s_saved_percent, s_percent_to_draw); fota_gr_direct_progress(); diff --git a/fota_gui_common/fota_gui_ro_common_main.c b/fota_gui_common/fota_gui_ro_common_main.c index 2f8331d..f36c03d 100644 --- a/fota_gui_common/fota_gui_ro_common_main.c +++ b/fota_gui_common/fota_gui_ro_common_main.c @@ -57,12 +57,12 @@ static int wait_main_fota_ro(void) return -1; } - while (s_prog_percent < 100) { + while (1) { usleep(delay); s_prog_percent = fota_gr_update_progress(); + if (s_prog_percent == -1) break; sleep(1); } - LOG("MAIN :: 100 percent out = %d\n", s_prog_percent); fota_gr_deinit(); diff --git a/fota_gui_wearable/fota_gr_direct_ro_wearable.c b/fota_gui_wearable/fota_gr_direct_ro_wearable.c index 6faab3b..3f79bc7 100644 --- a/fota_gui_wearable/fota_gr_direct_ro_wearable.c +++ b/fota_gui_wearable/fota_gr_direct_ro_wearable.c @@ -437,6 +437,10 @@ int fota_gr_direct_ro_update_progress(void) if (fp) { if (fscanf(fp, "%d", &percent) == EOF) LOG("Error occurs at reading ro_progress"); + if (percent == -1 && s_saved_percent > 0) { + LOG("END ro update\n"); + return -1; + } if (percent < 0) percent = 0; if (percent > 0xffffff) @@ -446,7 +450,8 @@ int fota_gr_direct_ro_update_progress(void) percent = s_percent_to_draw; } - s_percent_to_draw = percent; + if (s_percent_to_draw < percent) + s_percent_to_draw = percent; if (s_saved_percent < s_percent_to_draw) { LOG("s_saved_percent %d , s_percent_to_draw %d \n", s_saved_percent, s_percent_to_draw); fota_gr_direct_circular_progress(); diff --git a/fota_gui_wearable/fota_gui_ro_wearable_main.c b/fota_gui_wearable/fota_gui_ro_wearable_main.c index fe7f793..a563379 100644 --- a/fota_gui_wearable/fota_gui_ro_wearable_main.c +++ b/fota_gui_wearable/fota_gui_ro_wearable_main.c @@ -57,12 +57,12 @@ static int wait_main_fota_ro(void) return -1; } - while (s_prog_percent < 100) { + while (1) { usleep(delay); s_prog_percent = fota_gr_update_progress(); + if (s_prog_percent == -1) break; sleep(1); } - LOG("MAIN :: 100 percent out = %d\n", s_prog_percent); fota_gr_deinit();