Disable RTC feature in tv profile 80/89080/3
authorJiwoong Im <jiwoong.im@samsung.com>
Thu, 22 Sep 2016 04:24:18 +0000 (13:24 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Thu, 22 Sep 2016 08:39:24 +0000 (17:39 +0900)
Change-Id: I86faaa880dc19a82410140040103027f6263cdbb
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
CMakeLists.txt
alarm-manager.c
packaging/alarm-manager.spec

index e1c4786..905c6d1 100644 (file)
@@ -12,6 +12,10 @@ IF(_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG)
 ADD_DEFINITIONS("-D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG")
 ENDIF(_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG)
 
+IF(_APPFW_FEATURE_WAKEUP_USING_RTC)
+       ADD_DEFINITIONS("-D_APPFW_FEATURE_WAKEUP_USING_RTC")
+ENDIF(_APPFW_FEATURE_WAKEUP_USING_RTC)
+
 message("${DEPS_PKGS}")
 
 INCLUDE(FindPkgConfig)
index f96205c..4f282b2 100644 (file)
@@ -73,14 +73,15 @@ GSList *g_expired_alarm_list = NULL;
  * When the alarm becoms sleeping mode, alarm timer is not expired.
  * So using RTC, phone is awaken before alarm rings.
  */
-#define __WAKEUP_USING_RTC__
-#ifdef __WAKEUP_USING_RTC__
 #include <errno.h>
 #include <linux/rtc.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 
-#define ALARM_RTC_WAKEUP       0
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
+static const char default_rtc[] = "/dev/rtc";
+static int gfd = -1;
+#endif /*__APPFW_FEATURE_WAKEUP_USING_RTC*/
 
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
 #define ALARMMGR_LOG_BUFFER_SIZE       10000
@@ -106,12 +107,6 @@ static int log_fd = 0;
 /* link path for timezone info */
 #define TIMEZONE_INFO_LINK_PATH        tzplatform_mkpath(TZ_SYS_ETC, "localtime")
 
-static const char default_rtc[] = "/dev/rtc";
-
-static int gfd = -1;
-
-#endif /*__WAKEUP_USING_RTC__*/
-
 /*  GDBus Declaration */
 #define ALARM_MGR_DBUS_PATH    "/org/tizen/alarm/manager"
 #define ALARM_MGR_DBUS_NAME    "org.tizen.alarm.manager"
@@ -177,7 +172,7 @@ struct filtered_alarm_app_s {
 
 static void __rtc_set()
 {
-#ifdef __WAKEUP_USING_RTC__
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
        const char *rtc = default_rtc;
        struct tm due_tm;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
@@ -262,12 +257,15 @@ static void __rtc_set()
                ALARM_MGR_EXCEPTION_PRINT("[alarm-server]alarm_context.c_due_time is"
                        "less than 10 sec. RTC alarm does not need to be set");
        }
-#endif /* __WAKEUP_USING_RTC__ */
+#else
+       ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
        return;
 }
 
 int __set_time(time_t _time)
 {
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
        /* Using /dev/alarm, this function changes both OS time and RTC. */
        int ret = 0;
        const char *rtc0 = default_rtc;
@@ -332,7 +330,9 @@ int __set_time(time_t _time)
 
        __save_module_log(log_tag, log_message);
 #endif
-
+#else
+       ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
        return 1;
 }
 
@@ -2022,10 +2022,11 @@ gboolean alarm_manager_alarm_set_rtc_time(AlarmManager *pObj, GDBusMethodInvocat
                                int year, int mon, int day,
                                int hour, int min, int sec,
                                gpointer user_data) {
+       int return_code = ALARMMGR_RESULT_SUCCESS;
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
        const char *rtc = default_rtc;
        struct rtc_wkalrm rtc_wkalarm;
        int retval = 0;
-       int return_code = ALARMMGR_RESULT_SUCCESS;
        struct tm tm, *alarm_tm = NULL;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
@@ -2092,6 +2093,10 @@ gboolean alarm_manager_alarm_set_rtc_time(AlarmManager *pObj, GDBusMethodInvocat
        snprintf(log_message, sizeof(log_message), "wakeup rtc time: %d, %s", (int)rtc_time, ctime(&rtc_time));
        __save_module_log(log_tag, log_message);
 #endif
+#else
+       ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+       return_code = ERR_ALARM_SYSTEM_FAIL;
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
 
        g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", return_code));
        return true;
index d6426cc..c3eddd5 100644 (file)
@@ -65,6 +65,11 @@ Requires:   libalarm = %{version}-%{release}
 %description -n libalarm-devel
 Alarm server libraries development package (devel)
 
+%define appfw_feature_wakeup_using_rtc 1
+
+%if "%{?profile}" == "tv"
+%define appfw_feature_wakeup_using_rtc 0
+%endif
 
 %prep
 %setup -q
@@ -72,6 +77,9 @@ Alarm server libraries development package (devel)
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%if 0%{?appfw_feature_wakeup_using_rtc}
+_APPFW_FEATURE_WAKEUP_USING_RTC=ON
+%endif
 
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
@@ -81,7 +89,11 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
        _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG=ON
 %endif
 
-%cmake . -DOBS=1 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG:BOOL=${_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG}
+%cmake . -DOBS=1 \
+       -DFULLVER=%{version} \
+       -DMAJORVER=${MAJORVER} \
+       -D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG:BOOL=${_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG} \
+       -D_APPFW_FEATURE_WAKEUP_USING_RTC:BOOL=${_APPFW_FEATURE_WAKEUP_USING_RTC}
 
 make %{?jobs:-j%jobs}
 
@@ -99,8 +111,10 @@ ln -s ../alarm-server.service %{buildroot}%{_unitdir}/multi-user.target.wants/al
 ln -sf ../alarm_session_agent.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/alarm-session-agent.socket
 mkdir -p %{buildroot}%{_tmpfilesdir}
 install -m 0644 %SOURCE4 %{buildroot}%{_tmpfilesdir}/alarm-agent.conf
+%if 0%{?appfw_feature_wakeup_using_rtc}
 mkdir -p %{buildroot}%{_libdir}/udev/rules.d
 install -m 0644 %SOURCE5 %{buildroot}%{_libdir}/udev/rules.d
+%endif
 
 mkdir -p %{buildroot}%{upgrade_script_path}
 cp -f scripts/108.alarmmgr_upgrade.sh %{buildroot}%{upgrade_script_path}
@@ -131,7 +145,9 @@ cp -f scripts/108.alarmmgr_upgrade.sh %{buildroot}%{upgrade_script_path}
 %license LICENSE
 %config %{_sysconfdir}/dbus-1/system.d/alarm-service.conf
 %{_tmpfilesdir}/alarm-agent.conf
+%if 0%{?appfw_feature_wakeup_using_rtc}
 %{_libdir}/udev/rules.d/99-rtc.rules
+%endif
 %if 0%{?appfw_feature_alarm_manager_module_log}
 %attr(0755,root,root) %{_sysconfdir}/dump.d/module.d/alarmmgr_log_dump.sh
 %endif