notification: add "media device" notification 13/78613/3 accepted/tizen/mobile/20160706.132629 accepted/tizen/tv/20160706.132603 accepted/tizen/wearable/20160706.132637 submit/tizen/20160706.122818
authortaeyoung <ty317.kim@samsung.com>
Wed, 6 Jul 2016 07:58:46 +0000 (16:58 +0900)
committertaeyoung <ty317.kim@samsung.com>
Wed, 6 Jul 2016 08:58:52 +0000 (17:58 +0900)
- When an usb cable is connected, mtp is enabled by default.
  Thus users can transfer files with host PC, and notificaiton
  is required.

Change-Id: I78c2f86f462f2223c6ca73d583ce29594dddb1f0
Signed-off-by: taeyoung <ty317.kim@samsung.com>
data/usb_icon.png
packaging/system-servant.spec
src/launcher/CMakeLists.txt
src/launcher/launcher.c
src/launcher/launcher.h
src/launcher/noti.c

index 65e94dce38951bdd5e4704af06ab449c6e05b8e7..5283501a5785a490173d00fff41893c1d5fbeea1 100755 (executable)
Binary files a/data/usb_icon.png and b/data/usb_icon.png differ
index 110c43b5942d8ad9ada756c51ca98cc608153c14..23a959142ef0dbf1e4d6bd465ac0ddd3dfe4fcfa 100755 (executable)
@@ -314,6 +314,7 @@ rm -rf %{buildroot}
 %{_datadir}/system-apps/res/icons/batt_full_indicator.png
 %{TZ_SYS_RO_SHARE}/system-apps/res/icons/datausage_warning.png
 %{TZ_SYS_RO_SHARE}/system-apps/res/icons/led_torch.png
+%{TZ_SYS_RO_SHARE}/system-apps/res/icons/usb_icon.png
 %endif
 
 %if %{system_cooperator} == on
index afeb172e88621d5f98878d8c4ae49ba455c2e86b..e363b59c8be3acb01241582fe4fc3c4c08981c2c 100755 (executable)
@@ -52,4 +52,5 @@ 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})
-ENDIF(NOTIFICATION_SERVICE STREQUAL on)
\ No newline at end of file
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/usb_icon.png          DESTINATION ${SYSTEM_ICONDIR})
+ENDIF(NOTIFICATION_SERVICE STREQUAL on)
index a12fe440d65a086c792fd60c2ebd900ca706762e..823408742dc2bce20a1d926f9d56daac16f7f789 100755 (executable)
@@ -158,6 +158,12 @@ static DBusMessage *usb_device_noti_update(E_DBus_Object *obj, DBusMessage *msg)
        return update_notification_double_param(obj, msg, USB_DEVICE);
 }
 
+static DBusMessage *media_device_noti_on(E_DBus_Object *obj, DBusMessage *msg)
+{
+       set_timer_to_terminate();
+       return activate_notification_no_param(obj, msg, MEDIA_DEVICE);
+}
+
 static const struct edbus_method
 dbus_powerkey_methods[] = {
        { "PopupLaunch", NULL, "i", powerkey_popup },
@@ -188,6 +194,9 @@ dbus_noti_methods[] = {
        { "UsbDeviceNotiOn"             , "ss"          , "i"   , usb_device_noti_on            },
        { "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                  },
        /* Battery */
        { "BatteryFullNotiOn"           , NULL          , "i"   , battery_full_noti_on          },
        { "BatteryFullNotiOff"          , "i"           , "i"   , noti_off                      },
index 419d9224aa841c279cb01cf85882059fb2bcf574..a5cac41e5fd5279ff484de88f404c0cac9660d48 100755 (executable)
@@ -77,6 +77,7 @@ enum noti_type {
        USB_STORAGE_RO,
        USB_DEVICE,
        BATTERY_FULL,
+       MEDIA_DEVICE,
        /* Add here additional notificatoins */
        NOTI_TYPE_MAX
 };
index 9a37e052da37eeca2c066495e55ee51ccd77ad7a..ef89b47061fb612baaacffe1c2b181bf55f7ee5f 100755 (executable)
@@ -599,6 +599,24 @@ static int launch_battery_full_notification(void)
        return ret;
 }
 
+static int launch_media_device_notification(void)
+{
+       int ret;
+
+       ret =  add_notification(NOTIFICATION_TYPE_ONGOING,
+                               NOTIFICATION_LY_ONGOING_EVENT,
+                               "IDS_COM_BODY_CONNECTED_AS_A_MEDIA_DEVICE",
+                               NULL,
+                               USB_ICON,
+                               NULL,
+                               NULL,
+                               NOTIFICATION_PROP_DISABLE_APP_LAUNCH |
+                               NOTIFICATION_PROP_DISABLE_AUTO_DELETE,
+                               NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+
+       return ret;
+}
+
 static int launch_notification_no_param_by_type(int type)
 {
        switch (type) {
@@ -614,6 +632,8 @@ static int launch_notification_no_param_by_type(int type)
                return launch_tima_pkm_detection_notification();
        case BATTERY_FULL:
                return launch_battery_full_notification();
+       case MEDIA_DEVICE:
+               return launch_media_device_notification();
        default:
                _E("Noti type is unknown");
                return -EINVAL;