018cfa4fce84eca6fe2ae7dbf653751c5f846b3f
[platform/core/appfw/aul-1.git] / parser / metadata / allowed-appid / pkgmgr_interface.cc
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <glib.h>
18
19 #include "allowed-appid/plugin_manager.hh"
20 #include "common/log_private.hh"
21
22 #undef API
23 #define API __attribute__ ((visibility("default")))
24
25 using namespace plugin;
26
27 extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
28     const char* appid, GList* list)
29 {
30   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
31   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
32       EventType::Install, list);
33   return 0;
34 }
35
36 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
37     const char* appid, GList* list)
38 {
39   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
40   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
41       EventType::Uninstall, list);
42   return 0;
43 }
44
45 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
46     const char* appid, GList* list)
47 {
48   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
49   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
50       EventType::Upgrade, list);
51   return 0;
52 }
53
54 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
55     const char* appid, GList* list)
56 {
57   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
58   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
59       EventType::Uninstall, list);
60   return 0;
61 }
62
63 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
64     const char* appid, GList* list)
65 {
66   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
67   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
68       EventType::Uninstall, list);
69   return 0;
70 }
71
72 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
73     const char* appid, GList* list)
74 {
75   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
76   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
77       EventType::Upgrade, list);
78   return 0;
79 }
80
81 extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
82     const char* appid, GList* list)
83 {
84   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
85   PluginManager::GetInst().Clean();
86   return 0;
87 }
88
89 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
90     const char* appid, GList* list)
91 {
92   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
93   PluginManager::GetInst().Undo();
94   return 0;
95 }
96
97 extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
98     const char* appid, GList* list)
99 {
100   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
101   return 0;
102 }