#define GRANULARITY 10
#define MAX_INT_LENGTH 128
+
+#ifndef VCONFKEY_STC_BACKGROUND_STATE
#define VCONFKEY_STC_BACKGROUND_STATE "db/stc/background_state"
+#endif
+
+#ifndef VCONFKEY_SETAPPL_DATA_RESTRICTION_INT
+#define VCONFKEY_SETAPPL_DATA_RESTRICTION_INT "db/setting/data_restriction"
+#endif
typedef struct {
time_t now;
static stc_system_s *g_system = NULL;
+//LCOV_EXCL_START
+static int __vconf_get_int(const char *key, int *value)
+{
+ int ret = 0;
+
+ ret = vconf_get_int(key, value);
+ if (ret != VCONF_OK) {
+ STC_LOGE("Failed to get vconfkey [%s] value", key); //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
+ }
+
+ return 0;
+}
+
+static int __vconf_set_int(const char *key, int value)
+{
+ int ret = 0;
+
+ ret = vconf_set_int(key, value);
+ if (ret != VCONF_OK) {
+ STC_LOGE("Failed to set vconfkey [%s] value", key); //LCOV_EXCL_LINE
+ return -1; //LCOV_EXCL_LINE
+ }
+
+ return 0;
+}
+//LCOV_EXCL_STOP
+
static nfacct_rule_jump __get_jump_by_intend(struct nfacct_rule *counter)
{
if (counter->intend == NFACCT_WARN)
rstn_key->roaming, rstn_key->subscriber_id);
}
+static void __set_rstn_noti_state(int value)
+{
+ int state = STC_RSTN_STATE_INIT;
+
+ if (__vconf_get_int(VCONFKEY_SETAPPL_DATA_RESTRICTION_INT, &state))
+ return;
+
+ if (state == value) {
+ STC_LOGI("No need to change a restriction status: %d", state);
+ return;
+ }
+
+ vconf_set_int(VCONFKEY_SETAPPL_DATA_RESTRICTION_INT, value);
+ return;
+}
+
typedef struct {
time_t month_start_ts;
time_t week_start_ts;
for (i = 0; i < STC_RSTN_LIMIT_TYPE_MAX; i++)
if (rstn_value->limit[i] >= 0)
rstn_value->counter[i] = 0;
+
+ __set_rstn_noti_state(STC_RSTN_STATE_UNSET);
}
break;
default:
context->counter->intend = NFACCT_COUNTER;
rstn_value->limit_exceeded |= (1 << limit_type);
+
+ __set_rstn_noti_state(STC_RSTN_STATE_SET);
}
break;
default:
FREE(app_key.app_id);
}
-static int __vconf_get_int(const char *key, int *value)
-{
- int ret = 0;
-
- ret = vconf_get_int(key, value);
- if (ret != VCONF_OK) {
- STC_LOGE("Failed to get vconfkey [%s] value", key);
- return -1;
- }
-
- return 0;
-}
-
-static int __vconf_set_int(const char *key, int value)
-{
- int ret = 0;
-
- ret = vconf_set_int(key, value);
- if (ret != VCONF_OK) {
- STC_LOGE("Failed to set vconfkey [%s] value", key);
- return -1;
- }
-
- return 0;
-}
-
static guint __get_background_state(void)
{
return g_system->background_state;;