+/*
+ * Copyright (c) 2016 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.
+ */
+
#include "common.h"
#include "log.h"
*
*/
-extern "C" int PKGMGR_PARSER_PLUGIN_POST_INSTALL (const char *pkgid)
+extern "C" int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *pkgId)
{
- _INFO("pkg : %s", pkgid);
-
- uid_t uid = 0;
-
- if (pkgmgr_installer_info_get_target_uid(&uid) < 0)
- {
- _ERR("Failed to get UID");
- return 0;
- }
-
- pkgmgrinfo_pkginfo_h handle;
- int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
- if (ret != PMINFO_R_OK)
- {
- _ERR("Failed to get pkg info");
- return 0;
- }
-
- _INFO("success to get pkg info");
-
- bool dotnet_exist = false;
-
- auto dotnet_app_counter = [] (pkgmgrinfo_appinfo_h handle, void *user_data) -> int
- {
- char* appid = nullptr;
- char* type = nullptr;
- bool* dotnet = static_cast<bool*>(user_data);
-
- if (pkgmgrinfo_appinfo_get_appid(handle, &appid) != PMINFO_R_OK)
- {
- _ERR("Failed to get app id");
- return 0;
- }
-
- _INFO("App id : %s", appid);
-
- if (pkgmgrinfo_appinfo_get_apptype(handle, &type) != PMINFO_R_OK)
- {
- _ERR("Failed to get app type : %s", appid);
- return 0;
- }
-
- _INFO("App type : %s", type);
-
- if (strcmp(type, "dotnet") == 0)
- {
- *dotnet = true;
- }
-
- return 0;
- };
-
- if (pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, dotnet_app_counter, &dotnet_exist, uid) != PMINFO_R_OK)
- {
- _ERR("Failed to get list of app in pkg : %s", pkgid);
- return -1;
- }
-
- _INFO("Finish to get pkg list");
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- if (dotnet_exist)
- {
- _INFO("dotnet app is exist");
- return create_ni_under_pkg_root(pkgid) == 0 ? 0 : -1;
- }
-
- return 0;
+ _INFO("pkg : %s", pkgId);
+
+ uid_t uid = 0;
+
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ _ERR("Failed to get UID");
+ return 0;
+ }
+
+ pkgmgrinfo_pkginfo_h handle;
+ int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId, uid, &handle);
+ if (ret != PMINFO_R_OK) {
+ _ERR("Failed to get pkg info");
+ return 0;
+ }
+
+ _INFO("success to get pkg info");
+
+ bool dotnetExist = false;
+
+ auto dotnetAppCounter = [] (pkgmgrinfo_appinfo_h handle, void *userData) -> int {
+ char* appId = nullptr;
+ char* type = nullptr;
+ bool* dotnet = static_cast<bool*>(userData);
+
+ if (pkgmgrinfo_appinfo_get_appid(handle, &appId) != PMINFO_R_OK) {
+ _ERR("Failed to get app id");
+ return 0;
+ }
+
+ _INFO("App id : %s", appId);
+
+ if (pkgmgrinfo_appinfo_get_apptype(handle, &type) != PMINFO_R_OK) {
+ _ERR("Failed to get app type : %s", appId);
+ return 0;
+ }
+
+ _INFO("App type : %s", type);
+
+ if (strcmp(type, "dotnet") == 0)
+ *dotnet = true;
+
+ return 0;
+ };
+
+ if (pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, dotnetAppCounter, &dotnetExist, uid) != PMINFO_R_OK) {
+ _ERR("Failed to get list of app in pkg : %s", pkgId);
+ return -1;
+ }
+
+ _INFO("Finish to get pkg list");
+
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ if (dotnetExist) {
+ _INFO("dotnet app is exist");
+ return createNiUnderPkgRoot(pkgId) == 0 ? 0 : -1;
+ }
+
+ return 0;
}
-extern "C" int PKGMGR_PARSER_PLUGIN_POST_UPGRADE (const char *pkgid)
+extern "C" int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *pkgId)
{
- return PKGMGR_PARSER_PLUGIN_POST_INSTALL(pkgid);
+ return PKGMGR_PARSER_PLUGIN_POST_INSTALL(pkgId);
}