Refactor amd modules 48/243648/18
authorChanggyu Choi <changyu.choi@samsung.com>
Wed, 9 Sep 2020 02:02:47 +0000 (11:02 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 10 Sep 2020 03:58:48 +0000 (12:58 +0900)
 - Remove module's "*private.h" header that define common things
 - Add amd_mod_common.h

Change-Id: I40b080613077ae19e613f9fb48fd0a9a2b278a40
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
70 files changed:
CMakeLists.txt
inc/amd_mod_common.h [new file with mode: 0644]
modules/boost/inc/amd_boost_private.h [deleted file]
modules/boost/src/amd_boost.c
modules/complication/inc/amd_complication_private.h [deleted file]
modules/complication/src/amd_complication.c
modules/component-manager/src/component_info.cc
modules/component-manager/src/component_manager.cc
modules/component-manager/src/component_manager_private.h [new file with mode: 0644]
modules/component-manager/src/dispatcher.cc
modules/component-manager/src/job.cc
modules/component-manager/src/module.cc
modules/component-manager/src/private.h [deleted file]
modules/component-manager/src/request_handler.cc
modules/component-manager/src/request_handler/component_info_foreach.cc
modules/component-manager/src/request_handler/component_info_get.cc
modules/component-manager/src/worker.cc
modules/cooldown/inc/amd_cooldown.h [deleted file]
modules/cooldown/src/amd_cooldown.c
modules/cynara-core/inc/amd_cynara_core.h [deleted file]
modules/cynara-core/src/amd_cynara_core.c
modules/extractor/inc/amd_extractor.h [deleted file]
modules/extractor/src/amd_extractor.c
modules/input/inc/amd_input_private.h
modules/input/src/amd_input.c
modules/input/src/amd_input_config.c
modules/job-scheduler/inc/amd_job_scheduler_private.h [deleted file]
modules/job-scheduler/src/amd_job_scheduler.c
modules/launchpad/inc/launchpad-private.h [deleted file]
modules/launchpad/inc/launchpad_private.h [new file with mode: 0644]
modules/launchpad/src/launcher_info.c
modules/launchpad/src/launchpad.c
modules/loader-manager/inc/amd_loader_manager_private.h [deleted file]
modules/loader-manager/src/amd_loader_manager.c
modules/rpc-port/inc/amd_rpc_port_private.h [deleted file]
modules/rpc-port/src/amd_rpc_port.c
modules/rua/inc/amd_rua_private.h [new file with mode: 0644]
modules/rua/inc/private.h [deleted file]
modules/rua/src/amd_rua.c
modules/rua/src/amd_rua_image_monitor.c
modules/rua/src/amd_rua_info.c
modules/rua/src/amd_rua_launch_context.c
modules/rua/src/amd_rua_request.c
modules/screen-resolution/inc/screen-resolution-private.h [deleted file]
modules/screen-resolution/src/screen-resolution.c
modules/share/inc/amd_share.h [deleted file]
modules/share/src/amd_share.c
modules/splash-screen/inc/splash-screen-private.h [deleted file]
modules/splash-screen/src/splash-screen.c
modules/ui-core/inc/app_group_private.h [new file with mode: 0644]
modules/ui-core/src/amd_screen_connector.c
modules/ui-core/src/app_group.c
modules/ui-core/src/app_group_request.c
modules/ui-core/src/app_group_wayland.c
modules/ui-core/src/status.c
modules/ui-core/src/ui_core.c
modules/watch/inc/amd_watch.h [deleted file]
modules/watch/inc/amd_watch_private.h [new file with mode: 0644]
modules/watch/src/amd_watch.c
modules/watch/src/amd_watch_logger.c
modules/watchdog/inc/amd_watchdog_private.h
modules/watchdog/src/amd_watchdog.c
modules/watchdog/src/amd_watchdog_config.c
modules/watchdog/src/amd_watchdog_logger.c
modules/wayland-core/inc/wayland-core-private.h [deleted file]
modules/wayland-core/src/wayland-core.c
modules/widget/inc/amd_widget_private.h [new file with mode: 0644]
modules/widget/src/amd_widget.c
modules/widget/src/amd_widget_logger.c
modules/widget/src/amd_widget_private.h [deleted file]

index 753ab710dc46d7d8ea25eeb959994f51a7150827..b8a92baa194f624c1ea757ea4a30d974e56c1d4b 100644 (file)
@@ -61,6 +61,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
 SET(HEADERS_LIB_AMD
        amd.h
+       amd_mod_common.h
        amd_api_noti.h
        amd_api_wayland.h
        amd_api_app_status.h
diff --git a/inc/amd_mod_common.h b/inc/amd_mod_common.h
new file mode 100644 (file)
index 0000000..d931286
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <dlog.h>
+
+#ifndef _E
+#define _E LOGE
+#endif
+
+#ifndef _W
+#define _W LOGW
+#endif
+
+#ifndef _I
+#define _I LOGI
+#endif
+
+#ifndef _D
+#define _D LOGD
+#endif
+
+#ifndef EXPORT
+#define EXPORT __attribute__ ((visibility("default")))
+#endif
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#endif
+
+#ifndef REGULAR_UID_MIN
+#define REGULAR_UID_MIN 5000
+#endif
diff --git a/modules/boost/inc/amd_boost_private.h b/modules/boost/inc/amd_boost_private.h
deleted file mode 100644 (file)
index 9812ee8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "AMD_BOOST"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
index a794404d892ebf6c4a5c21ee9c4009a7d5441d29..63ff5532fc580e6fd1fc62a6ba1683fbd1e218f7 100644 (file)
 #include <aul_cmd.h>
 #include <aul_svc_priv_key.h>
 #include <bundle_internal.h>
+#include <amd_mod_common.h>
 
-#include "amd_boost_private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_BOOST"
 
 #define PASS_BUS_NAME                  "org.tizen.system.pass"
 #define PASS_PATH_PMQOS                        "/Org/Tizen/System/Pass/Pmqos"
diff --git a/modules/complication/inc/amd_complication_private.h b/modules/complication/inc/amd_complication_private.h
deleted file mode 100755 (executable)
index 6106c04..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "AMD_COMPLICATION"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
index efb7a027a852da9db9a2f6a50ef2d6a820814679..cb019c53b891d6208fb25d9df70b057a50bf2912 100755 (executable)
 #include <aul_sock.h>
 #include <bundle_internal.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd_complication_private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_COMPLICATION"
 
-#define ARRAY_SIZE(x) ((sizeof(x)) / sizeof(x[0]))
 #define MAX_NR_OF_DESCRIPTORS 2
 #define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
 
index 0cb5c6c8097002f063794bfe733aed7fd600632b..143e3fe809b560af665d35d5ad40301fd11541c2 100644 (file)
@@ -17,7 +17,7 @@
 #include <aul.h>
 
 #include "component_info.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 
index a88c145dd95494329497e23056f21e870b57198b..2d80f0153703e787f627a12fafed9bff9b23f3f7 100644 (file)
@@ -19,7 +19,7 @@
 #include "component_manager.h"
 #include "request_handler/component_info_get.h"
 #include "request_handler/component_info_foreach.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 using namespace component_manager::request_handler;
diff --git a/modules/component-manager/src/component_manager_private.h b/modules/component-manager/src/component_manager_private.h
new file mode 100644 (file)
index 0000000..464ac82
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "AMD_COMPONENT_MANAGER"
+
index c9456b4ef3bb48728d18d76d3c9277d64e0affb1..26c59e77d147c4bab99fcd42509af312e9f763ee 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "dispatcher.h"
 #include "pending_job.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 
index e6c6029dcb04c63fa941f4f0443f07b201e3d763..0b31ff88a869d9d340bbf5ffd59ec49549769881 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include "job.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 
index b963ccf4ff22d5dde5326325d9b62afd174f361a..b6bf580fc2bd3ce78f34d830402d5e03f7908995 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include "component_manager.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 using namespace component_manager;
 
diff --git a/modules/component-manager/src/private.h b/modules/component-manager/src/private.h
deleted file mode 100644 (file)
index c13b593..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PRIVATE_H_
-#define PRIVATE_H_
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "AMD_COMPONENT_MANAGER"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#ifdef EXPORT
-#undef EXPORT
-#endif
-
-#define EXPORT __attribute__((visibility("default")))
-
-#ifdef ARRAY_SIZE
-#undef ARRAY_SIZE
-#endif
-
-#define ARRAY_SIZE(x) (sizeof(x) / (sizeof(x[0])))
-
-#endif  // PRIVATE_H_
index 4dc2fdc18e001267c777f90f8a8a20f7176d8cd8..ce0af2ae9d19d7aa20b7ca56c83b53ccc426f918 100644 (file)
@@ -17,7 +17,7 @@
 #include <memory>
 
 #include "request_handler.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 
index e7fbcdc9a8709598443bbbcca995404c6da1a6d7..66cdf4a9dfd97c4566a0a0eb69215dc1496c3524 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "component_info.h"
 #include "request_handler/component_info_foreach.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 namespace request_handler {
index f3a9ce2d2f5fc6f66102f7d15577561931825f5a..1e04dd5149b0fc5755c2832b8845b26cc313b10f 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "component_info.h"
 #include "request_handler/component_info_get.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 namespace request_handler {
index 97a7e1ad0e38e89f45d61b11386750646b12910e..2cd9f59494a22d3dc3c9c0efcfe517bf53714cb6 100644 (file)
@@ -21,7 +21,7 @@
 #include <fcntl.h>
 
 #include "worker.h"
-#include "private.h"
+#include "component_manager_private.h"
 
 namespace component_manager {
 
diff --git a/modules/cooldown/inc/amd_cooldown.h b/modules/cooldown/inc/amd_cooldown.h
deleted file mode 100644 (file)
index 8ffc675..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_COOLDOWN"
-
-#define _E(fmt, arg...) LOGE(fmt, ##arg)
-#define _D(fmt, arg...) LOGD(fmt, ##arg)
-#define _W(fmt, arg...) LOGW(fmt, ##arg)
-#define _I(fmt, arg...) LOGI(fmt, ##arg)
-
-#define EXPORT __attribute__ ((visibility("default")))
-
index d040658bf941749aca13ec693bda3c608b5dae5c..0817c6d19416a9c6d3582e04a384b5ed7a3ed032 100644 (file)
 #include <gio/gio.h>
 #include <aul.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd_cooldown.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_COOLDOWN"
 
 #define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
 #define DBUS_PATH_DBUS "/org/freedesktop/DBus"
@@ -33,8 +37,6 @@
 #define AMD_DBUS_INTERFACE "org.tizen.application.manager"
 #define AMD_DBUS_OBJECT_PATH "/Org/Tizen/Application/Manager"
 
-#define REGULAR_UID_MIN 5000
-
 #define COOLDOWN_STATUS_RELEASE "release"
 #define COOLDOWN_STATUS_LIMIT "limit"
 
diff --git a/modules/cynara-core/inc/amd_cynara_core.h b/modules/cynara-core/inc/amd_cynara_core.h
deleted file mode 100644 (file)
index 14b2d0c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_CYNARA_CORE"
-
-#define _E(fmt, arg...) LOGE(fmt, ##arg)
-#define _D(fmt, arg...) LOGD(fmt, ##arg)
-#define _W(fmt, arg...) LOGW(fmt, ##arg)
-#define _I(fmt, arg...) LOGI(fmt, ##arg)
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
-
index 8a1e08ae488e4a5419f34c0d7888cac0bce8e764..bac8971b5d486b5ff3eb38907afd2a6bc9d8c583 100644 (file)
 #include <security-manager.h>
 #include <cert-svc/ccert.h>
 #include <cert-svc/cinstance.h>
+#include <amd_mod_common.h>
 
-#include "amd_cynara_core.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_CYNARA_CORE"
 
 #define MAX_LOCAL_BUFSZ 128
-#define REGULAR_UID_MIN 5000
 
 static cynara_async *r_cynara;
 static int cynara_fd = -1;
diff --git a/modules/extractor/inc/amd_extractor.h b/modules/extractor/inc/amd_extractor.h
deleted file mode 100644 (file)
index cb95800..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_EXTRACTOR"
-
-#define _E(fmt, arg...) LOGE(fmt, ##arg)
-#define _D(fmt, arg...) LOGD(fmt, ##arg)
-#define _W(fmt, arg...) LOGW(fmt, ##arg)
-#define _I(fmt, arg...) LOGI(fmt, ##arg)
-
-#define EXPORT __attribute__ ((visibility("default")))
-
index 28c4373bbd01d739c54a4999121ef23d145a1556..7a7528f39e48bed69707dd8b073916cd1d8bdb97 100644 (file)
 #include <aul.h>
 #include <bundle_internal.h>
 #include <tzplatform_config.h>
+#include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd.h"
-#include "amd_extractor.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_EXTRACTOR"
 
 #define PATH_APP_ROOT tzplatform_getenv(TZ_USER_APP)
 #define PATH_GLOBAL_APP_RO_ROOT tzplatform_getenv(TZ_SYS_RO_APP)
index 75d91e97c4e829151166c135f1280269717dcbd8..dada1b638fb0f1d8d67188c3cbd1a7ac8d834d3b 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __AMD_INPUT_PRIVATE_H__
-#define __AMD_INPUT_PRIVATE_H__
+#pragma once
 
-#include <dlog.h>
+#include <amd_mod_common.h>
 
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
 
-#define LOG_TAG "AMD_INPUT"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#ifdef EXPORT
-#undef EXPORT
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
-
-#endif /* __AMD_INPUT_PRIVATE_H__ */
+#define LOG_TAG "AMD_INPUT"
\ No newline at end of file
index 80eea47793c08178de6a4ab715e8ccc9a03e8bf8..d9389ff1104060641442c7945410636b3bb7ff38 100644 (file)
@@ -27,8 +27,8 @@
 #include <aul.h>
 #include <amd.h>
 
-#include "amd_input_private.h"
 #include "amd_input_config.h"
+#include "amd_input_private.h"
 
 static bool locked;
 static bool init_done;
index b62ef08a32264f294aa6644c0aed77e1b7d93d1d..64d40151ccc830291bea733e41e37c354c6d990c 100644 (file)
@@ -20,8 +20,8 @@
 #include <string.h>
 #include <iniparser.h>
 
-#include "amd_input_private.h"
 #include "amd_input_config.h"
+#include "amd_input_private.h"
 
 #define CONFIG_PATH "/usr/share/amd/conf/amd_input.conf"
 #define CONFIG_SECTION_NAME "Setting"
diff --git a/modules/job-scheduler/inc/amd_job_scheduler_private.h b/modules/job-scheduler/inc/amd_job_scheduler_private.h
deleted file mode 100644 (file)
index 7d3b965..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "AMD_JOB_SCHEDULER"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
index bfcab3f75a12f1fdbd33ec8c311b8418d082c6d9..3d7c1462c830251dea82ecc96bee010bc170d6c7 100644 (file)
 #include <aul_job_scheduler.h>
 #include <bundle_internal.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd_job_scheduler_private.h"
-
-#define ARRAY_SIZE(x) ((sizeof(x)) / sizeof(x[0]))
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_JOB_SCHEDULER"
 
 struct job_s {
        char *id;
diff --git a/modules/launchpad/inc/launchpad-private.h b/modules/launchpad/inc/launchpad-private.h
deleted file mode 100644 (file)
index a2838e4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_LAUNCHPAD"
-
-#define EXPORT __attribute__ ((visibility("default")))
diff --git a/modules/launchpad/inc/launchpad_private.h b/modules/launchpad/inc/launchpad_private.h
new file mode 100644 (file)
index 0000000..018f375
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_LAUNCHPAD"
index 69f7838bb5d16122e3081d27115c082845696490..d1344d9b2b88f1b9221b27a21d5df762bc895f7f 100644 (file)
 #include <dirent.h>
 #include <string.h>
 #include <unistd.h>
+#include <amd_mod_common.h>
 
-#include "launchpad-private.h"
 #include "launcher_info.h"
+#include "launchpad_private.h"
 
 #define FREE_AND_NULL(x) do { \
        if (x) { \
@@ -51,7 +52,7 @@ static struct launcher_info_s *__create_launcher_info(void)
 
        info = calloc(1, sizeof(struct launcher_info_s));
        if (info == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return NULL;
        }
 
@@ -106,7 +107,7 @@ static GList *__parse_file(GList *list, const char *path)
                sscanf(buf, "%ms %ms", &tok1, &tok2);
                if (tok1 && strcasecmp(TAG_LAUNCHER, tok1) == 0) {
                        if (info) {
-                               LOGD("name: %s, exe: %s", info->name, info->exe);
+                               _D("name: %s, exe: %s", info->name, info->exe);
                                list = g_list_append(list, info);
                        }
 
@@ -127,7 +128,7 @@ static GList *__parse_file(GList *list, const char *path)
                if (strcasecmp(TAG_NAME, tok1) == 0) {
                        info->name = strdup(tok2);
                        if (info->name == NULL) {
-                               LOGE("Out of memory");
+                               _E("Out of memory");
                                __destroy_launcher_info(info);
                                info = NULL;
                                break;
@@ -135,20 +136,20 @@ static GList *__parse_file(GList *list, const char *path)
                } else if (strcasecmp(TAG_EXE, tok1) == 0) {
                        info->exe = strdup(tok2);
                        if (info->exe == NULL) {
-                               LOGE("Out of memory");
+                               _E("Out of memory");
                                __destroy_launcher_info(info);
                                info = NULL;
                                break;
                        }
                        if (access(info->exe, F_OK | X_OK) != 0) {
-                               LOGE("Failed to access %s", info->exe);
+                               _E("Failed to access %s", info->exe);
                                __destroy_launcher_info(info);
                                info = NULL;
                        }
                } else if (strcasecmp(TAG_APP_TYPE, tok1) == 0) {
                        __parse_app_types(info, &buf[strlen(tok1)]);
                        if (info->app_types == NULL) {
-                               LOGE("app_types is NULL");
+                               _E("app_types is NULL");
                                __destroy_launcher_info(info);
                                info = NULL;
                                break;
@@ -161,7 +162,7 @@ static GList *__parse_file(GList *list, const char *path)
        fclose(fp);
 
        if (info) {
-               LOGD("name: %s, exe: %s", info->name, info->exe);
+               _D("name: %s, exe: %s", info->name, info->exe);
                list = g_list_append(list, info);
        }
 
index 99b6df71c9ad574500dab49d7171920693a15d60..93f8a927bfd20aed407430b85c99e49b9af6e7f4 100644 (file)
 #include <security-manager.h>
 #include <tzplatform_config.h>
 #include <trust-anchor.h>
+#include <amd_mod_common.h>
 
-#include "launchpad-private.h"
 #include "launcher_info.h"
+#include "launchpad_private.h"
 
 #define AUL_K_EXEC                     "__AUL_EXEC__"
 #define AUL_K_APPID                    "__AUL_APPID__"
diff --git a/modules/loader-manager/inc/amd_loader_manager_private.h b/modules/loader-manager/inc/amd_loader_manager_private.h
deleted file mode 100644 (file)
index 8715d73..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "AMD_LOADER_MANAGER"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
index 7fbbcc185f7deff53acb74bf00f8b9d20bb490eb..eda507008a5ccfba20b4088dde06f1dab72619de 100644 (file)
 #include <aul_cmd.h>
 #include <bundle_internal.h>
 #include <glib.h>
+#include <amd_mod_common.h>
 
-#include "amd_loader_manager_private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_LOADER_MANAGER"
 
 #define METADATA_KEY_APP_DEFINED_LOADER \
        "http://tizen.org/metadata/app-defined-loader"
diff --git a/modules/rpc-port/inc/amd_rpc_port_private.h b/modules/rpc-port/inc/amd_rpc_port_private.h
deleted file mode 100644 (file)
index e33c092..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "AMD_RPC_PORT"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
index 2e0c375d257f4c7b8578bfb8f7f68bc61576ca4e..9d0049ef2821819b337aefbbd106f7fa3296146d 100644 (file)
 #include <cert-svc/ccert.h>
 #include <cert-svc/cinstance.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd_rpc_port_private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_RPC_PORT"
 
-#define ARRAY_SIZE(x) ((sizeof(x)) / sizeof(x[0]))
 #define MAX_NR_OF_DESCRIPTORS 2
 #define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
 #define KEY_PRIVILEGE_CHECK_BYPASS \
diff --git a/modules/rua/inc/amd_rua_private.h b/modules/rua/inc/amd_rua_private.h
new file mode 100644 (file)
index 0000000..7cdcdec
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_RUA"
diff --git a/modules/rua/inc/private.h b/modules/rua/inc/private.h
deleted file mode 100644 (file)
index d3961e0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_RUA"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-
-#define EXPORT __attribute__ ((visibility("default")))
index 8dbf28dfec97d5c8b99eb1cce66ea03eb04751f9..ee5ff1b118b04172336aecfeb995578761d07a3c 100644 (file)
@@ -38,7 +38,7 @@
 #include "amd_rua_info.h"
 #include "amd_rua_launch_context.h"
 #include "amd_rua_image_monitor.h"
-#include "private.h"
+#include "amd_rua_private.h"
 
 #define AUL_SVC_K_LAUNCH_MODE "__APP_SVC_LAUNCH_MODE__"
 
@@ -772,4 +772,4 @@ EXPORT void AMD_MOD_FINI(void)
        _rua_info_fini();
        _rua_request_fini();
        _rua_launch_context_fini();
-}
+}
\ No newline at end of file
index 5ea2af654a6e9eb9f000167875d0166eac82048f..828a07e87cf6e12048740139a0d5726799e3222f 100644 (file)
@@ -27,7 +27,7 @@
 #include <amd.h>
 
 #include "amd_rua_image_monitor.h"
-#include "private.h"
+#include "amd_rua_private.h"
 
 #define PATH_RUN        "/run"
 #define FILE_E_IMG      ".e-img"
index 41d0622b7050e45a7a80a1383b38a6bcdffec83f..a85b7c45bd8b4c5da0ee6f28992bb4e36ff65016 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "amd_rua_info.h"
 #include "amd_rua_image_monitor.h"
-#include "private.h"
+#include "amd_rua_private.h"
 
 struct rua_info_s {
        char *key;
index c945a569e9c8360c25c7aea08085d8b5e52947a9..29cfd01527bf9c274337fd9bf9ab5d63f2ee8940 100644 (file)
@@ -34,7 +34,7 @@
 #include <amd.h>
 
 #include "amd_rua_launch_context.h"
-#include "private.h"
+#include "amd_rua_private.h"
 
 #define MULTI_INSTANCE_SHORTCUT "multi-instance-shortcut"
 #define QUERY_KEY_ID            "id="
index 513a1aaac52ccef71a413e7ea7f935ad70b8bf89..67839fe5f31a41b7fbda4ae0e20e63d8a2b889b7 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "amd_rua_request.h"
 #include "amd_rua_info.h"
-#include "private.h"
+#include "amd_rua_private.h"
 
 static int __dispatch_update_rua_stat(amd_request_h req)
 {
diff --git a/modules/screen-resolution/inc/screen-resolution-private.h b/modules/screen-resolution/inc/screen-resolution-private.h
deleted file mode 100644 (file)
index d3f7bee..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SCREEN_RESOLUTION_PRIVATE_H__
-#define __SCREEN_RESOLUTION_PRIVATE_H__
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "AMD_SCREEN_RESOLUTION"
-
-#ifdef EXPORT
-#undef EXPORT
-#endif
-
-#define EXPORT __attribute__((visibility("default")))
-
-#ifdef ARRAY_SIZE
-#undef ARRAY_SIZE
-#endif
-
-#define ARRAY_SIZE(x) (sizeof(x) / (sizeof(x[0])))
-
-#endif /* __SCREEN_RESOLUTION_PRIVATE_H__ */
index 7b637c0ce700ff88c53ee8c7c6a2b71bfd600118..d77d0416acfed018ca38d017381088399290b4cf 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdbool.h>
 
 #include <amd.h>
+#include <amd_mod_common.h>
 #include <aul.h>
 #include <aul_cmd.h>
 #include <bundle_internal.h>
 #include <tzplatform_config.h>
 #include <tizen-launch-client-protocol.h>
 
-#include "screen-resolution-private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_SCREEN_RESOLUTION"
 
 struct wayland_context_s {
        struct wl_display *display;
diff --git a/modules/share/inc/amd_share.h b/modules/share/inc/amd_share.h
deleted file mode 100644 (file)
index ae244b5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_SHARE"
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
-
index a3e047f6fe14e56a79c3df07cd7a9958ced1afd7..02c232c28bc92436cb6d0f2683232b76d839c6fb 100644 (file)
 #include <bundle_internal.h>
 #include <tzplatform_config.h>
 #include <security-manager.h>
+#include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd.h"
-#include "amd_share.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_SHARE"
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 #define LEGACY_APP_PATH "/opt/usr/apps/"
 #define AUL_SVC_K_URI       "__APP_SVC_URI__"
 #define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
@@ -67,12 +70,12 @@ static int __can_share(const char *path, const char *pkgid, uid_t uid)
        char buf[PATH_MAX];
 
        if (stat(path, &path_stat) != 0) {
-               LOGE("failed to stat file to share (%s, %d)", path, errno);
+               _E("failed to stat file to share (%s, %d)", path, errno);
                return -1;
        }
 
        if (!S_ISREG(path_stat.st_mode)) {
-               LOGE("file is not a regular file (%s)", path);
+               _E("file is not a regular file (%s)", path);
                return -1;
        }
 
@@ -133,20 +136,20 @@ static shared_info_h __new_shared_info_handle(const char *appid, uid_t uid,
 
        h = malloc(sizeof(struct shared_info_main_s));
        if (h == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return NULL;
        }
 
        h->shared_info = malloc(sizeof(shared_info_t));
        if (h->shared_info == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                free(h);
                return NULL;
        }
 
        ret = security_manager_private_sharing_req_new(&h->shared_info->handle);
        if (ret != SECURITY_MANAGER_SUCCESS) {
-               LOGE("Failed to create private sharing request handle");
+               _E("Failed to create private sharing request handle");
                free(h->shared_info);
                free(h);
                return NULL;
@@ -154,7 +157,7 @@ static shared_info_h __new_shared_info_handle(const char *appid, uid_t uid,
 
        h->shared_info->owner_appid = strdup(owner_appid);
        if (h->shared_info->owner_appid == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                security_manager_private_sharing_req_free(
                                h->shared_info->handle);
                free(h->shared_info);
@@ -164,7 +167,7 @@ static shared_info_h __new_shared_info_handle(const char *appid, uid_t uid,
 
        h->appid = strdup(appid);
        if (h->appid == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                free(h->shared_info->owner_appid);
                security_manager_private_sharing_req_free(
                                h->shared_info->handle);
@@ -207,14 +210,14 @@ static GList *__add_valid_uri(GList *paths, int caller_pid, const char *appid,
                return paths;
 
        if (!path) {
-               LOGD("path was null");
+               _D("path was null");
                return paths;
        }
 
        if (strncmp(path, "file://", 7) == 0) {
                path = &path[7];
        } else {
-               LOGE("file wasn't started with file://");
+               _E("file wasn't started with file://");
                return paths;
        }
 
@@ -223,7 +226,7 @@ static GList *__add_valid_uri(GList *paths, int caller_pid, const char *appid,
 
        path = __convert_legacy_path(path, uid);
        if (__can_share(path, pkgid, uid) != 0) {
-               LOGE("__can_share() returned an error");
+               _E("__can_share() returned an error");
                free(path);
                return paths;
        }
@@ -249,18 +252,18 @@ static GList *__add_valid_key_for_data_selected(GList *paths, int caller_pid,
 
        path_array = bundle_get_str_array(kb, AUL_SVC_DATA_SELECTED, &len);
        if (!path_array || len <= 0) {
-               LOGE("path_array was null");
+               _E("path_array was null");
                return paths;
        }
 
        ai = amd_appinfo_find(uid, owner_appid);
        if (ai == NULL) {
-               LOGE("appinfo is NULL");
+               _E("appinfo is NULL");
                return paths;
        }
        pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
        if (pkgid == NULL) {
-               LOGE("pkgid was null");
+               _E("pkgid was null");
                return paths;
        }
 
@@ -292,20 +295,20 @@ static GList *__add_valid_key_for_data_path(GList *paths, int caller_pid,
        case BUNDLE_TYPE_STR:
                bundle_get_str(kb, AUL_SVC_DATA_PATH, &path);
                if (!path) {
-                       LOGE("path was null");
+                       _E("path was null");
                        break;
                }
 
                ai = amd_appinfo_find(uid, owner_appid);
                pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
                if (pkgid == NULL) {
-                       LOGE("pkgid was null");
+                       _E("pkgid was null");
                        break;
                }
 
                path = __convert_legacy_path(path, uid);
                if (__can_share(path, pkgid, uid) != 0) {
-                       LOGE("__can_share() returned an error");
+                       _E("__can_share() returned an error");
                        free(path);
                        break;
                }
@@ -315,14 +318,14 @@ static GList *__add_valid_key_for_data_path(GList *paths, int caller_pid,
        case BUNDLE_TYPE_STR_ARRAY:
                path_array = bundle_get_str_array(kb, AUL_SVC_DATA_PATH, &len);
                if (!path_array || len <= 0) {
-                       LOGE("path_array was null");
+                       _E("path_array was null");
                        break;
                }
 
                ai = amd_appinfo_find(uid, owner_appid);
                pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
                if (pkgid == NULL) {
-                       LOGE("pkgid was null");
+                       _E("pkgid was null");
                        break;
                }
 
@@ -355,14 +358,14 @@ static char **__convert_list_to_array(GList *list)
 
        array = (char **)g_malloc0(sizeof(char *) * (len + 1));
        if (array == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
        while (list) {
                array[i] = g_strdup(list->data);
                if (array[i] == NULL) {
-                       LOGE("Out of memory");
+                       _E("Out of memory");
                        g_strfreev(array);
                        return NULL;
                }
@@ -424,7 +427,7 @@ static shared_info_h __temporary_permission_create(int caller_pid, const char *a
        if (!paths || !owner_appid)
                goto clear;
 
-       LOGD("grant permission %s : %s", owner_appid, appid);
+       _D("grant permission %s : %s", owner_appid, appid);
 
        h = __new_shared_info_handle(appid, uid, owner_appid);
        if (h == NULL)
@@ -438,23 +441,23 @@ static shared_info_h __temporary_permission_create(int caller_pid, const char *a
        r = security_manager_private_sharing_req_set_owner_appid(
                        h->shared_info->handle, owner_appid);
        if (r != SECURITY_MANAGER_SUCCESS)
-               LOGE("Failed to set owner appid(%s) %d", owner_appid, r);
+               _E("Failed to set owner appid(%s) %d", owner_appid, r);
 
        r = security_manager_private_sharing_req_set_target_appid(
                        h->shared_info->handle, appid);
        if (r != SECURITY_MANAGER_SUCCESS)
-               LOGE("Failed to set target appid(%s) %d", appid, r);
+               _E("Failed to set target appid(%s) %d", appid, r);
 
        r = security_manager_private_sharing_req_add_paths(
                        h->shared_info->handle, (const char **)path_array, len);
        if (r != SECURITY_MANAGER_SUCCESS)
-               LOGE("Failed to add paths %d", r);
+               _E("Failed to add paths %d", r);
 
-       LOGD("security_manager_private_sharing_apply ++");
+       _D("security_manager_private_sharing_apply ++");
        r = security_manager_private_sharing_apply(h->shared_info->handle);
-       LOGD("security_manager_private_sharing_apply --");
+       _D("security_manager_private_sharing_apply --");
        if (r != SECURITY_MANAGER_SUCCESS) {
-               LOGE("Failed to apply private sharing %d", r);
+               _E("Failed to apply private sharing %d", r);
                __temporary_permission_destroy(h);
                h = NULL;
        }
@@ -497,13 +500,13 @@ static int __temporary_permission_destroy(shared_info_h handle)
                return -1;
 
        if (handle->shared_info) { /* back out */
-               LOGD("revoke permission %s : %s",
+               _D("revoke permission %s : %s",
                                handle->shared_info->owner_appid,
                                handle->appid);
                r = security_manager_private_sharing_drop(
                                handle->shared_info->handle);
                if (r != SECURITY_MANAGER_SUCCESS)
-                       LOGE("revoke error %d", r);
+                       _E("revoke error %d", r);
 
                security_manager_private_sharing_req_free(
                                handle->shared_info->handle);
@@ -529,16 +532,16 @@ static int __temporary_permission_drop(int pid, uid_t uid)
 
        list = amd_app_status_get_extra(app_status, "share");
        if (!list) {
-               LOGD("list was null");
+               _D("list was null");
                return -1;
        }
 
        while (list) {
                sit = (shared_info_t *)list->data;
-               LOGD("revoke permission %s : %d", sit->owner_appid, pid);
+               _D("revoke permission %s : %d", sit->owner_appid, pid);
                r = security_manager_private_sharing_drop(sit->handle);
                if (r != SECURITY_MANAGER_SUCCESS)
-                       LOGE("revoke error %d", r);
+                       _E("revoke error %d", r);
                security_manager_private_sharing_req_free(sit->handle);
                list = g_list_next(list);
        }
@@ -561,7 +564,7 @@ static int __temporary_permission_drop_with_owner(const char *owner_appid,
 
        list = amd_app_status_get_extra(app_status, "share");
        if (!list) {
-               LOGD("list was null");
+               _D("list was null");
                return -1;
        }
 
@@ -571,11 +574,11 @@ static int __temporary_permission_drop_with_owner(const char *owner_appid,
                iter = g_list_next(iter);
                if (!strcmp(shared_info->owner_appid, owner_appid)) {
                        list = g_list_remove(list, shared_info);
-                       LOGD("Revoke permission %s : %d",
+                       _D("Revoke permission %s : %d",
                                        shared_info->owner_appid, pid);
                        ret = security_manager_private_sharing_drop(shared_info->handle);
                        if (ret != SECURITY_MANAGER_SUCCESS)
-                               LOGE("Revoke error %d", ret);
+                               _E("Revoke error %d", ret);
 
                        security_manager_private_sharing_req_free(shared_info->handle);
                        free(shared_info->owner_appid);
@@ -601,7 +604,7 @@ static int  __on_app_result_start(const char *msg, int arg1, int arg2,
        if (appid) {
                __cur_shared_info = __temporary_permission_create(pid, appid, data, uid);
                if (__cur_shared_info == NULL)
-                       LOGD("No sharable path : %d %s", pid, appid);
+                       _D("No sharable path : %d %s", pid, appid);
        }
 
        return 0;
@@ -619,7 +622,7 @@ static int  __on_app_result_end(const char *msg, int arg1, int arg2,
                if (res >= 0) {
                        ret = __temporary_permission_apply(pid, uid, __cur_shared_info);
                        if (ret != 0) {
-                               LOGD("Couldn't apply temporary permission: %d",
+                               _D("Couldn't apply temporary permission: %d",
                                                ret);
                        }
                }
@@ -648,7 +651,7 @@ static int __on_launch_prepare_end(const char *msg, int arg1, int arg2,
                __cur_shared_info = __temporary_permission_create(caller_pid,
                                appid, data, target_uid);
                if (__cur_shared_info == NULL)
-                       LOGW("No sharable path: %d %s", caller_pid, appid);
+                       _W("No sharable path: %d %s", caller_pid, appid);
        }
 
        return 0;
@@ -665,7 +668,7 @@ static int __on_launch_complete_end(const char *msg, int arg1, int arg2,
                ret = __temporary_permission_apply(pid, target_uid,
                                __cur_shared_info);
                if (ret < 0)
-                       LOGD("Couldn't apply temporary permission: %d", ret);
+                       _D("Couldn't apply temporary permission: %d", ret);
 
                __temporary_permission_destroy(__cur_shared_info);
                __cur_shared_info = NULL;
@@ -727,7 +730,7 @@ static int __dispatch_set_private_sharing(amd_request_h req)
        shared_info_h info = __temporary_permission_create(caller_pid,
                                callee_appid, data, target_uid);
        if (info == NULL) {
-               LOGW("No sharable path: %d %s", caller_pid, caller_appid);
+               _W("No sharable path: %d %s", caller_pid, caller_appid);
                return -1;
        }
 
@@ -735,11 +738,11 @@ static int __dispatch_set_private_sharing(amd_request_h req)
        callee_pid = amd_app_status_get_pid(callee_app_status);
        ret = __temporary_permission_apply(callee_pid, target_uid, info);
        if (ret != 0) {
-               LOGE("Couldn't apply temporary permission: %d",
+               _E("Couldn't apply temporary permission: %d",
                                ret);
        }
        __temporary_permission_destroy(info);
-       LOGI("caller(%s), callee(%s), result(%d)",
+       _I("caller(%s), callee(%s), result(%d)",
                        caller_appid, callee_appid, ret);
 
        return ret;
@@ -791,19 +794,19 @@ EXPORT int AMD_MOD_INIT(void)
 {
        int r;
 
-       LOGD("share init");
+       _D("share init");
 
        r = amd_request_register_cmds(__dispatch_table,
                        ARRAY_SIZE(__dispatch_table));
        if (r < 0) {
-               LOGE("Failed to register cmds");
+               _E("Failed to register cmds");
                return -1;
        }
 
        r = amd_cynara_register_checkers(__cynara_checkers,
                        ARRAY_SIZE(__cynara_checkers));
        if (r < 0) {
-               LOGE("Failed to register cynara checkers");
+               _E("Failed to register cynara checkers");
                return -1;
        }
 
@@ -831,6 +834,6 @@ EXPORT int AMD_MOD_INIT(void)
 
 EXPORT void AMD_MOD_FINI(void)
 {
-       LOGD("share finish");
+       _D("share finish");
 }
 
diff --git a/modules/splash-screen/inc/splash-screen-private.h b/modules/splash-screen/inc/splash-screen-private.h
deleted file mode 100644 (file)
index e6e5e05..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_SPLASH_SCREEN"
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
-
-#define FREE_AND_NULL(x)                       \
-       do {                                    \
-               if (x) {                        \
-                       free(x);                \
-                       x = NULL;               \
-               }                               \
-       } while (0)
-
index b743eabd38bae4ef9000cc6ac80eb86639c4585a..a0f9df8d938b8d9bd8c19f8597bc4276fd821af2 100644 (file)
 #include <vconf.h>
 #include <sensor_internal.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "splash-screen-private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_SPLASH_SCREEN"
 
 #define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
 #define K_FAKE_EFFECT                  "__FAKE_EFFECT__"
 #define TIZEN_FEATURE_AUTO_ROTATION \
        (!(amd_config_get_tizen_profile() & (AMD_TIZEN_PROFILE_TV)))
 
+#define FREE_AND_NULL(x)                       \
+       do {                                    \
+               if (x) {                        \
+                       free(x);                \
+                       x = NULL;               \
+               }                               \
+       } while (0)
+
 struct splash_image_s {
        struct tizen_launch_splash *image;
        char *appid;
@@ -152,7 +164,7 @@ static gboolean __timeout_handler(gpointer data)
        app_status = amd_app_status_find_by_pid(si->pid);
        if (app_status) {
                if (amd_app_status_is_starting(app_status) == false) {
-                       LOGW("% is not starting", si->pid);
+                       _W("% is not starting", si->pid);
                        return TRUE;
                }
        }
@@ -171,7 +183,7 @@ static int __app_can_launch_splash_image(amd_appinfo_h ai, bundle *kb)
 
        comp_type = amd_appinfo_get_value(ai, AMD_AIT_COMPTYPE);
        if (comp_type == NULL || strcmp(comp_type, APP_TYPE_UI) != 0) {
-               LOGD("component_type: %s", comp_type);
+               _D("component_type: %s", comp_type);
                return -1;
        }
 
@@ -303,13 +315,13 @@ static splash_image_h __splash_screen_create_image(amd_appinfo_h ai,
        if (TIZEN_FEATURE_CHARGER_STATUS) {
                if (rotation.charger_status) {
                        if (!rotation.initialized && __init_rotation() < 0)
-                               LOGW("Failed to initialize rotation");
+                               _W("Failed to initialize rotation");
                }
        } else {
                if (!rotation.initialized && __init_rotation() < 0)
-                       LOGW("Failed to initialize rotation");
+                       _W("Failed to initialize rotation");
        }
-       LOGD("angle: %d", rotation.angle);
+       _D("angle: %d", rotation.angle);
 
        image_info = __get_splash_image_info(ai, kb, cmd);
        if (image_info) {
@@ -340,14 +352,14 @@ static splash_image_h __splash_screen_create_image(amd_appinfo_h ai,
 
        si = (struct splash_image_s *)calloc(1, sizeof(struct splash_image_s));
        if (si == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
        si->image = tizen_launch_effect_create_splash_img(
                        tz_launch_effect);
        if (si->image == NULL) {
-               LOGE("Failed to get launch image");
+               _E("Failed to get launch image");
                free(si);
                return NULL;
        }
@@ -355,7 +367,7 @@ static splash_image_h __splash_screen_create_image(amd_appinfo_h ai,
 
        si->src = strdup(src);
        if (si->src == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                __splash_screen_destroy_image(si);
                return NULL;
        }
@@ -365,14 +377,14 @@ static splash_image_h __splash_screen_create_image(amd_appinfo_h ai,
        else
                si->effect_type = strdup("launch");
        if (si->effect_type == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                __splash_screen_destroy_image(si);
                return NULL;
        }
 
        si->theme_type = strdup("default");
        if (si->theme_type == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                __splash_screen_destroy_image(si);
                return NULL;
        }
@@ -380,7 +392,7 @@ static splash_image_h __splash_screen_create_image(amd_appinfo_h ai,
        appid = amd_appinfo_get_value(ai, AMD_AIT_NAME);
        si->appid = strdup(appid);
        if (si->appid == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                __splash_screen_destroy_image(si);
                return NULL;
        }
@@ -408,7 +420,7 @@ static void __set_options(struct wl_array *options, const char *app_id)
 
        b = bundle_create();
        if (!b) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return;
        }
 
@@ -416,7 +428,7 @@ static void __set_options(struct wl_array *options, const char *app_id)
        ret = bundle_encode(b, &raw, &len);
        bundle_free(b);
        if (ret != BUNDLE_ERROR_NONE) {
-               LOGE("Failed to encode bundle. error(%d)", ret);
+               _E("Failed to encode bundle. error(%d)", ret);
                return;
        }
 
@@ -455,7 +467,7 @@ static void __splash_screen_send_image(splash_image_h si)
        wl_array_init(&extra_config);
        __set_extra_config(&extra_config, si->appid);
 
-       LOGD("src(%s), type(%d), color-depth(%d), rotation(%d), " \
+       _D("src(%s), type(%d), color-depth(%d), rotation(%d), " \
                        "indicator(%d), effect_type(%s)",
                        si->src, si->type, si->color_depth, si->rotation,
                        si->indicator, si->effect_type);
@@ -474,7 +486,7 @@ static void __splash_screen_send_pid(splash_image_h si, int pid)
        if (si == NULL)
                return;
 
-       LOGD("pid(%d)", pid);
+       _D("pid(%d)", pid);
        si->pid = pid;
        tizen_launch_splash_owner(si->image, pid);
        wl_display_flush(display);
@@ -503,14 +515,14 @@ static void __splash_screen_set_effect_type(int pid, const char *appid, bool is_
 
        b = bundle_create();
        if (b == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return;
        }
 
        bundle_add(b, AUL_K_APPID, appid);
        ret = bundle_encode(b, &raw_data, &len);
        if (ret != BUNDLE_ERROR_NONE) {
-               LOGE("Failed to encode bundle");
+               _E("Failed to encode bundle");
                bundle_free(b);
                return;
        }
@@ -521,7 +533,7 @@ static void __splash_screen_set_effect_type(int pid, const char *appid, bool is_
        memcpy(data, raw_data, size + 1);
        free(raw_data);
 
-       LOGD("effect_type(%s), pid(%d)", effect_type, pid);
+       _D("effect_type(%s), pid(%d)", effect_type, pid);
        tizen_launch_effect_type_set(tz_launch_effect, effect_type,
                        pid, &options);
        wl_display_flush(display);
@@ -534,13 +546,13 @@ static int __init_splash_screen(void)
        if (!display) {
                display = amd_wayland_get_display();
                if (!display) {
-                       LOGE("Failed to get display");
+                       _E("Failed to get display");
                        return -1;
                }
        }
 
        if (!tz_launch_effect) {
-               LOGE("Failed to bind tizen launch screen");
+               _E("Failed to bind tizen launch screen");
                return -1;
        }
 
@@ -575,14 +587,14 @@ static void __rotation_changed_cb(sensor_t sensor, unsigned int event_type,
                break;
        }
 
-       LOGD("angle: %d", rotation.angle);
+       _D("angle: %d", rotation.angle);
 }
 
 static void __auto_rotate_screen_cb(keynode_t *key, void *data)
 {
        rotation.auto_rotate = vconf_keynode_get_bool(key);
        if (!rotation.auto_rotate) {
-               LOGD("auto_rotate: %d, angle: %d",
+               _D("auto_rotate: %d, angle: %d",
                                rotation.auto_rotate, rotation.angle);
        }
 }
@@ -618,7 +630,7 @@ static int __init_rotation(void)
        if (!rotation.sensor) {
                rotation.sensor = sensord_get_sensor(AUTO_ROTATION_SENSOR);
                if (!rotation.sensor) {
-                       LOGE("Failed to get sensor. errno(%d)", errno);
+                       _E("Failed to get sensor. errno(%d)", errno);
                        return -1;
                }
        }
@@ -626,7 +638,7 @@ static int __init_rotation(void)
        rotation.angle = 0;
        rotation.handle = sensord_connect(rotation.sensor);
        if (rotation.handle < 0) {
-               LOGW("Failed to connect sensord");
+               _W("Failed to connect sensord");
                return -1;
        }
 
@@ -637,14 +649,14 @@ static int __init_rotation(void)
                        __rotation_changed_cb,
                        NULL);
        if (!r) {
-               LOGW("Failed to register event");
+               _W("Failed to register event");
                sensord_disconnect(rotation.handle);
                return -1;
        }
 
        r = sensord_start(rotation.handle, 0);
        if (!r) {
-               LOGW("Failed to start sensord");
+               _W("Failed to start sensord");
                sensord_unregister_event(rotation.handle,
                                AUTO_ROTATION_CHANGE_STATE_EVENT);
                sensord_disconnect(rotation.handle);
@@ -659,7 +671,7 @@ static int __init_rotation(void)
        ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL,
                        __auto_rotate_screen_cb, NULL);
        if (ret != 0) {
-               LOGW("Failed to register callback for %s",
+               _W("Failed to register callback for %s",
                                VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL);
        }
        rotation.initialized = true;
@@ -693,7 +705,7 @@ struct image_info_s *__create_image_info(void)
 
        info = (struct image_info_s *)calloc(1, sizeof(struct image_info_s));
        if (info == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
@@ -711,7 +723,7 @@ static int __validate_image_info(struct image_info_s *info)
                else
                        info->type = strdup("img");
                if (info->type == NULL) {
-                       LOGE("Out of memory");
+                       _E("Out of memory");
                        return -1;
                }
        }
@@ -719,7 +731,7 @@ static int __validate_image_info(struct image_info_s *info)
        if (!info->indicator_display) {
                info->indicator_display = strdup("true");
                if (info->indicator_display == NULL) {
-                       LOGE("Out of memory");
+                       _E("Out of memory");
                        return -1;
                }
        }
@@ -727,7 +739,7 @@ static int __validate_image_info(struct image_info_s *info)
        if (!info->color_depth) {
                info->color_depth = strdup("24");
                if (info->color_depth == NULL) {
-                       LOGE("Out of memory");
+                       _E("Out of memory");
                        return -1;
                }
        }
@@ -837,12 +849,12 @@ static int __on_launch_start(const char *msg, int arg1, int arg2, void *arg3,
 
        cur_splash_image = NULL;
        if (bundle_get_val(kb, AUL_K_MULTI_INSTANCE_SHORTCUT)) {
-               LOGW("Multiple instance shortcut");
+               _W("Multiple instance shortcut");
                return 0;
        }
 
        if (amd_launch_context_is_bg_launch(h)) {
-               LOGW("Background launch");
+               _W("Background launch");
                return 0;
        }
 
@@ -909,7 +921,7 @@ static int __on_wl_listener(const char *msg, int arg1, int arg2, void *arg3,
                tz_launch_effect_id = id;
                tz_launch_effect = wl_registry_bind(registry, id,
                                &tizen_launch_effect_interface, 1);
-               LOGD("tz_launch_effect(%p)", tz_launch_effect);
+               _D("tz_launch_effect(%p)", tz_launch_effect);
        }
 
        return 0;
@@ -925,7 +937,7 @@ static int __on_wl_listener_remove(const char *msg, int arg1, int arg2,
                tz_launch_effect = NULL;
                tz_launch_effect_id = 0;
                splash_screen_initialized = 0;
-               LOGW("tizen launch effect is destroyed");
+               _W("tizen launch effect is destroyed");
        }
 
        return 0;
@@ -937,11 +949,11 @@ static void __charger_status_changed_cb(keynode_t *keynode, void *user_data)
                rotation.charger_status = vconf_keynode_get_int(keynode);
                if (rotation.charger_status) {
                        if (__init_rotation() < 0)
-                               LOGW("Failed to initialize rotation");
+                               _W("Failed to initialize rotation");
                } else {
                        __fini_rotation();
                }
-               LOGD("charger status(%d)", rotation.charger_status);
+               _D("charger status(%d)", rotation.charger_status);
        }
 }
 
@@ -953,24 +965,24 @@ static gboolean __rotation_init_handler(gpointer data)
                r = vconf_get_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
                                &rotation.charger_status);
                if (r < 0) {
-                       LOGW("Failed to get charger status");
+                       _W("Failed to get charger status");
                        return G_SOURCE_CONTINUE;
                }
 
                r = vconf_notify_key_changed(VCONFKEY_SYSMAN_CHARGER_STATUS,
                                __charger_status_changed_cb, NULL);
                if (r < 0) {
-                       LOGW("Failed to register vconf cb");
+                       _W("Failed to register vconf cb");
                        return G_SOURCE_CONTINUE;
                }
 
                if (rotation.charger_status) {
                        if (__init_rotation() < 0)
-                               LOGW("Failed to initialize rotation");
+                               _W("Failed to initialize rotation");
                }
        } else {
                if (__init_rotation() < 0)
-                       LOGW("Failed to initialize rotation");
+                       _W("Failed to initialize rotation");
        }
 
        rotation.timer = 0;
@@ -979,7 +991,7 @@ static gboolean __rotation_init_handler(gpointer data)
 
 EXPORT int AMD_MOD_INIT(void)
 {
-       LOGD("splash screen init");
+       _D("splash screen init");
 
        __load_splash_screen_info(SPLASH_SCREEN_INFO_PATH);
 
@@ -1003,7 +1015,7 @@ EXPORT int AMD_MOD_INIT(void)
 
 EXPORT void AMD_MOD_FINI(void)
 {
-       LOGD("splash screen finish");
+       _D("splash screen finish");
 
        if (rotation.timer)
                g_source_remove(rotation.timer);
diff --git a/modules/ui-core/inc/app_group_private.h b/modules/ui-core/inc/app_group_private.h
new file mode 100644 (file)
index 0000000..bf105e2
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "AMD_APP_GROUP"
index 0c3dc6f10af2da41dc5d6da13ce4bc8ed6b032a6..31b81cae90e41e5e444e2ffa52f154f7f0c5ef97 100644 (file)
 #include <aul.h>
 #include <aul_sock.h>
 #include <aul_screen_connector.h>
+#include <amd.h>
+#include <amd_mod_common.h>
 
-#include "amd.h"
 #include "amd_screen_connector.h"
 #include "app_group.h"
 #include "status.h"
 
 #define SUSPEND_INTERVAL 5 /* sec */
+
+#ifdef LOG_TAG
 #undef LOG_TAG
+#endif
 #define LOG_TAG "AMD_SCREEN_CONNECTOR"
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 struct app_screen_s {
        char *appid;
@@ -73,20 +76,20 @@ static struct app_screen_s *__create_app_screen(int pid, uid_t uid,
 
        app_screen = calloc(1, sizeof(struct app_screen_s));
        if (app_screen == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
        app_screen->appid = strdup(appid);
        if (app_screen->appid == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                free(app_screen);
                return NULL;
        }
 
        app_screen->instance_id = strdup(instance_id);
        if (app_screen->instance_id == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                free(app_screen->appid);
                free(app_screen);
                return NULL;
@@ -171,7 +174,7 @@ static struct viewer_info_s *__create_viewer_info(int pid, int screen_type,
 
        viewer_info = calloc(1, sizeof(struct viewer_info_s));
        if (viewer_info == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
@@ -205,7 +208,7 @@ static struct user_info_s *__create_user_info(uid_t uid)
 
        user_info = malloc(sizeof(struct user_info_s));
        if (user_info == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
@@ -224,7 +227,7 @@ static bundle *__create_bundle(struct app_screen_s *app_screen,
 
        b = bundle_create();
        if (b == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return NULL;
        }
 
@@ -246,7 +249,7 @@ static void __send_app_screen_event(struct viewer_info_s *viewer_info,
 
        b = __create_bundle(app_screen, event);
        if (b == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return;
        }
 
@@ -395,7 +398,7 @@ static int __get_pid_by_surf(int pid, unsigned int surf)
                node = __find_app_group_node_by_pid(pids[i]);
                wid = (unsigned int)_app_group_node_get_window(node);
                if (wid == surf) {
-                       LOGD("pid(%d), surf(%u)", pids[i], surf);
+                       _D("pid(%d), surf(%u)", pids[i], surf);
                        pid = pids[i];
                }
        }
@@ -413,7 +416,7 @@ static gboolean __suspend_timer(gpointer data)
                return FALSE;
 
        ret = amd_suspend_update_status(pid, AMD_SUSPEND_STATUS_INCLUDE);
-       LOGD("pid(%d), result(%d)", pid, ret);
+       _D("pid(%d), result(%d)", pid, ret);
 
        return FALSE;
 }
@@ -479,7 +482,7 @@ static int __send_viewer_visibility_to_provider(const char *provider_appid,
 
        b = bundle_create();
        if (b == NULL) {
-               LOGE("out of memory");
+               _E("out of memory");
                return -1;
        }
 
@@ -487,7 +490,7 @@ static int __send_viewer_visibility_to_provider(const char *provider_appid,
                        &status, sizeof(aul_screen_status_e));
        amd_app_com_send(provider_appid, viewer_pid, b, viewer_uid);
        bundle_free(b);
-       LOGD("send viewer status to %s(%d)", provider_appid, status);
+       _D("send viewer status to %s(%d)", provider_appid, status);
 
        return 0;
 }
@@ -526,7 +529,7 @@ static int __screen_connector_update_screen_viewer_status(int pid, int status,
        if (status != AUL_SCREEN_STATUS_PRE_RESUME)
                viewer_info->status = status;
        else
-               LOGW("pre resume status will not be stored as a viewer status");
+               _W("pre resume status will not be stored as a viewer status");
 
        found = g_list_find_custom(user_info->app_screen_list,
                        GUINT_TO_POINTER(surf), __compare_app_screen_surf);
@@ -556,7 +559,7 @@ static int __screen_connector_update_screen_viewer_status(int pid, int status,
                                 * viewer pause event to provider
                                 */
                                send_pause = false;
-                               LOGW("Skip pause : viewer pid(%d), status(%d)",
+                               _W("Skip pause : viewer pid(%d), status(%d)",
                                        viewer_info->pid, viewer_info->status);
                                break;
                        }
@@ -571,7 +574,7 @@ static int __screen_connector_update_screen_viewer_status(int pid, int status,
                __send_viewer_visibility_to_provider(app_screen->appid, status,
                                pid, uid);
        } else {
-               LOGW("Unknown status(%d)", status);
+               _W("Unknown status(%d)", status);
        }
 
        return 0;
@@ -626,13 +629,13 @@ static int __screen_connector_send_update_request(const char *appid,
        ret = aul_sock_send_raw(pid, uid, APP_UPDATE_REQUESTED,
                        (unsigned char *)&dummy, 0, AUL_SOCK_NOREPLY);
        if (ret < 0) {
-               LOGE("Failed to send the update request");
+               _E("Failed to send the update request");
                amd_suspend_update_status(pid, AMD_SUSPEND_STATUS_INCLUDE);
                return -1;
        }
        g_timeout_add_seconds(SUSPEND_INTERVAL, __suspend_timer,
                        GINT_TO_POINTER(pid));
-       LOGD("pid(%d), uid(%d)", pid, uid);
+       _D("pid(%d), uid(%d)", pid, uid);
 
        return 0;
 }
@@ -672,7 +675,7 @@ int _screen_connector_add_app_screen(int pid, unsigned int surf,
 
        app_status = amd_app_status_find_by_pid(pid);
        if (app_status == NULL) {
-               LOGW("Failed to find app status info - pid(%d), uid(%d)",
+               _W("Failed to find app status info - pid(%d), uid(%d)",
                                pid, uid);
                return -1;
        }
@@ -689,14 +692,14 @@ int _screen_connector_add_app_screen(int pid, unsigned int surf,
        if (found) {
                app_screen = (struct app_screen_s *)found->data;
                if (app_screen->surf == surf) {
-                       LOGD("Already exists");
+                       _D("Already exists");
                        return 0;
                }
 
                app_screen->surf = surf;
                g_list_foreach(user_info->screen_viewer_list,
                                __send_app_screen_updated, app_screen);
-               LOGW("surf is changed to %u", surf);
+               _W("surf is changed to %u", surf);
                return 0;
        }
 
@@ -712,7 +715,7 @@ int _screen_connector_add_app_screen(int pid, unsigned int surf,
                        app_screen);
        g_list_foreach(user_info->screen_viewer_list,
                        __send_app_screen_added, app_screen);
-       LOGD("pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
+       _D("pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
 
        return 0;
 }
@@ -748,7 +751,7 @@ static int __screen_connector_remove_app_screen(int pid,
 
        app_status = amd_app_status_find_by_pid(pid);
        if (app_status == NULL) {
-               LOGW("Failed to find app status info - pid(%d), uid(%d)",
+               _W("Failed to find app status info - pid(%d), uid(%d)",
                                pid, uid);
                return -1;
        }
@@ -773,7 +776,7 @@ static int __screen_connector_remove_app_screen(int pid,
        if (user_info->last_focused_app_screen == app_screen)
                user_info->last_focused_app_screen = NULL;
 
-       LOGD("pid(%d), instance_id(%s)", pid, instance_id);
+       _D("pid(%d), instance_id(%s)", pid, instance_id);
 
        return 0;
 }
@@ -822,7 +825,7 @@ static int __screen_connector_update_app_screen(int pid, unsigned int surf,
 
        app_status = amd_app_status_find_by_pid(pid);
        if (app_status == NULL) {
-               LOGW("Failed to find app status info - pid(%d), uid(%d)",
+               _W("Failed to find app status info - pid(%d), uid(%d)",
                                pid, uid);
                return -1;
        }
@@ -845,7 +848,7 @@ static int __screen_connector_update_app_screen(int pid, unsigned int surf,
        app_screen->surf = surf;
        g_list_foreach(user_info->screen_viewer_list,
                        __send_app_screen_updated, app_screen);
-       LOGD("pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
+       _D("pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
 
        return 0;
 }
@@ -880,7 +883,7 @@ static int __screen_connector_focus_app_screen(int pid, unsigned int surf,
 
        app_status = amd_app_status_find_by_pid(pid);
        if (app_status == NULL) {
-               LOGW("Failed to find app status info - pid(%d), uid(%d)",
+               _W("Failed to find app status info - pid(%d), uid(%d)",
                                pid, uid);
                return -1;
        }
@@ -902,7 +905,7 @@ static int __screen_connector_focus_app_screen(int pid, unsigned int surf,
 
        g_list_foreach(user_info->screen_viewer_list,
                        __send_app_screen_focused, app_screen);
-       LOGD("focus pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
+       _D("focus pid(%d), appid(%s), surf(%d), uid(%d)", pid, appid, surf, uid);
 
        return 0;
 }
@@ -922,7 +925,7 @@ static int __screen_connector_remove_app_screen_v2(int pid, uid_t uid)
                app_screen = (struct app_screen_s *)iter->data;
                iter = g_list_next(iter);
                if (app_screen && app_screen->pid == pid) {
-                       LOGD("pid(%d), surf(%d)", pid, app_screen->surf);
+                       _D("pid(%d), surf(%d)", pid, app_screen->surf);
                        g_list_foreach(user_info->screen_viewer_list,
                                        __send_app_screen_removed, app_screen);
                        user_info->app_screen_list = g_list_remove(
@@ -955,7 +958,7 @@ static int __screen_connector_add_screen_viewer(int pid, int screen_type,
 
        user_info = g_hash_table_lookup(user_table, GUINT_TO_POINTER(uid));
        if (user_info == NULL) {
-               LOGW("user info is empty");
+               _W("user info is empty");
                return -1;
        }
 
@@ -966,7 +969,7 @@ static int __screen_connector_add_screen_viewer(int pid, int screen_type,
        list = g_list_find_custom(user_info->screen_viewer_list, viewer_info,
                        __compare_viewers);
        if (list) {
-               LOGD("Already exists");
+               _D("Already exists");
                __destroy_viewer_info(viewer_info);
                return 0;
        }
@@ -976,7 +979,7 @@ static int __screen_connector_add_screen_viewer(int pid, int screen_type,
 
        g_list_foreach(user_info->app_screen_list,
                        __foreach_app_screen_list, viewer_info);
-       LOGD("pid(%d), screen_type(%d), private(%d), ref(%u), uid(%d)",
+       _D("pid(%d), screen_type(%d), private(%d), ref(%u), uid(%d)",
                        pid, screen_type, priv, ref, uid);
 
        return 0;
@@ -991,7 +994,7 @@ static int __screen_connector_remove_screen_viewer(int pid, int screen_type,
 
        user_info = g_hash_table_lookup(user_table, GUINT_TO_POINTER(uid));
        if (user_info == NULL) {
-               LOGW("user info is empty");
+               _W("user info is empty");
                return -1;
        }
 
@@ -1014,7 +1017,7 @@ static int __screen_connector_remove_screen_viewer(int pid, int screen_type,
                }
        }
 
-       LOGD("pid(%d), screen_type(%d), private(%d), ref(%u) uid(%d)",
+       _D("pid(%d), screen_type(%d), private(%d), ref(%u) uid(%d)",
                        pid, screen_type, priv, ref, uid);
 
        return 0;
@@ -1028,7 +1031,7 @@ static int __screen_connector_remove_screen_viewer_v2(int pid, uid_t uid)
 
        user_info = g_hash_table_lookup(user_table, GUINT_TO_POINTER(uid));
        if (user_info == NULL) {
-               LOGW("user info is empty");
+               _W("user info is empty");
                return -1;
        }
 
@@ -1053,7 +1056,7 @@ static int __screen_connector_usr_init(uid_t uid)
 
        user_info = g_hash_table_lookup(user_table, GUINT_TO_POINTER(uid));
        if (user_info) {
-               LOGE("Already exists");
+               _E("Already exists");
                return 0;
        }
 
@@ -1092,7 +1095,7 @@ static int __dispatch_add_app_screen(amd_request_h req)
        surf = atol(value);
        ret = _screen_connector_add_app_screen(pid, surf,
                        instance_id, uid);
-       LOGD("pid(%d), surf(%d), instance_id(%s), result(%d)",
+       _D("pid(%d), surf(%d), instance_id(%s), result(%d)",
                        pid, surf, instance_id, ret);
 
        return 0;
@@ -1112,7 +1115,7 @@ static int __dispatch_remove_app_screen(amd_request_h req)
        instance_id = bundle_get_val(b, AUL_K_INSTANCE_ID);
        ret = __screen_connector_remove_app_screen(pid,
                        instance_id, uid);
-       LOGD("pid(%d), instance_id(%s), result(%d)",
+       _D("pid(%d), instance_id(%s), result(%d)",
                        pid, instance_id, ret);
 
        return 0;
@@ -1136,7 +1139,7 @@ static int __dispatch_app_update_requested(amd_request_h req)
 
        instance_id = bundle_get_val(b, AUL_K_INSTANCE_ID);
        ret = __screen_connector_send_update_request(appid, instance_id, uid);
-       LOGD("appid(%s), instance_id(%s), caller_pid(%d), result(%d)",
+       _D("appid(%s), instance_id(%s), caller_pid(%d), result(%d)",
                        appid, instance_id, caller_pid, ret);
 
        return 0;
@@ -1174,7 +1177,7 @@ static int __dispatch_add_screen_viewer(amd_request_h req)
 
        ret = __screen_connector_add_screen_viewer(pid, screen_type,
                        priv, ref, uid);
-       LOGD("pid(%d), screen_type(%d), private(%d), result(%d)",
+       _D("pid(%d), screen_type(%d), private(%d), result(%d)",
                        pid, screen_type, priv, ret);
 
        return 0;
@@ -1212,7 +1215,7 @@ static int __dispatch_remove_screen_viewer(amd_request_h req)
 
        ret = __screen_connector_remove_screen_viewer(pid, screen_type,
                        priv, ref, uid);
-       LOGD("pid(%d), screen_type(%d), private(%d), result(%d)",
+       _D("pid(%d), screen_type(%d), private(%d), result(%d)",
                        pid, screen_type, priv, ret);
 
        return 0;
@@ -1226,13 +1229,13 @@ static int __screen_connector_checker(amd_cynara_caller_info_h info,
        int type;
 
        if (b == NULL) {
-               LOGE("Empty bundle data !!");
+               _E("Empty bundle data !!");
                return -1;
        }
 
        type_str = bundle_get_val(b, AUL_K_SCREEN_TYPE);
        if (type_str == NULL) {
-               LOGE("Cannot get screen type !!");
+               _E("Cannot get screen type !!");
                return -1;
        }
 
@@ -1259,21 +1262,21 @@ static int __dispatch_app_get_appid_by_surface_id(amd_request_h req)
 
        bundle_get_byte(b, "__AUL_SC_SURFACE__", (void **)&surf, &size);
        if (surf == NULL) {
-               LOGE("Failed to get surface");
+               _E("Failed to get surface");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        appid = __screen_connector_get_appid_by_surface_id(*surf, uid);
        if (appid == NULL) {
-               LOGE("Failed to get appid");
+               _E("Failed to get appid");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        ret_b = bundle_create();
        if (ret_b == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -1302,7 +1305,7 @@ static int __dispatch_app_get_instance_id_by_surface_id(amd_request_h req)
 
        bundle_get_byte(b, "__AUL_SC_SURFACE__", (void **)&surf, &size);
        if (surf == NULL) {
-               LOGE("Failed to get surface");
+               _E("Failed to get surface");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -1310,14 +1313,14 @@ static int __dispatch_app_get_instance_id_by_surface_id(amd_request_h req)
        instance_id = __screen_connector_get_instance_id_by_surface_id(*surf,
                        uid);
        if (instance_id == NULL) {
-               LOGE("Failed to get instance_id");
+               _E("Failed to get instance_id");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        ret_b = bundle_create();
        if (ret_b == NULL) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -1343,7 +1346,7 @@ static int __dispatch_trigger_focused_force(amd_request_h req)
                return -1;
 
        if (user_info->last_focused_app_screen == NULL) {
-               LOGE("requested bad focused screen");
+               _E("requested bad focused screen");
                return -1;
        }
 
@@ -1377,7 +1380,7 @@ static int __dispatch_update_screen_viewer_status(amd_request_h req)
 
        val = bundle_get_val(b, "__AUL_SC_VIEWER_STATUS__");
        if (val == NULL || !isdigit(*val)) {
-               LOGE("Failed to get viewer status");
+               _E("Failed to get viewer status");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -1386,7 +1389,7 @@ static int __dispatch_update_screen_viewer_status(amd_request_h req)
 
        val = bundle_get_val(b, AUL_K_WID);
        if (val == NULL || !isdigit(*val)) {
-               LOGE("Failed to get surface id");
+               _E("Failed to get surface id");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -1566,26 +1569,26 @@ int _screen_connector_init(void)
 {
        int r;
 
-       LOGD("screen connector init");
+       _D("screen connector init");
 
        user_table = g_hash_table_new_full(g_direct_hash, g_direct_equal,
                        NULL, __destroy_user_info);
        if (user_table == NULL) {
-               LOGE("Failed to create user table");
+               _E("Failed to create user table");
                return -1;
        }
 
        r = amd_request_register_cmds(__dispatch_table,
                        ARRAY_SIZE(__dispatch_table));
        if (r < 0) {
-               LOGE("Failed to register cmds");
+               _E("Failed to register cmds");
                return -1;
        }
 
        r = amd_cynara_register_checkers(__cynara_checkers,
                        ARRAY_SIZE(__cynara_checkers));
        if (r < 0) {
-               LOGE("Failed to register checkers");
+               _E("Failed to register checkers");
                return -1;
        }
 
@@ -1613,7 +1616,7 @@ int _screen_connector_init(void)
 
 void _screen_connector_fini(void)
 {
-       LOGD("screen connector fini");
+       _D("screen connector fini");
 
        if (user_table)
                g_hash_table_destroy(user_table);
index edd059ea4eb28e2f474786a4f027413bfc38131f..b56cefd89c8b20dca7d536b311b99bb32a9a6b8d 100644 (file)
 #include <aul_sock.h>
 #include <system_info.h>
 #include <aul_comp_types.h>
-
 #include <amd.h>
 
 #include "amd_screen_connector.h"
 #include "app_group.h"
 #include "app_group_wayland.h"
 #include "app_group_request.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "AMD_APP_GROUP"
+#include "app_group_private.h"
 
 #define APP_SVC_K_LAUNCH_MODE   "__APP_SVC_LAUNCH_MODE__"
 #define STATUS_FOREGROUND "fg"
@@ -122,20 +116,20 @@ static struct app_group_context_s *__create_app_group_context(
 
        ctx = calloc(1, sizeof(struct app_group_context_s));
        if (!ctx) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return NULL;
        }
 
        ctx->id = strdup(id);
        if (!ctx->id) {
-               LOGE("Failed to duplicate ID(%s)", id);
+               _E("Failed to duplicate ID(%s)", id);
                free(ctx);
                return NULL;
        }
 
        ctx->caller_id = strdup(caller_id ? caller_id : "NULL");
        if (!ctx->caller_id) {
-               LOGE("Failed to duplicate caller ID(%s)", caller_id);
+               _E("Failed to duplicate caller ID(%s)", caller_id);
                __destroy_app_group_context(ctx);
                return NULL;
        }
@@ -171,13 +165,13 @@ static struct app_group_s *__create_app_group(const char *leader_id,
 
        group = calloc(1, sizeof(struct app_group_s));
        if (!group) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return NULL;
        }
 
        group->leader_id = strdup(leader_id);
        if (!group->leader_id) {
-               LOGE("Failed to duplicate leader ID");
+               _E("Failed to duplicate leader ID");
                free(group);
                return NULL;
        }
@@ -210,13 +204,13 @@ const char *_app_group_get_id(pid_t pid)
 
        app_status = amd_app_status_find_by_effective_pid(pid);
        if (!app_status) {
-               LOGE("Failed to find app status. pid(%d)", pid);
+               _E("Failed to find app status. pid(%d)", pid);
                return NULL;
        }
 
        app_type = amd_app_status_get_app_type(app_status);
        if (app_type == AMD_AT_COMPONENT_BASED_APP) {
-               LOGE("The type of the application(%d) is component-based", pid);
+               _E("The type of the application(%d) is component-based", pid);
                return NULL;
        }
 
@@ -255,7 +249,7 @@ app_group_node_h _app_group_node_find(const char *id)
        GList *iter;
 
        if (!id) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return NULL;
        }
 
@@ -280,7 +274,7 @@ app_group_h _app_group_find(const char *id)
        GList *iter;
 
        if (!id) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return NULL;
        }
 
@@ -363,7 +357,7 @@ int _app_group_node_set_window(app_group_node_h node, int wid)
        amd_comp_status_h comp = NULL;
 
        if (!node) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return -1;
        }
 
@@ -440,7 +434,7 @@ app_group_node_h _app_group_node_add_node(app_group_node_h node)
        new_ctx = __create_app_group_context(ctx->pid, ctx->id, ctx->caller_pid,
                        ctx->caller_id, ctx->launch_mode, ctx->can_shift, true);
        if (!new_ctx) {
-               LOGE("Failed to create app group context. %s:%d",
+               _E("Failed to create app group context. %s:%d",
                                ctx->id, ctx->pid);
                return NULL;
        }
@@ -481,7 +475,7 @@ static bool __app_group_node_is_leader(app_group_node_h node)
 
        ctx = (struct app_group_context_s *)node->data;
        if (!ctx) {
-               LOGE("App group context is nullptr");
+               _E("App group context is nullptr");
                return false;
        }
 
@@ -506,7 +500,7 @@ static app_group_node_h __app_group_node_find_second_leader(const char *id)
        if (node) {
                ctx = (struct app_group_context_s *)node->data;
                if (ctx && ctx->can_be_leader) {
-                       LOGW("Sencond leader. leader_id(%s), id(%s)",
+                       _W("Sencond leader. leader_id(%s), id(%s)",
                                        id, ctx->id);
                        return node;
                }
@@ -525,13 +519,13 @@ static void __app_group_remove(app_group_node_h node)
 
        ctx = (struct app_group_context_s *)node->data;
        if (!ctx) {
-               LOGE("App group context is nullptr");
+               _E("App group context is nullptr");
                return;
        }
 
        group = _app_group_find(ctx->id);
        if (!group) {
-               LOGE("Failed to find app group. %s", ctx->id);
+               _E("Failed to find app group. %s", ctx->id);
                return;
        }
 
@@ -712,7 +706,7 @@ static void __app_group_node_reroute(app_group_node_h node)
        if (!next_wid)
                return;
 
-       LOGD("Reroute");
+       _D("Reroute");
        _app_group_wayland_attach_window(prev_wid, next_wid);
 }
 
@@ -737,12 +731,12 @@ static void __app_group_node_remove_full(app_group_node_h node, uid_t uid)
 
        ctx = (struct app_group_context_s *)node->data;
        if (!ctx) {
-               LOGE("App group context is nullptr");
+               _E("App group context is nullptr");
                return;
        }
 
        if (__app_group_node_is_leader(node)) {
-               LOGW("App group leader. %s:%d", ctx->id, ctx->pid);
+               _W("App group leader. %s:%d", ctx->id, ctx->pid);
                if (!__app_group_node_find_second_leader(ctx->id)) {
                        _app_group_node_clear_top(node, uid);
                        __app_group_node_remove(node);
@@ -750,14 +744,14 @@ static void __app_group_node_remove_full(app_group_node_h node, uid_t uid)
                        __app_group_node_remove_leader(ctx->id);
                }
        } else if (__app_group_node_is_sub(node)) {
-               LOGW("App group Sub. %s:%d", ctx->id, ctx->pid);
+               _W("App group Sub. %s:%d", ctx->id, ctx->pid);
                caller_id = __app_group_node_get_next_caller_id(node);
                if (__app_group_node_can_reroute(node) ||
                        (caller_id && strcmp(caller_id, ctx->id) != 0)) {
-                       LOGW("App group reroute");
+                       _W("App group reroute");
                        __app_group_node_reroute(node);
                } else {
-                       LOGW("App group clear top");
+                       _W("App group clear top");
                        _app_group_node_clear_top(node, uid);
                }
                __app_group_node_remove(node);
@@ -819,7 +813,7 @@ static struct app_group_context_s *__app_group_add(
        int pos = -1;
 
        if (!id || !leader_id) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return NULL;
        }
 
@@ -828,7 +822,7 @@ static struct app_group_context_s *__app_group_add(
                ctx = __create_app_group_context(pid, id, caller_pid, caller_id,
                                launch_mode, can_shift, recycle);
                if (!ctx) {
-                       LOGE("Failed to create app group context. %s:%d",
+                       _E("Failed to create app group context. %s:%d",
                                        id, pid);
                        return NULL;
                }
@@ -844,7 +838,7 @@ static struct app_group_context_s *__app_group_add(
        if (!found) {
                group = __create_app_group(leader_id, leader_pid);
                if (!group) {
-                       LOGE("Failed to create app group. %s:%d",
+                       _E("Failed to create app group. %s:%d",
                                        leader_id, leader_pid);
                        __destroy_app_group_context(ctx);
                        return NULL;
@@ -859,7 +853,7 @@ static struct app_group_context_s *__app_group_add(
 
        node = g_list_find_custom(group->list, id, __compare_context_id);
        if (node) {
-               LOGE("Already exists. %s:%d", id, pid);
+               _E("Already exists. %s:%d", id, pid);
                __destroy_app_group_context(ctx);
                return NULL;
        }
@@ -910,7 +904,7 @@ static void __app_group_start(pid_t leader_pid, const char *leader_id,
        struct app_group_context_s *ctx;
        int before_wid = 0;
 
-       LOGD("app_group_start");
+       _D("app_group_start");
 
        caller_pid = __get_caller_pid(b);
        caller_id = __get_caller_id(b);
@@ -959,7 +953,7 @@ static void __app_group_context_do_recycle(struct app_group_context_s *ctx)
                pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
                comp_type = amd_appinfo_get_value(ai, AMD_AIT_COMPTYPE);
 
-               LOGD("Send BG signal %s:%s", appid, comp_type);
+               _D("Send BG signal %s:%s", appid, comp_type);
                aul_send_app_status_change_signal(ctx->pid, appid, pkgid,
                                STATUS_BACKGROUND, comp_type);
                amd_app_status_find_service_apps(app_status, STATUS_BG,
@@ -1013,7 +1007,7 @@ static void __app_group_restart(const char *id, bundle *b)
        app_group_node_h caller_node;
 
        if (!id || !b) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return;
        }
 
@@ -1054,7 +1048,7 @@ static void __app_group_restart(const char *id, bundle *b)
                                _app_group_wayland_attach_window(caller_wid,
                                                ctx->wid);
                        } else {
-                               LOGE("Invalid caller window id");
+                               _E("Invalid caller window id");
                        }
                }
        }
@@ -1113,7 +1107,7 @@ static void __app_group_restart_recycle_bin(const char *leader_id,
                if (!found) {
                        group = __create_app_group(ctx->id, ctx->pid);
                        if (!group) {
-                               LOGE("Failed to create app group. %s:%d",
+                               _E("Failed to create app group. %s:%d",
                                                ctx->id, ctx->pid);
                                __app_group_context_do_recycle(ctx);
                                return;
@@ -1148,11 +1142,11 @@ static void __prepare_to_wake(int pid, uid_t uid)
        ret = aul_sock_send_raw(pid, uid, APP_SUSPEND, (unsigned char *)&dummy,
                        sizeof(int), AUL_SOCK_NOREPLY);
        if (ret < 0) {
-               LOGE("Failed to send suspend signal. pid(%d), result(%d)",
+               _E("Failed to send suspend signal. pid(%d), result(%d)",
                                pid, ret);
        }
 
-       LOGD("[__APP_SUSPEND__] pid: %d, uid: %d", pid, uid);
+       _D("[__APP_SUSPEND__] pid: %d, uid: %d", pid, uid);
 }
 
 static void __prepare_to_suspend(int pid, uid_t uid)
@@ -1163,11 +1157,11 @@ static void __prepare_to_suspend(int pid, uid_t uid)
        ret = aul_sock_send_raw(pid, uid, APP_WAKE, (unsigned char *)&dummy,
                        sizeof(int), AUL_SOCK_NOREPLY);
        if (ret < 0) {
-               LOGE("Failed to send wake signal. pid(%d), result(%d)",
+               _E("Failed to send wake signal. pid(%d), result(%d)",
                                pid, ret);
        }
 
-       LOGD("[__APP_WAKE__] pid: %d, uid: %d", pid, uid);
+       _D("[__APP_WAKE__] pid: %d, uid: %d", pid, uid);
 }
 
 static void __app_group_send_status(pid_t pid, bool flag, bool force, bool self)
@@ -1182,7 +1176,7 @@ static void __app_group_send_status(pid_t pid, bool flag, bool force, bool self)
 
        app_status = amd_app_status_find_by_effective_pid(pid);
        if (!app_status) {
-               LOGE("Failed to find app status. pid(%d)", pid);
+               _E("Failed to find app status. pid(%d)", pid);
                return;
        }
 
@@ -1191,7 +1185,7 @@ static void __app_group_send_status(pid_t pid, bool flag, bool force, bool self)
 
        ai = amd_appinfo_find(uid, appid);
        if (!ai) {
-               LOGE("Failed to find appinfo. %s:%d", appid, uid);
+               _E("Failed to find appinfo. %s:%d", appid, uid);
                return;
        }
 
@@ -1199,7 +1193,7 @@ static void __app_group_send_status(pid_t pid, bool flag, bool force, bool self)
        bg_allowed = amd_suspend_is_allowed_background(ai);
        excluded = amd_suspend_is_excluded(pid);
 
-       LOGD("Send %s signal %s", flag ? "FG" : "BG", appid);
+       _D("Send %s signal %s", flag ? "FG" : "BG", appid);
        aul_send_app_status_change_signal(pid, appid, pkgid,
                        flag ? STATUS_FOREGROUND : STATUS_BACKGROUND,
                        APP_TYPE_UI);
@@ -1300,7 +1294,7 @@ static bool __app_group_can_attach_window(bundle *b, const char *appid,
 
        switch (*launch_mode) {
        case APP_GROUP_LAUNCH_MODE_CALLER:
-               LOGD("Launch mode is caller");
+               _D("Launch mode is caller");
                str = bundle_get_val(b, APP_SVC_K_LAUNCH_MODE);
                if (str && !strcmp(str, "group"))
                        return true;
@@ -1407,7 +1401,7 @@ void _app_group_get_leader_pids(int *cnt, pid_t **pids)
        if (size > 0) {
                leader_pids = (pid_t *)calloc(size, sizeof(pid_t));
                if (!leader_pids) {
-                       LOGE("Out of memory");
+                       _E("Out of memory");
                        return;
                }
 
@@ -1439,7 +1433,7 @@ char **_app_group_get_leader_ids(int *cnt)
 
        leader_ids = (char **)calloc(size + 1, sizeof(char *));
        if (!leader_ids) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return NULL;
        }
 
@@ -1505,7 +1499,7 @@ void _app_group_get_group_pids(app_group_h group, int *cnt, pid_t **pids)
 
        group_pids = calloc(size, sizeof(pid_t));
        if (!group_pids) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return;
        }
 
@@ -1542,7 +1536,7 @@ static void __app_group_context_set_status(struct app_group_context_s *ctx,
                        if (!ctx->group_sig && leader_pid != pid) {
                                app_status = amd_app_status_find_by_pid(pid);
                                pkgid = amd_app_status_get_pkgid(app_status);
-                               LOGD("Send group signal %d", pid);
+                               _D("Send group signal %d", pid);
                                aul_send_app_group_signal(leader_pid, pid,
                                                pkgid);
                                ctx->group_sig = true;
@@ -1617,7 +1611,7 @@ static int __app_group_can_start(const char *appid, bundle *b,
                if (!caller_id) {
                        caller_id = _app_group_get_id(caller_pid);
                        if (!caller_id) {
-                               LOGE("Failed to get caller id. %d", caller_pid);
+                               _E("Failed to get caller id. %d", caller_pid);
                                ret = -1;
                                goto end;
                        }
@@ -1630,7 +1624,7 @@ static int __app_group_can_start(const char *appid, bundle *b,
                        node = _app_group_node_find(caller_id);
                        caller_wid = _app_group_node_get_window(node);
                        if (caller_wid == 0) {
-                               LOGW("Caller(%d) window isn't ready",
+                               _W("Caller(%d) window isn't ready",
                                                caller_pid);
                                if (__app_group_can_be_leader(b))
                                        *can_attach = false;
@@ -1638,7 +1632,7 @@ static int __app_group_can_start(const char *appid, bundle *b,
                                        *can_attach = true;
                        }
                } else {
-                       LOGE("Cannot find leader pid");
+                       _E("Cannot find leader pid");
                        if (__app_group_can_be_leader(b)) {
                                *can_attach = false;
                        } else {
@@ -1654,7 +1648,7 @@ end:
        __launch_context.leader_pid = *leader_pid;
        __launch_context.leader_id = leader_id;
 
-       LOGW("[__APP_GROUP__] can_attach(%d), mode(%d), leader(%s:%d)",
+       _W("[__APP_GROUP__] can_attach(%d), mode(%d), leader(%s:%d)",
                        __launch_context.can_attach,
                        __launch_context.mode,
                        __launch_context.leader_id ? __launch_context.leader_id : "null",
@@ -1703,7 +1697,7 @@ void _app_group_get_idle_pids(int *cnt, pid_t **pids)
 
        idle_pids = calloc(size, sizeof(pid_t));
        if (!idle_pids) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return;
        }
 
@@ -1886,12 +1880,12 @@ static int __app_group_prepare(int status, uid_t uid, amd_launch_context_h h,
                ret = __app_group_can_start(appid, kb, &can_attach,
                                &leader_pid, &launch_mode, uid);
                if (ret != 0) {
-                       LOGE("Can't make group info");
+                       _E("Can't make group info");
                        return -1;
                }
 
                if (can_attach && leader_pid == -1) {
-                       LOGE("Can't launch singleton app in the same group");
+                       _E("Can't launch singleton app in the same group");
                        return -1;
                }
        }
@@ -2202,7 +2196,7 @@ static int __on_launch_complete_end(const char *msg, int arg1, int arg2,
        }
 
        if (!id) {
-               LOGE("Failed to get id. pid(%d)", pid);
+               _E("Failed to get id. pid(%d)", pid);
                return AMD_NOTI_CONTINUE;
        }
 
@@ -2256,7 +2250,7 @@ static int __on_comp_status_add(const char *msg, int arg1, int arg2,
                ret = amd_comp_status_set_leader_id(comp_status,
                                __launch_context.leader_id);
                if (ret < 0) {
-                       LOGE("Fail to set leader id (%s)",
+                       _E("Fail to set leader id (%s)",
                                        __launch_context.leader_id);
                }
        }
@@ -2338,7 +2332,7 @@ static int __on_launch_app_start_start(const char *msg, int arg1, int arg2,
                        bundle_add(kb, AUL_K_NEW_INSTANCE, "true");
                }
        } else {
-               LOGW("Wrong request");
+               _W("Wrong request");
                bundle_del(kb, AUL_K_INSTANCE_ID);
        }
 
@@ -2349,16 +2343,16 @@ int _app_group_init(void)
 {
        int r;
 
-       LOGD("app group init");
+       _D("app group init");
        r = _app_group_wayland_init();
        if (r < 0) {
-               LOGE("Failed to initialize app group wayland");
+               _E("Failed to initialize app group wayland");
                return -1;
        }
 
        r = _app_group_request_init();
        if (r < 0) {
-               LOGE("Failed to initialize app group request");
+               _E("Failed to initialize app group request");
                return -1;
        }
 
@@ -2409,5 +2403,5 @@ void _app_group_fini(void)
        if (__recycle_bin)
                g_list_free_full(__recycle_bin, __destroy_app_group_context);
 
-       LOGD("app group fini");
+       _D("app group fini");
 }
index 8bfb25186b24009dbbdda439538eb64a1fae1d41..a68f0037c2ee9fc44d91dd4043ef7aeb07c40398 100644 (file)
 #include <bundle_internal.h>
 #include <aul_sock.h>
 #include <system_info.h>
+#include <amd.h>
 
-#include "amd.h"
 #include "amd_screen_connector.h"
 #include "app_group.h"
 #include "app_group_request.h"
 #include "app_group_wayland.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "AMD_APP_GROUP"
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#include "app_group_private.h"
 
 static app_group_h __find_app_group_by_pid(pid_t pid)
 {
@@ -76,7 +69,7 @@ static int __get_window_by_appid(const char *appid, uid_t uid)
 
        app_status = amd_app_status_find_by_appid(appid, uid);
        if (!app_status) {
-               LOGE("Failed to find app status. appid(%s)", appid);
+               _E("Failed to find app status. appid(%s)", appid);
                return 0;
        }
 
@@ -95,7 +88,7 @@ static int __dispatch_app_group_get_window(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -105,25 +98,25 @@ static int __dispatch_app_group_get_window(amd_request_h req)
                pid = atoi(pid_str);
 
        if (pid <= 1) {
-               LOGE("Invalid process ID(%d)", pid);
+               _E("Invalid process ID(%d)", pid);
                amd_request_send_result(req, -1);
                return -1;
        }
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                amd_request_send_result(req, -1);
                return -1;
        }
 
        wid = _app_group_node_get_window(node);
        if (wid <= 0)
-               LOGE("Failed to get window");
+               _E("Failed to get window");
 
        amd_request_send_result(req, wid);
 
-       LOGI("pid(%d), wid(%u)", pid, wid);
+       _I("pid(%d), wid(%u)", pid, wid);
 
        return 0;
 }
@@ -140,7 +133,7 @@ static int __dispatch_app_group_set_window(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                return -1;
        }
 
@@ -149,26 +142,26 @@ static int __dispatch_app_group_set_window(amd_request_h req)
                wid = atoi(wid_str);
 
        if (wid <= 0) {
-               LOGE("Failed to get window ID");
+               _E("Failed to get window ID");
                return -1;
        }
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                return -1;
        }
 
        ret = _app_group_node_set_window(node, wid);
        if (ret < 0) {
-               LOGE("Failed to set window. pid(%d), wid(%d)",
+               _E("Failed to set window. pid(%d), wid(%d)",
                                pid, wid);
                return -1;
        }
 
        _screen_connector_add_app_screen(pid, wid, NULL, uid);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_WINDOW_SET, pid, wid, NULL, NULL);
-       LOGI("pid(%d), wid(%d), result(%d)", pid, wid, ret);
+       _I("pid(%d), wid(%d), result(%d)", pid, wid, ret);
 
        return ret;
 }
@@ -183,7 +176,7 @@ static int __dispatch_app_group_get_fg_flag(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, 0);
                return -1;
        }
@@ -194,7 +187,7 @@ static int __dispatch_app_group_get_fg_flag(amd_request_h req)
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                amd_request_send_result(req, 0);
                return -1;
        }
@@ -202,7 +195,7 @@ static int __dispatch_app_group_get_fg_flag(amd_request_h req)
        fg = _app_group_node_get_fg_flag(node);
        amd_request_send_result(req, (int)fg);
 
-       LOGI("pid(%d), fg(%s)", pid, fg ? "true" : "false");
+       _I("pid(%d), fg(%s)", pid, fg ? "true" : "false");
 
        return 0;
 }
@@ -215,7 +208,7 @@ static int __dispatch_app_group_clear_top(amd_request_h req)
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                amd_request_send_result(req, 0);
                return -1;
        }
@@ -223,7 +216,7 @@ static int __dispatch_app_group_clear_top(amd_request_h req)
        _app_group_node_clear_top(node, uid);
        amd_request_send_result(req, 0);
 
-       LOGI("pid(%d)", pid);
+       _I("pid(%d)", pid);
 
        return 0;
 }
@@ -238,7 +231,7 @@ static int __dispatch_app_group_get_leader_pid(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -249,14 +242,14 @@ static int __dispatch_app_group_get_leader_pid(amd_request_h req)
 
        app_group = __find_app_group_by_pid(pid);
        if (!app_group) {
-               LOGE("Failed to find app group. pid(%d)", pid);
+               _E("Failed to find app group. pid(%d)", pid);
                amd_request_send_result(req, -1);
                return -1;
        }
 
        leader_pid = _app_group_get_leader_pid(app_group);
        amd_request_send_result(req, leader_pid);
-       LOGI("pid(%d), leader_pid(%d)", pid, leader_pid);
+       _I("pid(%d), leader_pid(%d)", pid, leader_pid);
 
        return 0;
 }
@@ -279,7 +272,7 @@ static int __dispatch_app_group_get_leader_pids(amd_request_h req)
        if (pids != NULL)
                free(pids);
 
-       LOGI("count(%d)", cnt);
+       _I("count(%d)", cnt);
 
        return 0;
 }
@@ -301,7 +294,7 @@ static int __dispatch_app_group_get_idle_pids(amd_request_h req)
        if (pids != NULL)
                free(pids);
 
-       LOGI("count(%d)", cnt);
+       _I("count(%d)", cnt);
 
        return 0;
 }
@@ -318,7 +311,7 @@ static int __dispatch_app_group_get_group_pids(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_raw(req, APP_GROUP_GET_GROUP_PIDS, empty, 0);
                return -1;
        }
@@ -328,7 +321,7 @@ static int __dispatch_app_group_get_group_pids(amd_request_h req)
                leader_pid = atoi(buf);
 
        if (leader_pid <= 1) {
-               LOGE("Failed to get leader process ID");
+               _E("Failed to get leader process ID");
                amd_request_send_raw(req, APP_GROUP_GET_GROUP_PIDS, empty, 0);
                return -1;
        }
@@ -345,7 +338,7 @@ static int __dispatch_app_group_get_group_pids(amd_request_h req)
        if (pids != NULL)
                free(pids);
 
-       LOGI("leader_pid(%d), count(%d)", leader_pid, cnt);
+       _I("leader_pid(%d), count(%d)", leader_pid, cnt);
 
        return 0;
 }
@@ -358,14 +351,14 @@ static int __dispatch_app_group_lower(amd_request_h req)
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                amd_request_send_result(req, 0);
                return -1;
        }
 
        _app_group_node_lower(node, &exit);
        amd_request_send_result(req, (int)exit);
-       LOGI("pid(%d), exit(%s)", pid, exit ? "true" : "false");
+       _I("pid(%d), exit(%s)", pid, exit ? "true" : "false");
 
        return 0;
 }
@@ -377,19 +370,19 @@ static int __app_group_activate_below(pid_t pid, uid_t uid,
        int wid;
 
        if (!below_appid) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return -1;
        }
 
        wid = __get_window_by_pid(pid);
        if (wid == 0) {
-               LOGE("Caller(%d) window is not ready", pid);
+               _E("Caller(%d) window is not ready", pid);
                return -1;
        }
 
        below_wid = __get_window_by_appid(below_appid, uid);
        if (below_wid == 0) {
-               LOGE("Below app(%s) window is not ready", below_appid);
+               _E("Below app(%s) window is not ready", below_appid);
                return -1;
        }
 
@@ -408,14 +401,14 @@ static int __dispatch_app_group_activate_below(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        appid = bundle_get_val(b, AUL_K_APPID);
        if (!appid) {
-               LOGE("Failed to get appid");
+               _E("Failed to get appid");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -425,7 +418,7 @@ static int __dispatch_app_group_activate_below(amd_request_h req)
 
        ret = __app_group_activate_below(pid, uid, appid);
        amd_request_send_result(req, ret);
-       LOGI("pid(%d), appid(%s), result(%d)", pid, appid, ret);
+       _I("pid(%d), appid(%s), result(%d)", pid, appid, ret);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_ACTIVATE_BELOW, pid, (int)uid,
                        (void *)appid, b);
 
@@ -439,19 +432,19 @@ static int __app_group_activate_above(pid_t pid, uid_t uid,
        int wid;
 
        if (!above_appid) {
-               LOGE("Invalid parameter");
+               _E("Invalid parameter");
                return -1;
        }
 
        wid = __get_window_by_pid(pid);
        if (wid == 0) {
-               LOGE("Caller(%d) window is not ready", pid);
+               _E("Caller(%d) window is not ready", pid);
                return -1;
        }
 
        above_wid = __get_window_by_appid(above_appid, uid);
        if (above_wid == 0) {
-               LOGE("Above app(%s) window is not ready", above_appid);
+               _E("Above app(%s) window is not ready", above_appid);
                return -1;
        }
 
@@ -470,14 +463,14 @@ static int __dispatch_app_group_activate_above(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        appid = bundle_get_val(b, AUL_K_APPID);
        if (!appid) {
-               LOGE("Failed to get appid");
+               _E("Failed to get appid");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -487,7 +480,7 @@ static int __dispatch_app_group_activate_above(amd_request_h req)
 
        ret = __app_group_activate_above(pid, uid, appid);
        amd_request_send_result(req, ret);
-       LOGI("pid(%d), appid(%s), result(%d)", pid, appid, ret);
+       _I("pid(%d), appid(%s), result(%d)", pid, appid, ret);
 
        return 0;
 }
@@ -500,13 +493,13 @@ static int __app_window_attach(const char *parent_appid,
 
        parent_wid = __get_window_by_appid(parent_appid, uid);
        if (parent_wid == 0) {
-               LOGE("Parent(%s) window is not ready", parent_appid);
+               _E("Parent(%s) window is not ready", parent_appid);
                return -ENOENT;
        }
 
        child_wid = __get_window_by_appid(child_appid, uid);
        if (child_wid == 0) {
-               LOGE("Child(%s) window is not ready", child_appid);
+               _E("Child(%s) window is not ready", child_appid);
                return -ENOENT;
        }
 
@@ -524,28 +517,28 @@ static int __dispatch_app_window_attach(amd_request_h req)
        int ret;
 
        if (!b) {
-               LOGE("Invalid bundle");
+               _E("Invalid bundle");
                amd_request_send_result(req, -EINVAL);
                return -EINVAL;
        }
 
        parent_appid = bundle_get_val(b, AUL_K_PARENT_APPID);
        if (!parent_appid) {
-               LOGE("Invalid parameters");
+               _E("Invalid parameters");
                amd_request_send_result(req, -EINVAL);
                return -EINVAL;
        }
 
        child_appid = bundle_get_val(b, AUL_K_CHILD_APPID);
        if (!child_appid) {
-               LOGE("Invalid parameters");
+               _E("Invalid parameters");
                amd_request_send_result(req, -EINVAL);
                return -EINVAL;
        }
 
        ret = __app_window_attach(parent_appid, child_appid, uid);
        amd_request_send_result(req, ret);
-       LOGI("parent appid(%s), child appid(%s), result(%d)",
+       _I("parent appid(%s), child appid(%s), result(%d)",
                        parent_appid, child_appid, ret);
 
        return ret;
@@ -557,7 +550,7 @@ static int __app_window_detach(const char *appid, uid_t uid)
 
        wid = __get_window_by_appid(appid, uid);
        if (wid == 0) {
-               LOGE("%s window(%u) is invalid", appid, wid);
+               _E("%s window(%u) is invalid", appid, wid);
                return -ENOENT;
        }
 
@@ -574,21 +567,21 @@ static int __dispatch_app_window_detach(amd_request_h req)
        int ret;
 
        if (!b) {
-               LOGE("Invalid bundle");
+               _E("Invalid bundle");
                amd_request_send_result(req, -EINVAL);
                return -EINVAL;
        }
 
        child_appid = bundle_get_val(b, AUL_K_CHILD_APPID);
        if (!child_appid) {
-               LOGE("Invalid parameters");
+               _E("Invalid parameters");
                amd_request_send_result(req, -EINVAL);
                return -EINVAL;
        }
 
        ret = __app_window_detach(child_appid, uid);
        amd_request_send_result(req, ret);
-       LOGI("child appid(%s), result(%d)", child_appid, ret);
+       _I("child appid(%s), result(%d)", child_appid, ret);
 
        return ret;
 }
@@ -606,13 +599,13 @@ static int __dispatch_app_group_set_window_v2(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                return -1;
        }
 
        id = bundle_get_val(b, AUL_K_INSTANCE_ID);
        if (!id) {
-               LOGE("Failed to get instance ID");
+               _E("Failed to get instance ID");
                return -1;
        }
 
@@ -621,19 +614,19 @@ static int __dispatch_app_group_set_window_v2(amd_request_h req)
                wid = (uint32_t)atoi(wid_str);
 
        if (wid <= 0) {
-               LOGE("Failed to get window ID");
+               _E("Failed to get window ID");
                return -1;
        }
 
        node = _app_group_node_find(id);
        if (!node) {
-               LOGE("Failed to find app group node. id(%s)", id);
+               _E("Failed to find app group node. id(%s)", id);
                return -1;
        }
 
        ret = _app_group_node_set_window(node, wid);
        if (ret < 0) {
-               LOGE("Failed to set window. id(%s), wid(%u)",
+               _E("Failed to set window. id(%s), wid(%u)",
                                id, wid);
                return -1;
        }
@@ -641,7 +634,7 @@ static int __dispatch_app_group_set_window_v2(amd_request_h req)
        _screen_connector_add_app_screen(pid, wid, id, uid);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_WINDOW_SET,
                        pid, wid, (void *)id, NULL);
-       LOGI("id(%s), wid(%u), result(%d)", id, wid, ret);
+       _I("id(%s), wid(%u), result(%d)", id, wid, ret);
 
        return ret;
 }
@@ -655,28 +648,28 @@ static int __dispatch_app_group_lower_v2(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, 0);
                return -1;
        }
 
        id = bundle_get_val(b, AUL_K_INSTANCE_ID);
        if (!id) {
-               LOGE("Failed to get instance ID");
+               _E("Failed to get instance ID");
                amd_request_send_result(req, 0);
                return -1;
        }
 
        node = _app_group_node_find(id);
        if (!node) {
-               LOGE("Failed to find app group node. id(%s)", id);
+               _E("Failed to find app group node. id(%s)", id);
                amd_request_send_result(req, 0);
                return -1;
        }
 
        _app_group_node_lower(node, &exit);
        amd_request_send_result(req, (int)exit);
-       LOGI("id(%s), exit(%s)", id, exit ? "true" : "false");
+       _I("id(%s), exit(%s)", id, exit ? "true" : "false");
 
        return 0;
 }
@@ -714,7 +707,7 @@ static int __dispatch_app_group_get_leader_ids(amd_request_h req)
                        APP_GET_INFO_OK, b, AUL_SOCK_NOREPLY);
        bundle_free(b);
 
-       LOGI("count(%d), result(%d)", cnt, ret);
+       _I("count(%d), result(%d)", cnt, ret);
 
        return 0;
 }
@@ -734,13 +727,13 @@ static void __foreach_group_info(const char *id, pid_t pid, int wid,
 
        app_status = amd_app_status_find_by_effective_pid(pid);
        if (!app_status) {
-               LOGE("Failed to get app status");
+               _E("Failed to get app status");
                return;
        }
 
        b = bundle_create();
        if (!b) {
-               LOGE("Out of memory");
+               _E("Out of memory");
                return;
        }
 
@@ -767,7 +760,7 @@ static void __foreach_group_info(const char *id, pid_t pid, int wid,
        ret = aul_sock_send_bundle_with_fd(fd, APP_GET_INFO_OK, b,
                        AUL_SOCK_ASYNC);
        if (ret < 0)
-               LOGE("Failed to send bundle. result(%d)", ret);
+               _E("Failed to send bundle. result(%d)", ret);
        bundle_free(b);
 }
 
@@ -780,14 +773,14 @@ static int __dispatch_app_group_get_group_info(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                amd_request_send_result(req, -1);
                return -1;
        }
 
        id = bundle_get_val(b, AUL_K_LEADER_ID);
        if (!id) {
-               LOGE("Failed to get leader id");
+               _E("Failed to get leader id");
                amd_request_send_result(req, -1);
                return -1;
        }
@@ -804,7 +797,7 @@ static int __dispatch_app_group_get_group_info(amd_request_h req)
 
        _app_group_foreach_context(group, __foreach_group_info, req);
 
-       LOGI("leader(%s), count(%d)", id, group_count);
+       _I("leader(%s), count(%d)", id, group_count);
 
        return 0;
 }
@@ -818,7 +811,7 @@ static int __dispatch_app_group_get_idle_info(amd_request_h req)
 
        _app_group_foreach_idle_context(__foreach_group_info, req);
 
-       LOGI("count(%d)", idle_count);
+       _I("count(%d)", idle_count);
 
        return 0;
 }
@@ -836,7 +829,7 @@ static int __dispatch_app_group_add(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                return -EINVAL;
        }
 
@@ -845,35 +838,35 @@ static int __dispatch_app_group_add(amd_request_h req)
                wid = atoi(wid_str);
 
        if (wid <= 0) {
-               LOGE("Failed to get window ID");
+               _E("Failed to get window ID");
                return -EINVAL;
        }
 
        node = _app_group_node_find_by_wid(wid);
        if (node) {
-               LOGE("Already exists. wid(%d)", wid);
+               _E("Already exists. wid(%d)", wid);
                return -EALREADY;
        }
 
        node = __find_app_group_node_by_pid(pid);
        if (!node) {
-               LOGE("Failed to find app group node. pid(%d)", pid);
+               _E("Failed to find app group node. pid(%d)", pid);
                return -EINVAL;
        }
 
        new_node = _app_group_node_add_node(node);
        if (!new_node) {
-               LOGE("Failed to add new node. pid(%d), wid(%d)", pid, wid);
+               _E("Failed to add new node. pid(%d), wid(%d)", pid, wid);
                return -ENOMEM;
        }
 
        ret = _app_group_node_set_window(new_node, wid);
        if (ret < 0)
-               LOGE("Failed to set window. pid(%d), wid(%d)", pid, wid);
+               _E("Failed to set window. pid(%d), wid(%d)", pid, wid);
 
        _screen_connector_add_app_screen(pid, wid, NULL, uid);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_WINDOW_SET, pid, wid, NULL, NULL);
-       LOGI("pid(%d), wid(%d), result(%d)", pid, wid, ret);
+       _I("pid(%d), wid(%d), result(%d)", pid, wid, ret);
 
        return ret;
 }
@@ -889,7 +882,7 @@ static int __dispatch_app_group_remove(amd_request_h req)
 
        b = amd_request_get_bundle(req);
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                return -EINVAL;
        }
 
@@ -898,21 +891,21 @@ static int __dispatch_app_group_remove(amd_request_h req)
                wid = atoi(wid_str);
 
        if (wid <= 0) {
-               LOGE("Failed to get window ID");
+               _E("Failed to get window ID");
                return -EINVAL;
        }
 
        node = _app_group_node_find_by_wid(wid);
        if (!node) {
-               LOGE("Failed to find node. pid(%d), wid(%d)", pid, wid);
+               _E("Failed to find node. pid(%d), wid(%d)", pid, wid);
                return -EINVAL;
        }
 
        ret = _app_group_node_remove_node(node);
        if (ret < 0)
-               LOGE("Failed to remove node. pid(%d), wid(%d)", pid, wid);
+               _E("Failed to remove node. pid(%d), wid(%d)", pid, wid);
 
-       LOGI("pid(%d), wid(%d), result(%d)", pid, wid, ret);
+       _I("pid(%d), wid(%d), result(%d)", pid, wid, ret);
 
        return ret;
 }
@@ -1010,19 +1003,19 @@ static int __verify_instance_cynara_checker(amd_cynara_caller_info_h info,
        int app_type;
 
        if (!b) {
-               LOGE("Failed to get bundle");
+               _E("Failed to get bundle");
                return AMD_CYNARA_RET_DENIED;
        }
 
        id = bundle_get_val(b, AUL_K_INSTANCE_ID);
        if (!id) {
-               LOGE("Failed to get instance ID");
+               _E("Failed to get instance ID");
                return AMD_CYNARA_RET_DENIED;
        }
 
        app_status = amd_app_status_find_by_effective_pid(pid);
        if (!app_status) {
-               LOGE("Failed to find app status. pid(%d)", pid);
+               _E("Failed to find app status. pid(%d)", pid);
                return AMD_CYNARA_RET_DENIED;
        }
 
@@ -1030,19 +1023,19 @@ static int __verify_instance_cynara_checker(amd_cynara_caller_info_h info,
        if (app_type == AMD_AT_COMPONENT_BASED_APP) {
                comp_status = amd_comp_status_find_by_instance_id(id);
                if (!comp_status) {
-                       LOGE("Failed to find comp status. instance(%s)", id);
+                       _E("Failed to find comp status. instance(%s)", id);
                        return AMD_CYNARA_RET_DENIED;
                }
 
                if (amd_comp_status_get_pid(comp_status) != pid) {
-                       LOGE("Reject request! instance(%s:%d) doesn't exist",
+                       _E("Reject request! instance(%s:%d) doesn't exist",
                                        id, pid);
                        return AMD_CYNARA_RET_DENIED;
                }
        } else {
                inst_id = amd_app_status_get_instance_id(app_status);
                if (!inst_id || strcmp(inst_id, id) != 0) {
-                       LOGE("Reject request! instance(%s:%d) doesn't exist",
+                       _E("Reject request! instance(%s:%d) doesn't exist",
                                        id, pid);
                        return AMD_CYNARA_RET_DENIED;
                }
@@ -1094,19 +1087,19 @@ int _app_group_request_init(void)
 {
        int r;
 
-       LOGD("app group request init");
+       _D("app group request init");
 
        r = amd_request_register_cmds(__dispatch_table,
                        ARRAY_SIZE(__dispatch_table));
        if (r < 0) {
-               LOGE("Failed to register cmds");
+               _E("Failed to register cmds");
                return -1;
        }
 
        r = amd_cynara_register_checkers(__cynara_checkers,
                        ARRAY_SIZE(__cynara_checkers));
        if (r < 0) {
-               LOGE("Failed to register checkers");
+               _E("Failed to register checkers");
                return -1;
        }
 
@@ -1115,5 +1108,5 @@ int _app_group_request_init(void)
 
 void _app_group_request_fini(void)
 {
-       LOGD("app group request fini");
+       _D("app group request fini");
 }
index 0c859964bcd36938a567b575cba74cabbe86a09e..d7b53d4d303e0d08bc26dd790c12004a206d6eb0 100644 (file)
 #include <wayland-client.h>
 #include <wayland-tbm-client.h>
 
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "AMD_APP_GROUP"
+#include "app_group_private.h"
 
 struct wayland_context_s {
        struct wl_display *display;
@@ -44,7 +40,7 @@ static struct wayland_context_s __context;
 int _app_group_wayland_lower_window(int wid)
 {
        if (!__context.tizen_policy_initialized) {
-               LOGE("tizen_policy is not initialized");
+               _E("tizen_policy is not initialized");
                return -1;
        }
 
@@ -57,14 +53,14 @@ int _app_group_wayland_lower_window(int wid)
 int _app_group_wayland_attach_window(int parent_wid, int child_wid)
 {
        if (!__context.tizen_policy_initialized) {
-               LOGE("tizen_policy is not initialized");
+               _E("tizen_policy is not initialized");
                return -1;
        }
 
        tizen_policy_set_transient_for(__context.tizen_policy,
                        child_wid, parent_wid);
        wl_display_roundtrip(__context.display);
-       LOGW("[__ATTACH__] parent_wid(%d), child_wid(%d)",
+       _W("[__ATTACH__] parent_wid(%d), child_wid(%d)",
                        parent_wid, child_wid);
 
        return 0;
@@ -73,13 +69,13 @@ int _app_group_wayland_attach_window(int parent_wid, int child_wid)
 int _app_group_wayland_detach_window(int child_wid)
 {
        if (!__context.tizen_policy_initialized) {
-               LOGE("tizen_policy is not initialized");
+               _E("tizen_policy is not initialized");
                return -1;
        }
 
        tizen_policy_unset_transient_for(__context.tizen_policy, child_wid);
        wl_display_roundtrip(__context.display);
-       LOGW("[__DETACH__] child_wid(%d)", child_wid);
+       _W("[__DETACH__] child_wid(%d)", child_wid);
 
        return 0;
 }
@@ -87,7 +83,7 @@ int _app_group_wayland_detach_window(int child_wid)
 int _app_group_wayland_activate_below(int wid, int below_wid)
 {
        if (!__context.tizen_policy_initialized) {
-               LOGE("tizen_policy is not initialized");
+               _E("tizen_policy is not initialized");
                return -1;
        }
 
@@ -101,7 +97,7 @@ int _app_group_wayland_activate_below(int wid, int below_wid)
 int _app_group_wayland_activate_above(int wid, int above_wid)
 {
        if (!__context.tizen_policy_initialized) {
-               LOGE("tizen_policy is not initialized");
+               _E("tizen_policy is not initialized");
                return -1;
        }
 
@@ -223,7 +219,7 @@ static int __on_wayland_listener_tizen_policy(const char *msg, int arg1,
                        amd_wayland_set_tizen_policy(__context.tizen_policy);
                        __context.tizen_policy_initialized = true;
                }
-               LOGD("tizen_policy(%p)", __context.tizen_policy);
+               _D("tizen_policy(%p)", __context.tizen_policy);
        }
 
        return 0;
@@ -240,7 +236,7 @@ static int __on_wayland_listener_listener_remove(const char *msg, int arg1,
                __context.tizen_policy_id = 0;
                __context.tizen_policy_initialized = false;
                amd_wayland_set_tizen_policy(__context.tizen_policy);
-               LOGW("tizen policy is destroyed");
+               _W("tizen policy is destroyed");
        }
 
        return 0;
@@ -248,7 +244,7 @@ static int __on_wayland_listener_listener_remove(const char *msg, int arg1,
 
 int _app_group_wayland_init(void)
 {
-       LOGD("app group wayland init");
+       _D("app group wayland init");
        amd_noti_listen(AMD_NOTI_MSG_WAYLAND_LISTENER_TIZEN_POLICY,
                        __on_wayland_listener_tizen_policy);
        amd_noti_listen(AMD_NOTI_MSG_WAYLAND_LISTENER_REMOVE,
@@ -259,5 +255,5 @@ int _app_group_wayland_init(void)
 
 void _app_group_wayland_fini(void)
 {
-       LOGD("app group wayland fini");
+       _D("app group wayland fini");
 }
index 818fd7597e819085e8cd126294351cc814e61f05..8007ffc6058b9b08c4478b01f700d207b471dc34 100644 (file)
 #include <unistd.h>
 #include <dlog.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
 #include "status.h"
 
+#ifdef LOG_TAG
 #undef LOG_TAG
+#endif
 #define LOG_TAG "AMD_UI_CORE"
 
 pid_t _status_get_effective_pid(pid_t pid)
@@ -32,7 +35,7 @@ pid_t _status_get_effective_pid(pid_t pid)
 
        app_status = amd_app_status_find_by_effective_pid(pid);
        if (!app_status) {
-               LOGW("Failed to find app status info. pid(%d)", pid);
+               _W("Failed to find app status info. pid(%d)", pid);
                return -1;
        }
 
index de4af3266a296784d60e6f8f54ba7da42d6ff093..acdd98521a8f05242833ba18d9b360710d1cd0d4 100644 (file)
 
 #include <dlog.h>
 
-#include "amd.h"
+#include <amd.h>
+#include <amd_mod_common.h>
+
 #include "amd_screen_connector.h"
 #include "app_group.h"
 
+#ifdef LOG_TAG
 #undef LOG_TAG
+#endif
 #define LOG_TAG "AMD_UI_CORE"
 
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
-
 EXPORT int AMD_MOD_INIT(void)
 {
-       LOGD("ui-core init");
+       _D("ui-core init");
        if (_app_group_init() < 0)
                return -1;
 
@@ -42,7 +43,7 @@ EXPORT int AMD_MOD_INIT(void)
 
 EXPORT void AMD_MOD_FINI(void)
 {
-       LOGD("ui-core fini");
+       _D("ui-core fini");
        _screen_connector_fini();
        _app_group_fini();
 }
diff --git a/modules/watch/inc/amd_watch.h b/modules/watch/inc/amd_watch.h
deleted file mode 100644 (file)
index d23e026..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_WATCH"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#ifndef REGULAR_UID_MIN
-#define REGULAR_UID_MIN 5000
-#endif
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
diff --git a/modules/watch/inc/amd_watch_private.h b/modules/watch/inc/amd_watch_private.h
new file mode 100644 (file)
index 0000000..bdd741a
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_WATCH"
index 949d020a980f9fc251c1d01beae69bb7a91856cf..5bce8b06c4bef3f7c6ee97aca4a9198813f9142c 100644 (file)
@@ -27,8 +27,8 @@
 #include <bundle_internal.h>
 #include <amd.h>
 
-#include "amd_watch.h"
 #include "amd_watch_logger.h"
+#include "amd_watch_private.h"
 
 struct watch_info {
        char *appid;
index a65fbaa43c9a2ef23bef17d30536d9dabfa9f03b..88fa0fbb854971c047defbf09cf0fd9f0e7f6b77 100644 (file)
@@ -19,8 +19,8 @@
 #include <stdarg.h>
 #include <amd.h>
 
-#include "amd_watch.h"
 #include "amd_logger.h"
+#include "amd_watch_private.h"
 
 #define LOG_FILE "amd_watch.log"
 #define LOG_PATH LOGGER_PATH "/" LOG_FILE
index b0eacbc5c9e1e721b492a4d9efc0e7c001e9951b..fc0cc302e98fa15e49f59d4b6440c07fd7e32bb6 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __AMD_WATCHDOG_PRIVATE_H__
-#define __AMD_WATCHDOG_PRIVATE_H__
+#pragma once
 
-#include <dlog.h>
+#include <amd_mod_common.h>
 
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
 #define LOG_TAG "AMD_WATCHDOG"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#define EXPORT __attribute__ ((visibility("default")))
-
-#define RESOURCED_FREEZER_PATH         "/Org/Tizen/ResourceD/Freezer"
-#define RESOURCED_FREEZER_INTERFACE    "org.tizen.resourced.freezer"
-#define RESOURCED_FREEZER_SIGNAL       "FreezerState"
-
-#endif /* __AMD_WATCHDOG_PRIVATE_H__ */
index a75e56627d2890fb6dc54ba69c3f12181c557367..7b5fee0102f81e954f5ecce6584f5f8a94210659 100644 (file)
 #include <bundle_internal.h>
 #include <amd.h>
 
-#include "amd_watchdog_private.h"
 #include "amd_watchdog_config.h"
 #include "amd_watchdog_logger.h"
+#include "amd_watchdog_private.h"
 
-#define ARRAY_SIZE(x) ((sizeof(x)) / sizeof(x[0]))
+#define RESOURCED_FREEZER_PATH         "/Org/Tizen/ResourceD/Freezer"
+#define RESOURCED_FREEZER_INTERFACE    "org.tizen.resourced.freezer"
+#define RESOURCED_FREEZER_SIGNAL       "FreezerState"
 
 typedef struct watchdog_s {
        GDBusConnection *conn;
index 23edc88113f237a64c9ad3c8dae3c133b69d327a..b6c28161567b123fdaad85aaeaa107624ea282a0 100644 (file)
@@ -20,8 +20,8 @@
 #include <string.h>
 #include <iniparser.h>
 
-#include "amd_watchdog_private.h"
 #include "amd_watchdog_config.h"
+#include "amd_watchdog_private.h"
 
 #define CONFIG_PATH "/usr/share/amd/conf/amd_watchdog.conf"
 #define CONFIG_SECTION_NAME "Setting"
index 02479b97007981b54235f2834c64fbdfdf5808cd..784ed38139e8ddba946eee60f83a7efce33275a9 100644 (file)
@@ -19,8 +19,8 @@
 #include <stdarg.h>
 #include <amd.h>
 
-#include "amd_watchdog_private.h"
 #include "amd_watchdog_logger.h"
+#include "amd_watchdog_private.h"
 
 #define LOG_FILE "amd_watchdog.log"
 #define LOG_PATH LOGGER_PATH "/" LOG_FILE
diff --git a/modules/wayland-core/inc/wayland-core-private.h b/modules/wayland-core/inc/wayland-core-private.h
deleted file mode 100644 (file)
index df835ff..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_WAYLAND_CORE"
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
index 92c5106df3831c19709fb4e84bacb910cdddecbe..6f7b222470abfca56a1b5396f42d66c554442194 100644 (file)
 #include <wayland-tbm-client.h>
 #include <tizen-extension-client-protocol.h>
 #include <amd.h>
+#include <amd_mod_common.h>
 
-#include "wayland-core-private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_WAYLAND_CORE"
 
 #define PATH_RUN_WAYLAND "/run/wayland-0"
 #define PATH_RUN_WMREADY "/run/.wm_ready"
@@ -58,7 +62,7 @@ static void __wl_listener_cb(void *data, struct wl_registry *reg,
        if (!interface)
                return;
 
-       LOGW("interface(%s), id(%u), version(%u)", interface, id, version);
+       _W("interface(%s), id(%u), version(%u)", interface, id, version);
        snprintf(buf, sizeof(buf), "wayland.listener.%s", interface);
        amd_noti_send(buf, (int)id, (int)version, reg, NULL);
 }
@@ -66,7 +70,7 @@ static void __wl_listener_cb(void *data, struct wl_registry *reg,
 static void __wl_listener_remove_cb(void *data, struct wl_registry *reg,
                unsigned int id)
 {
-       LOGW("id(%u)", id);
+       _W("id(%u)", id);
        amd_noti_send(AMD_NOTI_MSG_WAYLAND_LISTENER_REMOVE,
                        (int)id, 0, reg, NULL);
 }
@@ -83,7 +87,7 @@ static gboolean __wl_source_prepare(GSource *source, gint *timeout)
 
        while (wl_display_prepare_read(__wl_source.display) != 0) {
                if (wl_display_dispatch_pending(__wl_source.display) < 0)
-                       LOGW("Failed to dispatch queue pending");
+                       _W("Failed to dispatch queue pending");
        }
 
        __wl_source.prepared = true;
@@ -99,7 +103,7 @@ static gboolean __wl_source_check(GSource *source)
        if (g_source_is_destroyed(source)) {
                if (__wl_source.display && __wl_source.prepared)
                        wl_display_cancel_read(__wl_source.display);
-               LOGE("Display source(%p) already destroyed", source);
+               _E("Display source(%p) already destroyed", source);
                return FALSE;
        }
 
@@ -108,7 +112,7 @@ static gboolean __wl_source_check(GSource *source)
 
        if (__wl_source.gfd->revents & (G_IO_HUP | G_IO_ERR)) {
                wl_display_cancel_read(__wl_source.display);
-               LOGE("Error: revents(%x)", __wl_source.gfd->revents);
+               _E("Error: revents(%x)", __wl_source.gfd->revents);
                __wl_source.prepared = false;
                g_source_destroy(source);
                abort();
@@ -117,7 +121,7 @@ static gboolean __wl_source_check(GSource *source)
 
        if (__wl_source.gfd->revents & G_IO_IN) {
                if (wl_display_read_events(__wl_source.display) < 0)
-                       LOGW("Failed to read events");
+                       _W("Failed to read events");
                __wl_source.prepared = false;
                return TRUE;
        }
@@ -132,12 +136,12 @@ static gboolean __wl_source_dispatch(GSource *source, GSourceFunc callback,
                gpointer data)
 {
        if (g_source_is_destroyed(source)) {
-               LOGE("Source(%p) is already destroyed", source);
+               _E("Source(%p) is already destroyed", source);
                return G_SOURCE_REMOVE;
        }
 
        if (__wl_source.gfd->revents & (G_IO_HUP | G_IO_ERR)) {
-               LOGE("Error: revents(%x)", __wl_source.gfd->revents);
+               _E("Error: revents(%x)", __wl_source.gfd->revents);
                g_source_destroy(source);
                abort();
                return G_SOURCE_REMOVE;
@@ -145,7 +149,7 @@ static gboolean __wl_source_dispatch(GSource *source, GSourceFunc callback,
 
        if (__wl_source.gfd->revents & G_IO_IN) {
                if (wl_display_dispatch_pending(__wl_source.display) < 0)
-                       LOGW("Failed to dispatch queue pending");
+                       _W("Failed to dispatch queue pending");
        }
 
        wl_display_flush(__wl_source.display);
@@ -193,14 +197,14 @@ static int __wl_source_init(void)
 
        __wl_source.display = wl_display_connect(NULL);
        if (!__wl_source.display) {
-               LOGE("Failed to connect wayland display");
+               _E("Failed to connect wayland display");
                return -1;
        }
        amd_wayland_set_display(__wl_source.display);
 
        __wl_source.registry = wl_display_get_registry(__wl_source.display);
        if (!__wl_source.registry) {
-               LOGE("Failed to get wayland registry");
+               _E("Failed to get wayland registry");
                return -1;
        }
 
@@ -210,17 +214,17 @@ static int __wl_source_init(void)
 
        r = wl_display_roundtrip(__wl_source.display);
        if (r < 0)
-               LOGW("wl_display_roundtrip() is failed. result(%d)", r);
+               _W("wl_display_roundtrip() is failed. result(%d)", r);
 
        __wl_source.gsource = g_source_new(&__wl_source_funcs, sizeof(GSource));
        if (!__wl_source.gsource) {
-               LOGE("Failed to create GSource");
+               _E("Failed to create GSource");
                return -1;
        }
 
        __wl_source.gfd = (GPollFD *)g_malloc(sizeof(GPollFD));
        if (!__wl_source.gfd) {
-               LOGE("Failed to create GPollFD");
+               _E("Failed to create GPollFD");
                return -1;
        }
 
@@ -239,11 +243,11 @@ static int __wl_source_init(void)
 
 static gboolean __init_wl(gpointer data)
 {
-       LOGI("Initialize Wayland");
+       _I("Initialize Wayland");
        if (__wl_source_init() < 0) {
                __retry_cnt++;
                if (__retry_cnt > 10) {
-                       LOGE("Failed to initialize wayland: Retry(%d)", __retry_cnt);
+                       _E("Failed to initialize wayland: Retry(%d)", __retry_cnt);
                        __wl_source_fini();
                        g_timeout_add_seconds(1, __init_wl, NULL);
                        return G_SOURCE_REMOVE;
@@ -261,10 +265,10 @@ static bool __wayland_monitor_cb(const char *event_name, void *data)
                return true;
 
        if (strcmp(event_name, "wayland-0") == 0) {
-               LOGD("%s is created", event_name);
+               _D("%s is created", event_name);
                __file_monitor.wl_ready = true;
        } else if (strcmp(event_name, ".wm_ready") == 0) {
-               LOGD("%s is created", event_name);
+               _D("%s is created", event_name);
                __file_monitor.wm_ready = true;
        }
 
@@ -281,14 +285,14 @@ static int __file_monitor_init(void)
 {
        if (!__file_monitor.wl_ready) {
                if (access(PATH_RUN_WAYLAND, F_OK) == 0) {
-                       LOGD("%s exists", PATH_RUN_WAYLAND);
+                       _D("%s exists", PATH_RUN_WAYLAND);
                        __file_monitor.wl_ready = true;
                }
        }
 
        if (!__file_monitor.wm_ready) {
                if (access(PATH_RUN_WMREADY, F_OK) == 0) {
-                       LOGD("%s exists", PATH_RUN_WMREADY);
+                       _D("%s exists", PATH_RUN_WMREADY);
                        __file_monitor.wm_ready = true;
                }
        }
@@ -301,7 +305,7 @@ static int __file_monitor_init(void)
        __file_monitor.handle = amd_inotify_add_watch(PATH_RUN, IN_CREATE,
                        __wayland_monitor_cb, NULL);
        if (__file_monitor.handle == NULL) {
-               LOGE("Failed to add inotify watch");
+               _E("Failed to add inotify watch");
                return -1;
        }
 
@@ -316,7 +320,7 @@ static void __file_monitor_fini(void)
 
 static gboolean __idle_cb(gpointer data)
 {
-       LOGD("wayland core init");
+       _D("wayland core init");
 
        if (__file_monitor_init() < 0)
                return G_SOURCE_CONTINUE;
@@ -326,7 +330,7 @@ static gboolean __idle_cb(gpointer data)
 
 EXPORT int AMD_MOD_INIT(void)
 {
-       LOGD("wayland core init");
+       _D("wayland core init");
 
        g_idle_add(__idle_cb, NULL);
 
@@ -335,7 +339,7 @@ EXPORT int AMD_MOD_INIT(void)
 
 EXPORT void AMD_MOD_FINI(void)
 {
-       LOGD("wayland core finish");
+       _D("wayland core finish");
 
        __file_monitor_fini();
        __wl_source_fini();
diff --git a/modules/widget/inc/amd_widget_private.h b/modules/widget/inc/amd_widget_private.h
new file mode 100644 (file)
index 0000000..cc277da
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <amd_mod_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AMD_WIDGET"
index 212fdf0bde66542c0f86b72a64d2c014eecc8f2c..dae1ab725a825a36a6893653f48253a4f1f7a752 100644 (file)
 #include <bundle_internal.h>
 #include <pkgmgr-info.h>
 #include <aul_widget.h>
+#include <amd.h>
 
-#include "amd.h"
-#include "amd_widget_private.h"
 #include "amd_widget_logger.h"
+#include "amd_widget_private.h"
 
 #ifndef AUL_K_WIDGET_OPERATION
 #define AUL_K_WIDGET_OPERATION "__WIDGET_OP__"
 #endif
 #define MAX_NR_OF_DESCRIPTORS 2
 #define MAX_PID_STR_BUFSZ 20
-#define REGULAR_UID_MIN 5000
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 #define DISABLE_ENDPOINT "widget.disable"
 
 typedef struct _widget_t {
index 1e5be7f72af5f9b4bc47ba009a977057104437eb..1977321a991e131054dc422e2caaf738a959bd0d 100644 (file)
@@ -19,9 +19,9 @@
 #include <stdarg.h>
 #include <amd.h>
 
-#include "amd_widget_private.h"
-#include "amd_widget_logger.h"
 #include "amd_logger.h"
+#include "amd_widget_logger.h"
+#include "amd_widget_private.h"
 
 #define LOG_FILE "amd_widget.log"
 #define LOG_PATH LOGGER_PATH "/" LOG_FILE
diff --git a/modules/widget/src/amd_widget_private.h b/modules/widget/src/amd_widget_private.h
deleted file mode 100644 (file)
index ccf7d63..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __AMD_WIDGET_PRIVATE_H__
-#define __AMD_WIDGET_PRIVATE_H__
-
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "AMD_WIDGET"
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _W
-#define _W LOGW
-#endif
-
-#ifndef _I
-#define _I LOGI
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#undef EXPORT
-#define EXPORT __attribute__ ((visibility("default")))
-
-#endif /* __AMD_WIDGET_PRIVATE_H__ */