• 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     std::string bundleName;
30 
31     // The time(unix time) will be recalculated
32     // if the application is reinstalled after being uninstalled.
33     int64_t installTime = 0;
34 
35     // The time(unix time) will be recalculated
36     // if the application is uninstalled after being installed.
37     int64_t updateTime = 0;
38 
operatorInnerBundleUserInfo39     bool operator() (const InnerBundleUserInfo& info) const
40     {
41         if (bundleName == info.bundleName) {
42             return bundleUserInfo.userId == info.bundleUserInfo.userId;
43         }
44 
45         return false;
46     }
47 };
48 
49 void from_json(const nlohmann::json& jsonObject, InnerBundleUserInfo& bundleUserInfo);
50 void to_json(nlohmann::json& jsonObject, const InnerBundleUserInfo& bundleUserInfo);
51 } // namespace AppExecFwk
52 } // namespace OHOS
53 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_USER_INFO_H