Reduce system info db access 89/141089/2 accepted/tizen/3.0/common/20170801.162933 accepted/tizen/3.0/ivi/20170801.061921 accepted/tizen/3.0/mobile/20170801.061829 accepted/tizen/3.0/tv/20170801.061846 accepted/tizen/3.0/wearable/20170801.061906 submit/tizen_3.0/20170731.092605
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 28 Jul 2017 06:24:30 +0000 (15:24 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 31 Jul 2017 01:58:58 +0000 (10:58 +0900)
Change-Id: I5a3f889cca98c47abca16b720070216ad79679f5
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
watch-control/src/control.c

index b7da2c5..0746e3b 100644 (file)
@@ -375,6 +375,26 @@ API int watch_policy_set_size_hint(watch_policy_size_hint hint)
        return 0;
 }
 
+static bool __is_circle(void)
+{
+       static bool initialized = false;
+       static bool shape_circle = false;
+       int r;
+
+       if (initialized)
+               return shape_circle;
+
+       r = system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE,
+                       &shape_circle);
+       if (r != SYSTEM_INFO_ERROR_NONE) {
+               _E("Failed to get system info");
+               return false;
+       }
+
+       initialized = true;
+       return shape_circle;
+}
+
 static float __get_opr(void *source_data, int width, int height)
 {
        int *source;
@@ -390,9 +410,7 @@ static float __get_opr(void *source_data, int width, int height)
        unsigned int pixel_sum;
        float opr;
        float max_opr;
-       bool shape_circle = false;
-
-       system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE, &shape_circle);
+       bool shape_circle = __is_circle();
 
        source = source_data;
        pos = width / 2;