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_SHORTCUT_INFO_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_SHORTCUT_INFO_H
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 #include "parcel.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 struct ShortcutWant {
27     std::string bundleName;
28     std::string moduleName;
29     std::string abilityName;
30     std::map<std::string, std::string> parameters;
31 };
32 
33 struct Shortcut {
34     std::string shortcutId;
35     std::string icon;
36     uint32_t iconId = 0;
37     uint32_t labelId = 0;
38     std::string label;
39     std::vector<ShortcutWant> wants;
40 };
41 
42 struct ShortcutJson {
43     std::vector<Shortcut> shortcuts;
44 };
45 
46 struct ShortcutIntent {
47     std::string targetBundle;
48     std::string targetModule;
49     std::string targetClass;
50     std::map<std::string, std::string> parameters;
51 };
52 
53 struct ShortcutInfo : public Parcelable {
54     bool isStatic = false;
55     bool isHomeShortcut = false;
56     bool isEnables = false;
57     uint32_t iconId = 0;
58     uint32_t labelId = 0;
59     int32_t appIndex = 0;
60     int32_t sourceType = 0;
61     std::string id;
62     std::string bundleName;
63     std::string moduleName;
64     std::string hostAbility;
65     std::string icon;
66     std::string label;
67     std::string disableMessage;
68     std::vector<ShortcutIntent> intents;
69 
70     bool ReadFromParcel(Parcel &parcel);
71     virtual bool Marshalling(Parcel &parcel) const override;
72     static ShortcutInfo *Unmarshalling(Parcel &parcel);
73 };
74 }  // namespace AppExecFwk
75 }  // namespace OHOS
76 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_SHORTCUT_INFO_H