1 /*
2  * Copyright (c) 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 OHOS_ABILITY_RUNTIME_SERVICE_ROUTER_FRAMEWORK_INCLUDE_SERVICE_INFO_H
17 #define OHOS_ABILITY_RUNTIME_SERVICE_ROUTER_FRAMEWORK_INCLUDE_SERVICE_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "parcel.h"
23 
24 namespace OHOS {
25 namespace AbilityRuntime {
26 enum class BusinessType {
27     SHARE = 0,
28     UNSPECIFIED = 255
29 };
30 
31 enum class ComponentType {
32     UI_ABILITY = 0,
33     FORM = 1,
34     UI_EXTENSION = 2
35 };
36 
37 struct AppInfo : public Parcelable {
38     std::string bundleName;
39     int32_t iconId = 0;
40     int32_t labelId = 0;
41     int32_t descriptionId = 0;
42 
43     bool ReadFromParcel(Parcel &parcel);
44     virtual bool Marshalling(Parcel &parcel) const override;
45     static AppInfo *Unmarshalling(Parcel &parcel);
46 };
47 
48 struct BusinessAbilityFilter : public Parcelable {
49     BusinessType businessType;
50     std::string mimeType;
51     std::string uri;
52 
53     bool ReadFromParcel(Parcel &parcel);
54     virtual bool Marshalling(Parcel &parcel) const override;
55     static BusinessAbilityFilter *Unmarshalling(Parcel &parcel);
56 };
57 
58 struct BusinessAbilityInfo : public Parcelable {
59     AppInfo appInfo;
60     std::string bundleName;
61     std::string moduleName;
62     std::string abilityName;
63     BusinessType businessType;
64     int32_t iconId = 0;
65     int32_t labelId = 0;
66     int32_t descriptionId = 0;
67     std::vector<std::string> permissions;
68 
69     bool ReadFromParcel(Parcel &parcel);
70     virtual bool Marshalling(Parcel &parcel) const override;
71     static BusinessAbilityInfo *Unmarshalling(Parcel &parcel);
72 };
73 
74 struct PurposeInfo final : public Parcelable {
75     AppInfo appInfo;
76     std::string purposeName;
77     std::string bundleName;
78     std::string moduleName;
79     std::string abilityName;
80     std::string cardName;
81     std::vector<int32_t> supportDimensions;
82     ComponentType componentType;
83 
84     bool ReadFromParcel(Parcel &parcel);
85     virtual bool Marshalling(Parcel &parcel) const override;
86     static PurposeInfo *Unmarshalling(Parcel &parcel);
87 };
88 } // AbilityRuntime
89 } // OHOS
90 #endif // OHOS_ABILITY_RUNTIME_SERVICE_ROUTER_FRAMEWORK_INCLUDE_SERVICE_INFO_H