1 /*
2  * Copyright (c) 2021-2023 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_FORM_INFO_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_FORM_INFO_H
18 
19 #include <string>
20 #include "extension_ability_info.h"
21 #include "extension_form_info.h"
22 #include "form_info_base.h"
23 #include "parcel.h"
24 
25 namespace OHOS {
26 namespace AppExecFwk {
27 struct FormInfo : public Parcelable {
28     std::string package;
29     std::string bundleName;
30     std::string originalBundleName;
31     std::string relatedBundleName;
32     std::string moduleName;  // the "module.distro.moduleName" in config.json
33     std::string abilityName;
34     std::string name;
35     std::string displayName;
36     std::string description;
37     std::string jsComponentName;
38     std::string deepLink;
39     std::string formConfigAbility;
40     std::string scheduledUpdateTime = "";
41     std::string src;
42     FormWindow window;
43     uint32_t displayNameId = 0;
44     uint32_t descriptionId = 0;
45     int32_t updateDuration = 0;
46     int32_t defaultDimension = 0;
47     bool defaultFlag = false;
48     bool formVisibleNotify = false;
49     bool updateEnabled = false;
50     bool isStatic = true;
51     FormType type = FormType::JS;
52     FormType uiSyntax = FormType::JS;
53     std::vector<int32_t> supportDimensions;
54     FormsColorMode colorMode = FormsColorMode::AUTO_MODE;
55     std::vector<std::string> landscapeLayouts;
56     std::vector<std::string> portraitLayouts;
57     std::vector<FormCustomizeData> customizeDatas;
58     bool dataProxyEnabled = false;
59     bool isDynamic = true;
60     bool transparencyEnabled = false;
61     int32_t privacyLevel = 0;
62     bool fontScaleFollowSystem = true;
63     std::vector<int32_t> supportShapes;
64     uint32_t versionCode = 0;
65     BundleType bundleType = BundleType::APP;
66 
67     FormInfo() = default;
68     explicit FormInfo(const ExtensionAbilityInfo &abilityInfo, const ExtensionFormInfo &formInfo);
69 
70     bool ReadFromParcel(Parcel &parcel);
71     virtual bool Marshalling(Parcel &parcel) const override;
72     static FormInfo *Unmarshalling(Parcel &parcel);
73     bool IsValid() const;
74 
75 private:
76     bool ReadCustomizeData(Parcel &parcel);
77 };
78 }  // namespace AppExecFwk
79 }  // namespace OHOS
80 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_FORM_H
81