2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include "multi_target_resolver.h"
20 #include "ni_common.h"
21 #include "profile_common.h"
22 #include "privilege_common.h"
23 #include "launcher_env.h"
28 #define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
30 typedef struct _xmlDoc xmlDoc;
31 typedef xmlDoc* xmlDocPtr;
33 static bool pluginInstalled = false;
35 extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId)
37 // Can be multiple apps in one package
38 if (pluginInstalled) {
39 _INFO("Plugin already installed");
42 pluginInstalled = true;
44 std::string appType = getAppType(pkgId);
45 if (appType.empty()) {
46 _ERR("Failed to get app type from [%s]", pkgId);
50 if (appType.find("dotnet") == std::string::npos) {
54 std::string rootPath = getRootPath(pkgId);
55 if (rootPath.empty()) {
56 _ERR("Failed to get root path from [%s]", pkgId);
60 if (removeAppProfileData(pkgId) != PROFILE_ERROR_NONE) {
61 _ERR("Failed to remove [%s] profile data", pkgId);
64 if (resolvePlatformSpecificFiles(rootPath) != 0) {
65 _ERR("Failed to resolve platform specific resources of nuget");
68 checkInternetPrivilegeAndDisableIPv6(pkgId, rootPath);
72 extern "C" int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, const char* pkgId)
74 return PKGMGR_PARSER_PLUGIN_INSTALL(doc, pkgId);
76 extern "C" int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc, const char* pkgId)
80 extern "C" int PKGMGR_PARSER_PLUGIN_REMOVED(xmlDocPtr doc, const char* pkgId)
84 extern "C" int PKGMGR_PARSER_PLUGIN_CLEAN(xmlDocPtr doc, const char* pkgId)
88 extern "C" int PKGMGR_PARSER_PLUGIN_UNDO(xmlDocPtr doc, const char* pkgId)
92 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *pkgId)
96 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *pkgId)
100 extern "C" int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *pkgId)
104 extern "C" int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *pkgId)
108 extern "C" int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *pkgId)
112 extern "C" int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *pkgId)