Clean up codes for suspend/resume test accepted/tizen/unified/20191017.035459 submit/tizen/20191017.002636
authorsaerome.kim <saerome.kim@samsung.com>
Tue, 15 Oct 2019 11:02:12 +0000 (20:02 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 15 Oct 2019 12:26:21 +0000 (21:26 +0900)
- Problem: suspend/resume seem not to work correctly.
- Cause: sequence for calling power API is not working.
- Solution: fix the sequence for callign power API and test scenario.

Change-Id: I80977b9d51137cfe29684a514bbfbe3b37de21fd
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
CMakeLists.txt
packaging/capi-network-ua.spec
test/uat-detections.c

index 2786a9bb2f17d19b7cb9d900c5ac9d330f509436..7fbb441d784b9b8eea526a8ecd558bcb4647d024 100644 (file)
@@ -13,14 +13,18 @@ SET(PKG_MODULES
        gio-2.0
        ua-api
 )
-IF (SUSPEND_RESUME_TEST)
+IF (${SUSPEND_RESUME_TEST})
     pkg_check_modules (PKGS REQUIRED ${PKG_MODULES}
            deviced
            power-defs
     )
-ELSE (SUSPEND_RESUME_TEST)
+ELSE (${SUSPEND_RESUME_TEST})
     pkg_check_modules (PKGS REQUIRED ${PKG_MODULES})
-ENDIF (SUSPEND_RESUME_TEST)
+ENDIF (${SUSPEND_RESUME_TEST})
+
+IF(${SUSPEND_RESUME_TEST})
+    ADD_DEFINITIONS(-DSUSPEND_RESUME_TEST)
+ENDIF(${SUPPORT_BLE_ADV})
 
 INCLUDE_DIRECTORIES(${PKGS_INCLUDE_DIRS})
 LINK_DIRECTORIES(${PKGS_LIBRARY_DIRS})
index 15b45fddf49dd4fe162e0aa3b608c4f61c22c8d8..03aaf538a164d39b36761d58a4da274a89662cf8 100644 (file)
@@ -1,6 +1,6 @@
 Name: capi-network-ua
 Summary: User Awareness Framework CAPI
-Version: 0.11.9
+Version: 0.11.10
 Release: 1
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
@@ -10,7 +10,7 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(ua-api)
 
-%if 0%{?suspend_resume_test:1}
+%if 0%{?ptest:1}
 BuildRequires:  pkgconfig(deviced)
 BuildRequires:  pkgconfig(power-defs)
 %endif
@@ -59,7 +59,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DBIN_INSTALL_DIR=%{_bindir} \
        -DINCLUDE_INSTALL_DIR=%{_includedir} \
        -DLIB_PATH=%{_lib} \
-       -DSUSPEND_RESUME_TEST=%{?suspend_resume_test:1}%{!?suspend_resume_test:0} \
+       -DSUSPEND_RESUME_TEST=%{?ptest:1}%{!?ptest:0} \
        -DFULLVER=%{version} \
        -DMAJORVER=${MAJORVER} \
        -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
index 95cc1fa6b5741fa017a2b4cccc375bfb8174691d..203ba2a04317790aea74cc7387d9aec0ed42bf2b 100644 (file)
@@ -579,12 +579,6 @@ static int run_ua_enable_low_power_mode(
        msg("ua_enable_low_power_mode");
 
        ret = ua_enable_low_power_mode();
-#ifdef SUSPEND_RESUME_TEST
-       if (POWER_ERROR_NONE != device_power_set_state(POWER_STATE_STANDBY, 1)) {
-        msgr("Fail to request power off");
-        return RET_SUCCESS;
-    }
-#endif
 
        msg(" - ua_enable_low_power_mode() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
@@ -611,7 +605,7 @@ static int run_device_power_request_poweroff(
                MManager *mm, struct menu_data *menu)
 {
        int ret = UA_ERROR_NONE;
-       int off_reason = POWER_OFF_REASON_POWER_KEY | POWER_OFF_TO_SUSPEND;
+       int off_reason = POWER_OFF_REASON_ART_APP_TO_SUSPEND | POWER_OFF_TO_SUSPEND;
 
        msg("run_device_power_request_poweroff");
 
@@ -620,14 +614,15 @@ static int run_device_power_request_poweroff(
         return false;
     }
 
-       ret = device_power_set_wakeup_reason(POWER_WAKEUP_REASON_REMOTE_CONTROLLER);
+       ret = device_power_set_wakeup_reason(POWER_WAKEUP_REASON_AMBIENT_READY);
        if(POWER_ERROR_NONE != ret)
        {
                msgr("Fail to set wakeup reason");
                return RET_SUCCESS;
        }
 
-       if(POWER_ERROR_NONE != device_power_set_state(POWER_STATE_STANDBY, 1)) {
+       ret = device_power_set_state(POWER_STATE_STANDBY, 1);
+       if(POWER_ERROR_NONE != ret) {
                msgr("Failed to request TV to STANDBY!");
                return RET_SUCCESS;
        }
@@ -774,5 +769,9 @@ struct menu_data menu_ua_detections[] = {
                NULL, run_ua_enable_low_power_mode, NULL },
        { "13", "ua_disable_low_power_mode",
                NULL, run_ua_disable_low_power_mode, NULL },
+#ifdef SUSPEND_RESUME_TEST
+       { "14", "request_power_off",
+               NULL, run_device_power_request_poweroff, NULL },
+#endif
        { NULL, NULL, },
 };