thermal: launch overhead popup and noti 74/99574/1
authortaeyoung <ty317.kim@samsung.com>
Wed, 23 Nov 2016 09:17:19 +0000 (18:17 +0900)
committertaeyoung <ty317.kim@samsung.com>
Wed, 23 Nov 2016 09:17:19 +0000 (18:17 +0900)
According to the thermal status, overheat popup
and notification are launched.

Change-Id: I2513fdd931460cb1a15b7f8338dd9b0f56f66d16
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/apps/apps.c
src/apps/apps.h
src/shared/dbus.h
src/thermal/thermal.c

index be8f3e8..4b7cec6 100755 (executable)
@@ -33,6 +33,7 @@ static const struct app_dbus_match {
 } app_match[] = {
        { APP_DEFAULT , POPUP_BUS_NAME, POPUP_PATH_SYSTEM  , POPUP_INTERFACE_SYSTEM  , POPUP_METHOD },
        { APP_POWERKEY, POPUP_BUS_NAME, POPUP_PATH_POWERKEY, POPUP_INTERFACE_POWERKEY, POPUP_METHOD },
+       { APP_OVERHEAT, POPUP_BUS_NAME, POPUP_PATH_OVERHEAT, POPUP_INTERFACE_OVERHEAT, POPUP_METHOD },
 };
 
 int launch_system_app(char *type, int num, ...)
index 37d4ff3..cfcea7a 100755 (executable)
@@ -25,6 +25,7 @@
 #include "display/poll.h"
 
 #define APP_POWERKEY "powerkey"
+#define APP_OVERHEAT "overheat"
 #define APP_DEFAULT  "system"
 #define APP_KEY_TYPE "_SYSPOPUP_CONTENT_"
 
index a9816d5..eed12cb 100644 (file)
 /* System */
 #define POPUP_PATH_SYSTEM                   POPUP_OBJECT_PATH"/System"
 #define POPUP_INTERFACE_SYSTEM              POPUP_INTERFACE_NAME".System"
+/* Overheat */
+#define POPUP_PATH_OVERHEAT                 POPUP_OBJECT_PATH"/Overheat"
+#define POPUP_INTERFACE_OVERHEAT            POPUP_INTERFACE_NAME".Overheat"
 /* Crash */
 #define POPUP_PATH_CRASH                    POPUP_OBJECT_PATH"/Crash"
 #define POPUP_INTERFACE_CRASH               POPUP_INTERFACE_NAME".Crash"
index 2ebc546..603eda4 100644 (file)
 #include <Ecore.h>
 #include <hw/thermal.h>
 
+#include "apps/apps.h"
 #include "core/devices.h"
 #include "core/log.h"
 #include "core/device-notifier.h"
 
 static struct thermal_device *thermal_dev;
 
+static int noti;
+
+static void thermal_remove_noti(void)
+{
+       if (noti) {
+               remove_notification("TempCooldownNotiOff", noti);
+               noti = 0;
+       }
+}
+
+static void thermal_add_noti(void)
+{
+       if (!noti)
+               noti = add_notification("TempCooldownNotiOn");
+}
+
+static void thermal_add_popup(void)
+{
+       launch_system_app(APP_OVERHEAT, 2,
+                       APP_KEY_TYPE, "overheat");
+}
+
 static void thermal_action(struct thermal_info *info, void *data)
 {
        if (!info)
@@ -36,18 +59,25 @@ static void thermal_action(struct thermal_info *info, void *data)
        switch (info->state) {
        case THERMAL_STATE_LOW:
                _E("THERMAL: temparature LOW");
+               thermal_remove_noti();
                break;
        case THERMAL_STATE_NORMAL:
                _I("THERMAL: temparature normal");
+               thermal_remove_noti();
                break;
        case THERMAL_STATE_HIGH:
-               if (info->level == THERMAL_LEVEL_WARNING)
+               if (info->level == THERMAL_LEVEL_WARNING) {
                        _E("THERMAL: temparature HIGH (warning)");
-               else if (info->level == THERMAL_LEVEL_CRITICAL)
+                       thermal_add_noti();
+               } else if (info->level == THERMAL_LEVEL_CRITICAL) {
                        _E("THERMAL: temparature HIGH (critical)");
-               else if (info->level == THERMAL_LEVEL_POWEROFF)
+                       thermal_remove_noti();
+                       thermal_add_popup();
+               } else if (info->level == THERMAL_LEVEL_POWEROFF) {
                        _E("THERMAL: temparature HIGH (poweroff)");
-               else
+                       thermal_remove_noti();
+                       thermal_add_popup();
+               } else
                        _E("THERMAL: temparature HIGH");
                break;
        default: