1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_UNINSTALL_DATA_BUNDLE_INFO_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_UNINSTALL_DATA_BUNDLE_INFO_H
18 
19 #include "application_info.h"
20 #include "json_util.h"
21 
22 namespace OHOS {
23 namespace AppExecFwk {
24 struct UninstallDataUserInfo {
25     int32_t uid = 0;
26     std::vector<int32_t> gids;
27     uint32_t accessTokenId = 0;
28     uint64_t accessTokenIdEx = 0;
29 };
30 struct UninstallBundleInfo {
31     std::string appId;
32     std::string appIdentifier;
33     std::string appProvisionType;
34     BundleType bundleType = BundleType::APP;
35     std::vector<std::string> extensionDirs;
36     std::map<std::string, UninstallDataUserInfo> userInfos;
37 
38     std::string ToString() const;
39     void Init();
40 };
41 
42 void from_json(const nlohmann::json& jsonObject, UninstallBundleInfo& uninstallBundleInfo);
43 void to_json(nlohmann::json& jsonObject, const UninstallBundleInfo& uninstallBundleInfo);
44 void from_json(const nlohmann::json& jsonObject, UninstallDataUserInfo& uninstallDataUserInfo);
45 void to_json(nlohmann::json& jsonObject, const UninstallDataUserInfo& uninstallDataUserInfo);
46 } // namespace AppExecFwk
47 } // namespace OHOS
48 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_UNINSTALL_DATA_BUNDLE_INFO_H
49