summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInkyun Kil <inkyun.kil@samsung.com>2020-01-22 05:40:08 (GMT)
committerInkyun Kil <inkyun.kil@samsung.com>2020-01-29 09:36:54 (GMT)
commit9173096e9f0c91ad4a775525518fbbd899dfa240 (patch)
tree57243723914372e0130f9b68f3220a81dee2fbad
parent52304ec96c091163346f32d4f49e15cee2109d95 (diff)
downloadalarm-manager-tizen.zip
alarm-manager-tizen.tar.gz
alarm-manager-tizen.tar.bz2
Change-Id: I8a5ac3adeaf2fcbd39fda776642f35af4e1150ef Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
-rw-r--r--include/alarm-internal.h9
-rw-r--r--packaging/alarm-manager.spec1
-rwxr-xr-xserver/CMakeLists.txt2
-rw-r--r--server/alarm-manager-util.c42
-rw-r--r--server/alarm-manager-util.h1
-rw-r--r--server/alarm-manager.c95
6 files changed, 51 insertions, 99 deletions
diff --git a/include/alarm-internal.h b/include/alarm-internal.h
index b64299d..b479faf 100644
--- a/include/alarm-internal.h
+++ b/include/alarm-internal.h
@@ -61,15 +61,6 @@ enum async_param_type {
SET_SYSTIME_WITH_PROPAGATION_DELAY,
};
-typedef enum {
- PROFILE_UNKNOWN = 0,
- PROFILE_MOBILE,
- PROFILE_WEARABLE,
- PROFILE_TV,
- PROFILE_IVI,
- PROFILE_COMMON,
-} profile_t;
-
#define ALARM_TYPE_RELATIVE 0x80000000 /**< relative */
#define ALARM_TYPE_WITHCB 0x40000000 /**< withcb */
#define ALARM_TYPE_PERIOD 0x10000000 /**< periodic */
diff --git a/packaging/alarm-manager.spec b/packaging/alarm-manager.spec
index 8ebb196..611b862 100644
--- a/packaging/alarm-manager.spec
+++ b/packaging/alarm-manager.spec
@@ -34,7 +34,6 @@ BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(notification)
BuildRequires: python-xml
-BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(cert-svc-vcore)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 2dc595d..67c87c9 100755
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -6,7 +6,7 @@ AUX_SOURCE_DIRECTORY(./ SRCS)
PKG_CHECK_MODULES(svr_pkgs REQUIRED glib-2.0 dlog aul bundle appsvc pkgmgr-info pkgmgr vconf
gio-2.0 gio-unix-2.0 capi-system-device libtzplatform-config libsystemd-login
- eventsystem notification capi-system-info sqlite3 cert-svc-vcore
+ eventsystem notification sqlite3 cert-svc-vcore
cynara-session cynara-client cynara-creds-gdbus)
FOREACH(flag ${svr_pkgs_CFLAGS_OTHER})
diff --git a/server/alarm-manager-util.c b/server/alarm-manager-util.c
index 1486adb..9515a52 100644
--- a/server/alarm-manager-util.c
+++ b/server/alarm-manager-util.c
@@ -16,7 +16,6 @@
#define _GNU_SOURCE
#include <fcntl.h>
-#include <system_info.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -52,47 +51,6 @@ static int __bg_category_func(const char *name, void *user_data)
return 0;
}
-profile_t _get_profile()
-{
- static profile_t saved = PROFILE_UNKNOWN;
- char *profileName;
- int r;
-
- if (__builtin_expect(saved != PROFILE_UNKNOWN, 1))
- return saved;
-
- r = system_info_get_platform_string("http://tizen.org/feature/profile",
- &profileName);
- if (r != SYSTEM_INFO_ERROR_NONE) {
- LOGD("Failed to get profile info. error(%d)", r);
- return saved;
- }
-
- 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;
-}
-
int _pkg_is_global(const char *callee_pkgid, uid_t uid)
{
int retval;
diff --git a/server/alarm-manager-util.h b/server/alarm-manager-util.h
index b37019d..0e010ed 100644
--- a/server/alarm-manager-util.h
+++ b/server/alarm-manager-util.h
@@ -30,7 +30,6 @@ extern "C" {
#define ALARMMGR_LOG_TAG_SIZE 20
#define ALARMMGR_LOG_MESSAGE_SIZE 330
-profile_t _get_profile();
int _cynara_check(GDBusMethodInvocation *invocation, const char* privilege,
pid_t pid);
char* _get_pkgid_by_appid(const char* app_id, uid_t uid);
diff --git a/server/alarm-manager.c b/server/alarm-manager.c
index ddc5db3..e0434ef 100644
--- a/server/alarm-manager.c
+++ b/server/alarm-manager.c
@@ -59,8 +59,6 @@
#define RTC_WKALM_BOOT_SET _IOW('p', 0x80, struct rtc_wkalrm)
#endif
-#define _APPFW_FEATURE_WAKEUP_USING_RTC (_get_profile() != PROFILE_TV)
-
#define PATH_LIB_ALARMMGR_PLUGIN "/usr/lib/libalarm-server-plugin.so"
static void *plugin_handle;
@@ -86,6 +84,7 @@ GHashTable *caller_appid_cache_table;
bool is_time_changed = false; /* for calculating next duetime */
static time_t periodic_alarm_standard_time = 0;
+static bool using_rtc = false;
struct running_info_t {
pid_t pid;
@@ -232,7 +231,7 @@ void __free_cached_value(gpointer data)
void _rtc_set()
{
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+ if (using_rtc) {
char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
#ifdef _SIMUL /* RTC does not work in simulator. */
LOGE("because it is simulator's mode, we don't set RTC.");
@@ -296,7 +295,7 @@ static bool __set_time(time_t _time)
return false;
}
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+ if (using_rtc) {
char buf[1024];
char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
@@ -392,7 +391,8 @@ static void __alarm_add_to_list(__alarm_info_t *__alarm_info)
LOGE("Saving alarm_id(%d) in DB is failed.", __alarm_info->alarm_id);
}
- DO_AFTER_ALARM_CREATE(__alarm_info->pid, __alarm_info->app_unique_name);
+ if (using_rtc)
+ DO_AFTER_ALARM_CREATE(__alarm_info->pid, __alarm_info->app_unique_name);
}
static bool __check_bundle_for_update(const gchar *b_data, uid_t uid)
@@ -1599,7 +1599,8 @@ void _alarm_expired()
_save_alarm_info_log("EXPIRED", __alarm_info);
- DO_AFTER_ALARM_EXPIRE(__alarm_info->pid, __alarm_info->app_unique_name);
+ if (using_rtc)
+ DO_AFTER_ALARM_EXPIRE(__alarm_info->pid, __alarm_info->app_unique_name);
if (__alarm_info->alarm_info.mode.repeat == ALARM_REPEAT_MODE_ONCE) {
__alarm_remove_from_list(__alarm_info->uid, __alarm_info->alarm_id, NULL);
@@ -1754,7 +1755,7 @@ static int __on_app_installed(uid_t target_uid, int req_id, const char *pkg_type
__alarm_info_t *entry = NULL;
bool is_restored = false;
- if (GET_POWER_SAVING_MODE() == -1)
+ if (using_rtc && GET_POWER_SAVING_MODE() == -1)
return ALARMMGR_RESULT_SUCCESS;
if ((key && strncmp(key, "end", 3) != 0) || (val && strncmp(val, "ok", 2) != 0))
@@ -1800,14 +1801,15 @@ static int __on_app_uninstalled(uid_t target_uid, int req_id, const char *pkg_ty
__alarm_info_t *entry = NULL;
alarm_info_t *alarm_info = NULL;
bool is_deleted = false;
- int is_power_saving_mode;
+ int is_power_saving_mode = 0;
SECURE_LOGD("pkg_type(%s), pkgid(%s), key(%s), value(%s)", pkg_type, pkgid, key, val);
if ((key && strncmp(key, "end", 3) != 0) || (val && strncmp(val, "ok", 2) != 0))
return ALARMMGR_RESULT_SUCCESS;
- is_power_saving_mode = GET_POWER_SAVING_MODE();
+ if (using_rtc)
+ is_power_saving_mode = GET_POWER_SAVING_MODE();
for (gs_iter = alarm_context.alarms; gs_iter != NULL;) {
entry = (__alarm_info_t *)gs_iter->data;
@@ -1993,7 +1995,7 @@ static int __check_modifiable(uid_t uid, pid_t pid, int alarm_id)
int alarm_manager_alarm_set_rtc_time(GVariant *parameters)
{
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+ if (using_rtc) {
int retval = 0;
struct tm tm, *alarm_tm = NULL;
char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
@@ -2204,7 +2206,9 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters)
}
tzset();
- DO_AFTER_TIMEZONE_SET();
+
+ if (using_rtc)
+ DO_AFTER_TIMEZONE_SET();
/* Rescheduling alarms */
_alarm_disable_timer();
@@ -3033,40 +3037,41 @@ static int __load_module(const char *path)
plugin_handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
if (!plugin_handle) {
LOGE("Failed to load - %s", dlerror());
- return -1;
+ using_rtc = false;
+ return 0;
+ } else {
+ using_rtc = true;
}
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
- RTC_INIT = dlsym(plugin_handle, "RTC_INIT");
- if (!RTC_INIT) {
- LOGE("Failed to find PLUGIN_INIT");
- goto out;
- }
+ RTC_INIT = dlsym(plugin_handle, "RTC_INIT");
+ if (!RTC_INIT) {
+ LOGE("Failed to find PLUGIN_INIT");
+ goto out;
+ }
- CLEAR_WAKEUP_RTC = dlsym(plugin_handle, "CLEAR_WAKEUP_RTC");
- if (!CLEAR_WAKEUP_RTC) {
- LOGE("Failed to find CLEAR_WAKEUP_RTC");
- goto out;
- }
+ CLEAR_WAKEUP_RTC = dlsym(plugin_handle, "CLEAR_WAKEUP_RTC");
+ if (!CLEAR_WAKEUP_RTC) {
+ LOGE("Failed to find CLEAR_WAKEUP_RTC");
+ goto out;
+ }
- SET_WAKEUP_RTC = dlsym(plugin_handle, "SET_WAKEUP_RTC");
- if (!SET_WAKEUP_RTC) {
- LOGE("Failed to find SET_WAKEUP_RTC");
- goto out;
- }
+ SET_WAKEUP_RTC = dlsym(plugin_handle, "SET_WAKEUP_RTC");
+ if (!SET_WAKEUP_RTC) {
+ LOGE("Failed to find SET_WAKEUP_RTC");
+ goto out;
+ }
- SET_WAKEUP_RTC_WITH_DATETIME = dlsym(plugin_handle,
- "SET_WAKEUP_RTC_WITH_DATETIME");
- if (!SET_WAKEUP_RTC_WITH_DATETIME) {
- LOGE("Failed to find SET_WAKEUP_RTC_WITH_DATETIME");
- goto out;
- }
+ SET_WAKEUP_RTC_WITH_DATETIME = dlsym(plugin_handle,
+ "SET_WAKEUP_RTC_WITH_DATETIME");
+ if (!SET_WAKEUP_RTC_WITH_DATETIME) {
+ LOGE("Failed to find SET_WAKEUP_RTC_WITH_DATETIME");
+ goto out;
+ }
- SET_SYSTIME_RTC = dlsym(plugin_handle, "SET_SYSTIME_RTC");
- if (!SET_SYSTIME_RTC) {
- LOGE("Failed to find SET_SYSTIME_RTC");
- goto out;
- }
+ SET_SYSTIME_RTC = dlsym(plugin_handle, "SET_SYSTIME_RTC");
+ if (!SET_SYSTIME_RTC) {
+ LOGE("Failed to find SET_SYSTIME_RTC");
+ goto out;
}
DO_AFTER_TIMEZONE_SET = dlsym(plugin_handle, "DO_AFTER_TIMEZONE_SET");
@@ -3147,16 +3152,16 @@ void _alarm_initialize()
exit(1);
}
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+ if (using_rtc) {
if (RTC_INIT() != 0) {
LOGE("rtc init failed");
exit(1);
}
- }
- if (PS_MODE_INIT() != 0) {
- LOGE("power saving mode init failed");
- exit(1);
+ if (PS_MODE_INIT() != 0) {
+ LOGE("power saving mode init failed");
+ exit(1);
+ }
}
__initialize_alarm_list();
@@ -3167,7 +3172,7 @@ void _alarm_initialize()
g_direct_equal, NULL, __free_cached_value);
}
- if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+ if (using_rtc) {
tzset();
DO_AFTER_TIMEZONE_SET();
}