#include <notification.h>
#include <notification_ipc.h>
#include <notification_internal.h>
+#include <system_info.h>
#include <glib.h>
#if !GLIB_CHECK_VERSION(2, 31, 0)
#include <sys/ioctl.h>
#include <fcntl.h>
-#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
static const char default_rtc[] = "/dev/rtc";
static int gfd = -1;
-#endif /*__APPFW_FEATURE_WAKEUP_USING_RTC*/
+#define _APPFW_FEATURE_WAKEUP_USING_RTC (_get_profile() != PROFILE_TV)
#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
#define ALARMMGR_LOG_BUFFER_SIZE 10000
char *unique_name;
} appid_cache_t;
+typedef enum {
+ PROFILE_UNKNOWN = 0,
+ PROFILE_MOBILE,
+ PROFILE_WEARABLE,
+ PROFILE_TV,
+ PROFILE_IVI,
+ PROFILE_COMMON,
+} profile_t;
+
+static profile_t _get_profile()
+{
+ static profile_t saved = PROFILE_UNKNOWN;
+ char *profileName;
+
+ if (__builtin_expect(saved != PROFILE_UNKNOWN, 1))
+ return saved;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ saved = PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ saved = PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ saved = PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ saved = PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ saved = PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return saved;
+}
+
static bool __get_cached_unique_name(int pid, char *unique_name, bool *is_app, uid_t uid)
{
appid_cache_t *data = NULL;
static void __rtc_set()
{
-#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
+/* Indentation ingored to help understand the patch. */
+if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
const char *rtc = default_rtc;
struct tm due_tm;
#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
ALARM_MGR_EXCEPTION_PRINT("[alarm-server]alarm_context.c_due_time is"
"less than 10 sec. RTC alarm does not need to be set");
}
-#else
+} else {
ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
-#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
+}
return;
}
if (ret < 0)
ALARM_MGR_EXCEPTION_PRINT("settimeofday is failed.[%d]", errno);
-#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
+/* Indentation ingored to help understand the patch. */
+if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
/* Using /dev/alarm, this function changes both OS time and RTC. */
const char *rtc0 = default_rtc;
struct rtc_time _rtc_time;
__save_module_log(log_tag, log_message);
#endif
-#else
+} else {
ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
-#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
+}
return 1;
}
int hour, int min, int sec,
gpointer user_data) {
int return_code = ALARMMGR_RESULT_SUCCESS;
-#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
+/* Indentation ingored to help understand the patch. */
+if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
const char *rtc = default_rtc;
struct rtc_wkalrm rtc_wkalarm;
int retval = 0;
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
+} 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;
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(notification)
BuildRequires: python-xml
+BuildRequires: pkgconfig(capi-system-info)
%define upgrade_script_path /usr/share/upgrade/scripts
%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
%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"
-DFULLVER=%{version} \
-DMAJORVER=${MAJORVER} \
-DTZ_SYS_ETC=%{TZ_SYS_ETC} \
- -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}
+ -D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG:BOOL=${_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG}
make %{?jobs:-j%jobs}
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-manager.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/508.alarmmgr_upgrade.sh %{buildroot}%{upgrade_script_path}
%postun -n libalarm
/sbin/ldconfig
+%posttrans -n alarm-server
+if [ -e /etc/config/model-config.xml ]; then
+ grep "feature\/profile.*tv" /etc/config/model-config.xml > /dev/null
+ if [ $? -eq 0 ]; then
+ rm %{_libdir}/udev/rules.d/99-rtc.rules
+ fi
+fi
+
%files -n alarm-server
%manifest alarm-server.manifest
%{_bindir}/*
%license LICENSE
%config %{_sysconfdir}/dbus-1/system.d/alarm-service.conf
%{_tmpfilesdir}/alarm-manager.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) %{TZ_SYS_ETC}/dump.d/module.d/alarmmgr_log_dump.sh
%endif