static DBusMessage *battery_low_actnoti_on(E_DBus_Object *obj, DBusMessage *msg)
{
set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_LOW_ACT);
+ return activate_notification_single_param(obj, msg, BATTERY_LOW_ACT);
}
static DBusMessage *battery_critical_actnoti_on(E_DBus_Object *obj, DBusMessage *msg)
{
set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_CRITICAL_ACT);
+ return activate_notification_single_param(obj, msg, BATTERY_CRITICAL_ACT);
}
static DBusMessage *battery_low_actnoti_usb_on(E_DBus_Object *obj, DBusMessage *msg)
{ "UsbDeviceNotiUpdate" , "isss" , "i" , usb_device_noti_update },
{ "UsbDeviceNotiOff" , "i" , "i" , noti_off },
/* usb connection */
- { "MediaDeviceNotiOn" , NULL , "i" , media_device_noti_on },
- { "MediaDeviceNotiOff" , "i" , "i" , noti_off },
+ { "MediaDeviceNotiOn" , NULL , "i" , media_device_noti_on },
+ { "MediaDeviceNotiOff" , "i" , "i" , noti_off },
/* Battery Event noti*/
{ "BatteryFullNotiOn" , NULL , "i" , battery_full_noti_on },
{ "BatteryFullNotiOff" , "i" , "i" , noti_off },
{ "BatteryCriticalNotiOn" , NULL , "i" , battery_critical_noti_on },
{ "BatteryLowCriticalNotiOff" , "i" , "i" , noti_off },
/* Battery Active noti*/
- { "BatteryLowActNotiOn" , NULL , "i" , battery_low_actnoti_on },
- { "BatteryCriticalActNotiOn" , NULL , "i" , battery_critical_actnoti_on },
- { "BatteryLowActNotiUsbOn" , NULL , "i" , battery_low_actnoti_usb_on },
- { "BatteryCriticalActNotiUsbOn" , NULL , "i" , battery_critical_actnoti_usb_on },
- { "BatteryLowActNotiChgOn" , NULL , "i" , battery_low_actnoti_chg_on },
- { "BatteryCriticalActNotiChgOn" , NULL , "i" , battery_critical_actnoti_chg_on },
+ { "BatteryLowActNotiOn" , "s" , "i" , battery_low_actnoti_on },
+ { "BatteryCriticalActNotiOn", "s" , "i" , battery_critical_actnoti_on },
+ { "BatteryLowActNotiUsbOn" , NULL , "i" , battery_low_actnoti_usb_on },
+ { "BatteryCriticalActNotiUsbOn" , NULL , "i" , battery_critical_actnoti_usb_on },
+ { "BatteryLowActNotiChgOn" , NULL , "i" , battery_low_actnoti_chg_on },
+ { "BatteryCriticalActNotiChgOn" , NULL , "i" , battery_critical_actnoti_chg_on },
/* Temperature */
{ "TempCooldownNotiOn" , NULL , "i" , cooldown_noti_on },
{ "TempCooldownNotiOff" , "i" , "i" , noti_off },
free(lang);
}
+notification_error_e set_contents_for_lowbat_noti(char *title, notification_h noti, char *content, char *sig, va_list args)
+{
+ int var = 0;
+ notification_error_e noti_err = NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (strncmp(sig, "i", 1))
+ return noti_err;
+
+ var = va_arg(args, int);
+ noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ _(content),
+ content,
+ NOTIFICATION_VARIABLE_TYPE_INT,
+ var,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ return noti_err;
+}
+
static int add_notification(
int type, int layout,
char *title, char *content,
char *icon, char *icon_indi,
bundle *b, int prop,
- int applist)
+ int applist,
+ notification_error_e (func)(char *, notification_h, char *, char *, va_list),
+ char *sig, ...)
{
int priv_id;
+ va_list args;
notification_h noti = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
}
if (content) {
+ if (!func) {
noti_err = notification_set_text(noti,
NOTIFICATION_TEXT_TYPE_CONTENT,
_(content),
content,
NOTIFICATION_VARIABLE_TYPE_NONE);
+ } else {
+ va_start(args, sig);
+ noti_err = func(title, noti, content, sig, args);
+ va_end(args);
+ }
+
if (noti_err != NOTIFICATION_ERROR_NONE) {
_E("FAIL: notification_set_text()");
priv_id = -ENOMEM;
NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY
| NOTIFICATION_DISPLAY_APP_TICKER
| NOTIFICATION_DISPLAY_APP_LOCK
- | NOTIFICATION_DISPLAY_APP_INDICATOR);
+ | NOTIFICATION_DISPLAY_APP_INDICATOR,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY
| NOTIFICATION_DISPLAY_APP_TICKER
| NOTIFICATION_DISPLAY_APP_LOCK
- | NOTIFICATION_DISPLAY_APP_INDICATOR);
+ | NOTIFICATION_DISPLAY_APP_INDICATOR,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY
- | NOTIFICATION_DISPLAY_APP_INDICATOR);
+ | NOTIFICATION_DISPLAY_APP_INDICATOR,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY
- | NOTIFICATION_DISPLAY_APP_INDICATOR);
+ | NOTIFICATION_DISPLAY_APP_INDICATOR,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
NULL,
b,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
if (b)
bundle_free(b);
return ret;
}
+static int launch_battery_discharge_active_notification(void *data, int type)
+{
+ int ret;
+ bundle *b;
+ char *title = NULL;
+ int capacity = atoi(data);
+
+ b = bundle_create();
+ if (b)
+ appsvc_set_pkgname(b, SYSTEM_SIGNAL_SENDER);
+
+ if (type == BATTERY_LOW_ACT)
+ title = "IDS_QP_HEADER_BATTERY_LOW_ABB";
+ else if (type == BATTERY_CRITICAL_ACT)
+ title = "IDS_QP_HEADER_BATTERY_CRITICALLY_LOW_ABB";
+
+ ret = add_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_LY_ONGOING_EVENT,
+ title,
+ "IDS_QP_POP_YOUR_DEVICE_HAS_PDP_BATTERY_POWER_REMAINING_CONNECT_A_CHARGER_ABB",
+ BATT_LOW_INDI_ICON,
+ NULL,
+ b,
+ NOTIFICATION_PROP_VOLATILE_DISPLAY,
+ NOTIFICATION_DISPLAY_APP_ACTIVE,
+ set_contents_for_lowbat_noti,
+ "i",
+ capacity);
+
+ if (b)
+ bundle_free(b);
+
+ return ret;
+}
+
static int launch_ticker_notification(void *data)
{
char *content, *input;
NULL,
NULL,
NOTIFICATION_PROP_DISABLE_APP_LAUNCH,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
- } else if (type == BATTERY_LOW) {
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
+ } else if (type == BATTERY_LOW) {
ret = add_notification(NOTIFICATION_TYPE_ONGOING,
NOTIFICATION_LY_ONGOING_EVENT,
"IDS_QP_HEADER_BATTERY_LOW_ABB",
NULL,
NULL,
NOTIFICATION_PROP_DISABLE_APP_LAUNCH,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
} else if (type == BATTERY_CRITICAL) {
ret = add_notification(NOTIFICATION_TYPE_ONGOING,
NOTIFICATION_LY_ONGOING_EVENT,
NULL,
NULL,
NOTIFICATION_PROP_DISABLE_APP_LAUNCH,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
} else
_E("Unknown type(%d)", type);
{
int ret = -EINVAL;
- if (type == BATTERY_LOW_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_LOW_ABB",
- "IDS_QP_SBODY_CONNECT_A_CHARGER_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
- } else if (type == BATTERY_CRITICAL_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_CRITICALLY_LOW_ABB",
- "IDS_QP_SBODY_CONNECT_A_CHARGER_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
- }
- else if (type == BATTERY_LOW_USB_ACT) {
+ if (type == BATTERY_LOW_USB_ACT) {
ret = add_notification(NOTIFICATION_TYPE_NOTI,
NOTIFICATION_LY_ONGOING_EVENT,
"IDS_QP_HEADER_BATTERY_LOW_ABB",
NULL,
NULL,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
+ NOTIFICATION_DISPLAY_APP_ACTIVE,
+ NULL,
+ NULL);
} else if (type == BATTERY_CRITICAL_USB_ACT) {
ret = add_notification(NOTIFICATION_TYPE_NOTI,
NOTIFICATION_LY_ONGOING_EVENT,
NULL,
NULL,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
+ NOTIFICATION_DISPLAY_APP_ACTIVE,
+ NULL,
+ NULL);
} else if (type == BATTERY_LOW_CHG_ACT) {
ret = add_notification(NOTIFICATION_TYPE_NOTI,
NOTIFICATION_LY_ONGOING_EVENT,
NULL,
NULL,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
+ NOTIFICATION_DISPLAY_APP_ACTIVE,
+ NULL,
+ NULL);
} else if (type == BATTERY_CRITICAL_CHG_ACT) {
ret = add_notification(NOTIFICATION_TYPE_NOTI,
NOTIFICATION_LY_ONGOING_EVENT,
NULL,
NULL,
NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE);
+ NOTIFICATION_DISPLAY_APP_ACTIVE,
+ NULL,
+ NULL);
} else
_E("Unknown type(%d)", type);
NULL,
NOTIFICATION_PROP_DISABLE_APP_LAUNCH |
NOTIFICATION_PROP_DISABLE_AUTO_DELETE,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
+ NULL,
+ NULL);
return ret;
}
case BATTERY_LOW:
case BATTERY_CRITICAL:
return launch_battery_notification(type);
- case BATTERY_LOW_ACT:
- case BATTERY_CRITICAL_ACT:
case BATTERY_LOW_USB_ACT:
case BATTERY_CRITICAL_USB_ACT:
case BATTERY_LOW_CHG_ACT:
case USB_STORAGE:
case USB_STORAGE_RO:
return launch_usb_storage_notification(data, type);
+ case BATTERY_LOW_ACT:
+ case BATTERY_CRITICAL_ACT:
+ return launch_battery_discharge_active_notification(data, type);
default:
_E("Noti type is unknown");
return -EINVAL;
priv_id = launch_notification_double_param_by_type(type, str1, str2);
if (priv_id < 0)
- _E("FAIL: launch_noti_single_param_by_type()");
+ _E("FAIL: launch_notification_double_param_by_type()");
out:
reply = dbus_message_new_method_return(msg);