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 ABILITY_ECOLOGICALRULEMANAGERSERVICE_PARAM_H
17 #define ABILITY_ECOLOGICALRULEMANAGERSERVICE_PARAM_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "parcel.h"
23 #include "want.h"
24 #include "ability_info.h"
25 
26 namespace OHOS {
27 namespace EcologicalRuleMgrService {
28 using Want = OHOS::AAFwk::Want;
29 
30 struct AbilityExperienceRule : public Parcelable {
31     int32_t resultCode = 10;
32     std::string sceneCode = "";
33     sptr<Want> replaceWant = nullptr;
34     bool isBackSkuExempt = false;
35 
36     bool Marshalling(Parcel &parcel) const override;
37 
38     static AbilityExperienceRule *Unmarshalling(Parcel &parcel);
39 };
40 
41 struct AbilityCallerInfo : public Parcelable {
42     enum {
43         TYPE_INVALID = 0,
44         TYPE_HARMONY_APP,
45         TYPE_ATOM_SERVICE,
46         TYPE_QUICK_APP = 4,
47         TYPE_BOXED_ATOM_SERVICE,
48         TYPE_APP_SERVICE
49     };
50 
51     enum {
52         MODEL_STAGE = 0,
53         MODEL_FA
54     };
55 
56     enum {
57         LINK_TYPE_INVALID = 0,
58         LINK_TYPE_UNIVERSAL_LINK,
59         LINK_TYPE_DEEP_LINK,
60         LINK_TYPE_WEB_LINK,
61         LINK_TYPE_ABILITY
62     };
63 
64     std::string packageName;
65     int32_t uid = 0L;
66     int32_t pid = 0L;
67 
68     int32_t callerAppType = TYPE_INVALID;
69     int32_t targetAppType = TYPE_INVALID;
70     int32_t callerModelType = MODEL_STAGE;
71     std::string targetAppDistType = "";
72     std::string targetLinkFeature = "";
73     int32_t targetLinkType = LINK_TYPE_INVALID;
74     AppExecFwk::AbilityType callerAbilityType = AppExecFwk::AbilityType::UNKNOWN;
75     int32_t embedded = 0;
76     std::string callerAppProvisionType;
77     std::string targetAppProvisionType;
78     AppExecFwk::ExtensionAbilityType callerExtensionAbilityType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED;
79     AppExecFwk::AbilityType targetAbilityType = AppExecFwk::AbilityType::UNKNOWN;
80     AppExecFwk::ExtensionAbilityType targetExtensionAbilityType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED;
81     int32_t userId = 0;
82 
83     bool ReadFromParcel(Parcel &parcel);
84 
85     bool Marshalling(Parcel &parcel) const override;
86     bool DoMarshallingOne(Parcel& parcel) const;
87 
88     static AbilityCallerInfo *Unmarshalling(Parcel &parcel);
89 
90     std::string ToString() const;
91 };
92 
93 } // namespace EcologicalRuleMgrService
94 } // namespace OHOS
95 #endif // ABILITY_ECOLOGICALRULEMANAGERSERVICE_PARAM_H
96