From: lokilee73 Date: Thu, 1 Dec 2016 07:26:56 +0000 (+0900) Subject: active noti : add active noti for low battery X-Git-Tag: accepted/tizen/3.0/common/20161203.012434^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a999f98d15bb00908c146d24b11262f288a87ab;p=platform%2Fcore%2Fsystem%2Fsystem-popup.git active noti : add active noti for low battery Change-Id: I3deb2be229f0b38221c2d13e2f2b932cd8a02e4a Signed-off-by: lokilee73 --- diff --git a/data/noti_charging_battery_low.png b/data/noti_charging_battery_low.png new file mode 100755 index 0000000..954d929 Binary files /dev/null and b/data/noti_charging_battery_low.png differ diff --git a/packaging/system-servant.spec b/packaging/system-servant.spec index cfc18b0..1cc5cb9 100755 --- a/packaging/system-servant.spec +++ b/packaging/system-servant.spec @@ -314,6 +314,7 @@ rm -rf %{buildroot} %if %{notification_service} == on %{_datadir}/system-apps/res/icons/batt_full_icon.png %{_datadir}/system-apps/res/icons/batt_full_indicator.png +%{_datadir}/system-apps/res/icons/noti_charging_battery_low.png %{_datadir}/system-apps/res/icons/noti_cooling_down.png %{TZ_SYS_RO_SHARE}/system-apps/res/icons/datausage_warning.png %{TZ_SYS_RO_SHARE}/system-apps/res/icons/led_torch.png diff --git a/src/launcher/CMakeLists.txt b/src/launcher/CMakeLists.txt index 84273ff..6c2bd37 100755 --- a/src/launcher/CMakeLists.txt +++ b/src/launcher/CMakeLists.txt @@ -55,6 +55,7 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/datausage_warning.png DESTINATION ${SYST INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/led_torch.png DESTINATION ${SYSTEM_ICONDIR}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/batt_full_icon.png DESTINATION ${SYSTEM_ICONDIR}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/batt_full_indicator.png DESTINATION ${SYSTEM_ICONDIR}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/noti_charging_battery_low.png DESTINATION ${SYSTEM_ICONDIR}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/usb_icon.png DESTINATION ${SYSTEM_ICONDIR}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/noti_cooling_down.png DESTINATION ${SYSTEM_ICONDIR}) ENDIF(NOTIFICATION_SERVICE STREQUAL on) diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 8c8aaba..9d7607f 100755 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -119,6 +119,54 @@ static DBusMessage *battery_charge_noti_on(E_DBus_Object *obj, DBusMessage *msg) 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_no_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); +} + +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); +} + /* Notification Off */ static DBusMessage *noti_off(E_DBus_Object *obj, DBusMessage *msg) { @@ -204,10 +252,21 @@ dbus_noti_methods[] = { /* usb connection */ { "MediaDeviceNotiOn" , NULL , "i" , media_device_noti_on }, { "MediaDeviceNotiOff" , "i" , "i" , noti_off }, - /* Battery */ + /* Battery Event noti*/ { "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 }, + { "BatteryLowNotiOff" , "i" , "i" , noti_off }, + { "BatteryCriticalNotiOn" , NULL , "i" , battery_critical_noti_on }, + { "BatteryCriticalNotiOff" , "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 }, /* Temperature */ { "TempCooldownNotiOn" , NULL , "i" , cooldown_noti_on }, { "TempCooldownNotiOff" , "i" , "i" , noti_off }, diff --git a/src/launcher/launcher.h b/src/launcher/launcher.h index df8fa06..81c69eb 100755 --- a/src/launcher/launcher.h +++ b/src/launcher/launcher.h @@ -56,6 +56,7 @@ #define USB_ICON SYSTEM_ICONDIR"/usb_icon.png" #define BATT_INDI_ICON SYSTEM_ICONDIR"/batt_full_indicator.png" #define BATT_NOTI_ICON SYSTEM_ICONDIR"/batt_full_icon.png" +#define BATT_LOW_INDI_ICON SYSTEM_ICONDIR"/noti_charging_battery_low.png" #define COOLDOWN_NOTI_ICON SYSTEM_ICONDIR"/noti_cooling_down.png" @@ -79,6 +80,14 @@ enum noti_type { USB_STORAGE_RO, USB_DEVICE, BATTERY_FULL, + BATTERY_LOW, + BATTERY_CRITICAL, + BATTERY_LOW_ACT, + BATTERY_CRITICAL_ACT, + BATTERY_LOW_USB_ACT, + BATTERY_CRITICAL_USB_ACT, + BATTERY_LOW_CHG_ACT, + BATTERY_CRITICAL_CHG_ACT, MEDIA_DEVICE, TEMP_COOLDOWN, /* Add here additional notificatoins */ diff --git a/src/launcher/noti.c b/src/launcher/noti.c index 6978160..b3a06bd 100755 --- a/src/launcher/noti.c +++ b/src/launcher/noti.c @@ -33,19 +33,19 @@ struct ticker_info { static const struct ticker_info ticker_notifications[] = { { "USBClient", "IDS_COM_BODY_CONNECTED_AS_A_MEDIA_DEVICE" }, - { "USBClientSSH", "SSH enabled" }, - { "DockConnected", "IDS_QP_POP_THE_DOCK_IS_CONNECTED" }, - { "HdmiConnected", "IDS_VPL_POP_HDMI_CABLE_CONNECTED" }, + { "USBClientSSH", "SSH enabled" }, + { "DockConnected", "IDS_QP_POP_THE_DOCK_IS_CONNECTED" }, + { "HdmiConnected", "IDS_VPL_POP_HDMI_CABLE_CONNECTED" }, { "HdmiDisconnected", "IDS_VPL_POP_HDMI_CABLE_DISCONNECTED" }, { "USBConnectorConected", "IDS_COM_POP_USB_CONNECTOR_CONNECTED" }, { "USBConnectorDisconnected", "IDS_COM_POP_USB_CONNECTOR_DISCONNECTED" }, { "KeyboardConnected", "IDS_COM_POP_KEYBOARD_CONNECTED_ABB2" }, - { "MouseConnected", "IDS_COM_POP_MOUSE_CONNECTED_ABB2" }, + { "MouseConnected", "IDS_COM_POP_MOUSE_CONNECTED_ABB2" }, { "StorageConnected", "IDS_COM_POP_USB_MASS_STORAGE_CONNECTED_ABB2" }, { "StorageConnectedRO", "IDS_ST_BODY_READ_ONLY_USB_DEV_CONNECTED_M_NOUN_ABB" }, { "StorageDisconnectedSafe", "IDS_USB_BODY_USB_MASS_STORAGE_SAFELY_REMOVED" }, { "StorageDisconnectedUnsafe", "IDS_COM_POP_USB_MASS_STORAGE_UNEXPECTEDLY_REMOVED" }, - { "CameraConnected", "IDS_COM_POP_CAMERA_CONNECTED_ABB2" }, + { "CameraConnected", "IDS_COM_POP_CAMERA_CONNECTED_ABB2" }, { "PrinterConnected", "IDS_COM_POP_PRINTER_CONNECTED_ABB2" }, { "UnknownConnected", "IDS_COM_POP_UNKNOWN_USB_DEVICE_CONNECTED" }, { "DeviceDisconnected", "IDS_COM_BODY_USB_DEVICE_SAFELY_REMOVED" }, @@ -608,10 +608,11 @@ static int launch_ticker_notification(void *data) return ret; } -static int launch_battery_full_notification(void) +static int launch_battery_notification(int type) { - int ret; + int ret = -EINVAL; + if (type == BATTERY_FULL) { ret = add_notification(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_LY_ONGOING_EVENT, "IDS_IDLE_POP_BATTERY_FULLY_CAHRGED", @@ -621,6 +622,99 @@ static int launch_battery_full_notification(void) NULL, NOTIFICATION_PROP_DISABLE_APP_LAUNCH, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY); + } 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); + } 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); + } else + _E("Unknown type(%d)", type); + + return ret; +} + +static int launch_battery_active_notification(int 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) { + 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); + } 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); + } 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); + } 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); + } else + _E("Unknown type(%d)", type); return ret; } @@ -657,7 +751,16 @@ static int launch_notification_no_param_by_type(int type) case TIMA_PKM_DETECTION: return launch_tima_pkm_detection_notification(); case BATTERY_FULL: - return launch_battery_full_notification(); + 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 BATTERY_CRITICAL_CHG_ACT: + return launch_battery_active_notification(type); case MEDIA_DEVICE: return launch_media_device_notification(); case TEMP_COOLDOWN: