return launch_system_servant_app(obj, msg, args);
}
-static DBusMessage *battery_low_noti_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_LOW);
-}
-
-static DBusMessage *battery_critical_noti_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_CRITICAL);
-}
-
-static DBusMessage *battery_low_actnoti_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- 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_single_param(obj, msg, BATTERY_CRITICAL_ACT);
-}
-
-static DBusMessage *battery_low_actnoti_usb_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_LOW_USB_ACT);
-}
-
-static DBusMessage *battery_critical_actnoti_usb_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_CRITICAL_USB_ACT);
-}
-
-static DBusMessage *battery_low_actnoti_chg_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_LOW_CHG_ACT);
-}
-
-static DBusMessage *battery_critical_actnoti_chg_on(E_DBus_Object *obj, DBusMessage *msg)
-{
- set_timer_to_terminate();
- return activate_notification_no_param(obj, msg, BATTERY_CRITICAL_CHG_ACT);
-}
-
/* Datausage */
static DBusMessage *data_warning_noti_on(E_DBus_Object *obj, DBusMessage *msg)
{
{ "BatteryFullNotiOn" , NULL , "i" , battery_full_noti_on },
{ "BatteryFullNotiOff" , "i" , "i" , noti_off },
{ "BatteryChargeNotiOn" , NULL , "i" , battery_charge_noti_on },
- { "BatteryLowNotiOn" , NULL , "i" , battery_low_noti_on },
- { "BatteryCriticalNotiOn" , NULL , "i" , battery_critical_noti_on },
- { "BatteryLowCriticalNotiOff" , "i" , "i" , noti_off },
- /* Battery Active noti*/
- { "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,
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;
{
int ret = -EINVAL;
-#ifndef PROFILE_MOBILE // event noti should be supported in mobile profile only
- return ret;
-#endif
-
if (type == BATTERY_FULL) {
ret = add_notification(NOTIFICATION_TYPE_ONGOING,
NOTIFICATION_LY_ONGOING_EVENT,
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",
- "IDS_QP_SBODY_CONNECT_A_CHARGER_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_DISABLE_APP_LAUNCH,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
- NULL,
- NULL);
- } else if (type == BATTERY_CRITICAL) {
- ret = add_notification(NOTIFICATION_TYPE_ONGOING,
- 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_DISABLE_APP_LAUNCH,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY,
- NULL,
- NULL);
- } else
- _E("Unknown type(%d).", type);
-
- return ret;
-}
-
-static int launch_battery_active_notification(int type)
-{
- int ret = -EINVAL;
-
- if (type == BATTERY_LOW_USB_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_LOW_ABB",
- "IDS_QP_POP_USE_A_PLUG_SOCKET_AND_CLOSE_UNUSED_APPS_FOR_QUICKER_CHARGING_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE,
- NULL,
- NULL);
- } else if (type == BATTERY_CRITICAL_USB_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_CRITICALLY_LOW_ABB",
- "IDS_QP_POP_USE_A_PLUG_SOCKET_AND_CLOSE_UNUSED_APPS_FOR_QUICKER_CHARGING_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE,
- NULL,
- NULL);
- } else if (type == BATTERY_LOW_CHG_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_LOW_ABB",
- "IDS_QP_POP_CONTINUED_USAGE_WHILE_CHARGING_MAY_PREVENT_EFFICIENT_CHARGING_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE,
- NULL,
- NULL);
- } else if (type == BATTERY_CRITICAL_CHG_ACT) {
- ret = add_notification(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_LY_ONGOING_EVENT,
- "IDS_QP_HEADER_BATTERY_CRITICALLY_LOW_ABB",
- "IDS_QP_POP_CONTINUED_USAGE_WHILE_CHARGING_MAY_PREVENT_EFFICIENT_CHARGING_ABB",
- BATT_LOW_INDI_ICON,
- NULL,
- NULL,
- NOTIFICATION_PROP_VOLATILE_DISPLAY,
- NOTIFICATION_DISPLAY_APP_ACTIVE,
- NULL,
- NULL);
} else
_E("Unknown type(%d).", type);
case TIMA_PKM_DETECTION:
return launch_tima_pkm_detection_notification();
case BATTERY_FULL:
- case BATTERY_LOW:
- case BATTERY_CRITICAL:
return launch_battery_notification(type);
- case BATTERY_LOW_USB_ACT:
- case BATTERY_CRITICAL_USB_ACT:
- case BATTERY_LOW_CHG_ACT:
- case BATTERY_CRITICAL_CHG_ACT:
- return launch_battery_active_notification(type);
case MEDIA_DEVICE:
return launch_media_device_notification();
case TEMP_COOLDOWN:
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;