• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_INNER_BUNDLE_USER_INFO_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_USER_INFO_H
18 
19 #include "bundle_user_info.h"
20 #include "json_util.h"
21 
22 namespace OHOS {
23 namespace AppExecFwk {
24 struct InnerBundleUserInfo {
25     BundleUserInfo bundleUserInfo;
26     int32_t uid = Constants::INVALID_UID;
27     std::vector<int32_t> gids;
28     uint32_t accessTokenId = 0;
29     uint64_t accessTokenIdEx = 0;
30     std::string bundleName;
31 
32     // The time(unix time) will be recalculated
33     // if the application is reinstalled after being uninstalled.
34     int64_t installTime = 0;
35 
36     // The time(unix time) will be recalculated
37     // if the application is uninstalled after being installed.
38     int64_t updateTime = 0;
39 
40     // app install control
41     bool isRemovable = true;
42 
operatorInnerBundleUserInfo43     bool operator() (const InnerBundleUserInfo& info) const
44     {
45         if (bundleName == info.bundleName) {
46             return bundleUserInfo.userId == info.bundleUserInfo.userId;
47         }
48 
49         return false;
50     }
51 };
52 
53 void from_json(const nlohmann::json& jsonObject, InnerBundleUserInfo& bundleUserInfo);
54 void to_json(nlohmann::json& jsonObject, const InnerBundleUserInfo& bundleUserInfo);
55 } // namespace AppExecFwk
56 } // namespace OHOS
57 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_USER_INFO_H