• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_INFO_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "parcel.h"
23 
24 #include "ability_info.h"
25 #include "application_info.h"
26 #include "extension_ability_info.h"
27 #include "hap_module_info.h"
28 #include "message_parcel.h"
29 
30 namespace OHOS {
31 namespace AppExecFwk {
32 enum BundleFlag {
33     // get bundle info except abilityInfos
34     GET_BUNDLE_DEFAULT = 0x00000000,
35     // get bundle info include abilityInfos
36     GET_BUNDLE_WITH_ABILITIES = 0x00000001,
37     // get bundle info include request permissions
38     GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010,
39     // get bundle info include extension info
40     GET_BUNDLE_WITH_EXTENSION_INFO = 0x00000020,
41 };
42 
43 struct RequestPermissionUsedScene : public Parcelable {
44     std::vector<std::string> abilities;
45     std::string when;
46 
47     bool ReadFromParcel(Parcel &parcel);
48     virtual bool Marshalling(Parcel &parcel) const override;
49     static RequestPermissionUsedScene *Unmarshalling(Parcel &parcel);
50 };
51 
52 struct RequestPermission : public Parcelable {
53     std::string name;
54     std::string reason;
55     int32_t reasonId = 0;
56     RequestPermissionUsedScene usedScene;
57 
58     bool ReadFromParcel(Parcel &parcel);
59     virtual bool Marshalling(Parcel &parcel) const override;
60     static RequestPermission *Unmarshalling(Parcel &parcel);
61 };
62 // configuration information about a bundle
63 struct BundleInfo : public Parcelable {
64     std::string name;
65 
66     uint32_t versionCode = 0;
67     std::string versionName;
68     uint32_t minCompatibleVersionCode = 0;
69 
70     uint32_t compatibleVersion = 0;
71     uint32_t targetVersion = 0;
72 
73     bool isKeepAlive = false;
74     bool singleUser = false;
75     bool isPreInstallApp = false;
76 
77     std::string vendor;
78     std::string releaseType;
79     bool isNativeApp = false;
80 
81     std::string mainEntry; // modulePackage
82     std::string entryModuleName; // moduleName
83     bool entryInstallationFree = false;
84 
85     std::string appId;
86 
87     // user related fields, assign when calling the get interface
88     int uid = -1;
89     int gid = -1;
90     int64_t installTime = 0;
91     int64_t updateTime = 0;
92 
93     ApplicationInfo applicationInfo;
94     std::vector<AbilityInfo> abilityInfos;
95     std::vector<ExtensionAbilityInfo> extensionInfos;
96     std::vector<HapModuleInfo> hapModuleInfos;
97     std::vector<std::string> hapModuleNames;    // the "module.package" in each config.json
98     std::vector<std::string> moduleNames;       // the "module.name" in each config.json
99     std::vector<std::string> modulePublicDirs;  // the public paths of all modules of the application.
100     std::vector<std::string> moduleDirs;        // the paths of all modules of the application.
101     std::vector<std::string> moduleResPaths;    // the paths of all resources paths.
102 
103     std::vector<std::string> reqPermissions;
104     std::vector<std::string> defPermissions;
105     std::vector<int32_t> reqPermissionStates;
106     std::vector<RequestPermission> reqPermissionDetails;
107 
108     // unused
109     std::string cpuAbi;
110     std::string seInfo;
111     std::string label;
112     std::string description;
113     std::string jointUserId;
114     int32_t minSdkVersion = -1;
115     int32_t maxSdkVersion = -1;
116     bool isDifferentName = false;
117 
118     bool ReadFromParcel(Parcel &parcel);
119     virtual bool Marshalling(Parcel &parcel) const override;
120     static BundleInfo *Unmarshalling(Parcel &parcel);
121 };
122 }  // namespace AppExecFwk
123 }  // namespace OHOS
124 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_INFO_H
125