2 * Copyright (c) 2015 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
21 #include <sys/types.h>
26 #include <package-manager.h>
27 #include <pkgmgr-info.h>
29 class ApplicationInfo final {
31 ApplicationInfo(const std::string& aid, uid_t uid = 0);
32 ApplicationInfo(pkgmgrinfo_appinfo_h handle);
35 const std::string& getId() const;
36 const std::string& getPackage() const;
37 const std::string& getType() const;
38 const std::string& getIcon() const;
39 const std::string& getLabel() const;
40 int getComponentType() const;
41 bool isNoDisplayed() const;
42 bool isTaskManaged() const;
45 void load(pkgmgrinfo_appinfo_h handle);
57 class PackageInfo final {
59 PackageInfo(const std::string& pkgid, uid_t uid = 0);
62 std::vector<ApplicationInfo> getAppList() const;
64 std::string getType() const;
65 std::string getIcon() const;
66 std::string getLabel() const;
67 std::string getDescription() const;
69 std::string getAuthorName() const;
70 std::string getAuthorEmail() const;
71 std::string getAuthorHref() const;
73 std::string getVersion() const;
74 std::string getApiVersion() const;
75 std::string getMainAppId() const;
77 bool isSystem() const;
78 bool isRemovable() const;
79 bool isPreload() const;
83 pkgmgrinfo_pkginfo_h handle;
86 class PackageManager final {
88 void installPackage(const std::string& pkgpath, const uid_t user);
89 void uninstallPackage(const std::string& pkgid, const uid_t user);
91 std::vector<std::string> getPackageList(const uid_t user);
92 std::vector<ApplicationInfo> getAppList(const uid_t user);
94 void setEventCallback(pkgmgrinfo_handler callback, void* user_data);
95 void unsetEventCallback();
97 void setModeRestriction(int mode, uid_t user);
98 void unsetModeRestriction(int mode, uid_t user);
99 int getModeRestriction(uid_t user);
101 void setPackageRestriction(const std::string& pkgid, int mode, uid_t user);
102 void unsetPackageRestriction(const std::string& pkgid, int mode, uid_t user);
103 int getPackageRestriction(const std::string& pkgid, uid_t user);
105 static PackageManager& instance();
112 pkgmgr_client *nativeRequestHandle, *nativeListenHandle;
115 #endif // __PACKMAN_H__