Fix retrieving app component type 49/239649/6
authorTomasz Swierczek <t.swierczek@samsung.com>
Tue, 28 Jul 2020 11:02:29 +0000 (13:02 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Mon, 24 Aug 2020 11:19:28 +0000 (13:19 +0200)
Change-Id: I08fba48c1e3fd34a4e3d57aa2c109104ff8a88b1

src/notification-daemon/ui/UIAppInvoker.cpp

index 01929463e363cc74e67967dac2f0393deee9278e..cb4c59460d40c46dd1eadfc58bfacdc35a305722 100644 (file)
@@ -30,9 +30,7 @@
 #define PID_BUFFER_SIZE 64
 #define APPID_BUFFER_SIZE 1024
 
-namespace AskUser {
-
-namespace Notification {
+namespace {
 
 const char* LAUNCH_MODE_GROUP = "group";
 const char* LAUNCH_MODE_SINGLE = "single";
@@ -59,36 +57,24 @@ const char* get_app_launch_mode(const std::string &app_id)
     }
 
     switch(app_type) {
-        case APP_INFO_APP_COMPONENT_TYPE_SERVICE_APP:
-        case APP_INFO_APP_COMPONENT_TYPE_WIDGET_APP:
-        case APP_INFO_APP_COMPONENT_TYPE_WATCH_APP:
-            return LAUNCH_MODE_SINGLE;
-
         case APP_INFO_APP_COMPONENT_TYPE_UI_APP :
             return LAUNCH_MODE_GROUP;
 
+        case APP_INFO_APP_COMPONENT_TYPE_SERVICE_APP:
+        case APP_INFO_APP_COMPONENT_TYPE_WIDGET_APP:
+        case APP_INFO_APP_COMPONENT_TYPE_WATCH_APP:
         case APP_INFO_APP_COMPONENT_TYPE_COMPONENT_BASED_APP:
         default:
-            component_info_h component;
-            ret = component_info_create(app_id.c_str(), &component);
+            return LAUNCH_MODE_SINGLE;
+    }
+}
 
-            if (ret) {
-                ALOGE("Cannot retrieve component info for app id : " << app_id);
-                return LAUNCH_MODE_SINGLE;
-            }
+} // namespace anonymous
 
-            component_info_component_type_e component_type;
-            ret = component_info_get_component_type(component, &component_type);
-            component_info_destroy(component);
+namespace AskUser {
 
-            if (ret) {
-                ALOGE("Cannot retrieve component info for app id : " << app_id);
-                return LAUNCH_MODE_SINGLE;
-            }
+namespace Notification {
 
-            return component_type == COMPONENT_INFO_COMPONENT_TYPE_FRAME ? LAUNCH_MODE_GROUP : LAUNCH_MODE_SINGLE;
-    }
-}
 
 bool UIAppInvoker::invoke(int popup_id, pid_t caller_app_pid, const std::string &pkg_id, const std::vector<std::string> &privacies) {
     ALOGD("Launching popup app for popup_id: " << popup_id << ", pkg_id of requestor app: " << pkg_id);