1 /*
2  * Copyright (c) 2021 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_WANT_AGENT_CONSTANT_H
17 #define OHOS_ABILITY_RUNTIME_WANT_AGENT_CONSTANT_H
18 
19 namespace OHOS::AbilityRuntime::WantAgent {
20 /// <summary>
21 /// Provides enumerated constants that are used for setting object attributes in the methods provided by
22 /// <seealso cref="WantAgentInfo"/>.
23 ///
24 /// </summary>
25 class WantAgentConstant final {
26     /// <summary>
27     /// Enumerates flags for using an <seealso cref="WantAgent"/>.
28     ///
29     /// </summary>
30 public:
31     enum class Flags {
32         /// <summary>
33         /// Indicates that the <seealso cref="WantAgent"/> can be used only once.
34         /// </summary>
35         ONE_TIME_FLAG,
36 
37         /// <summary>
38         /// Indicates that {@code null} is returned if the <seealso cref="WantAgent"/> does not exist.
39         /// </summary>
40         NO_BUILD_FLAG,
41 
42         /// <summary>
43         /// Indicates that the existing <seealso cref="WantAgent"/> should be canceled before the new object is
44         /// generated.
45         /// </summary>
46         CANCEL_PRESENT_FLAG,
47 
48         /// <summary>
49         /// Indicates that the system only replaces the extra data of the existing <seealso cref="WantAgent"/>
50         /// with that of the new object.
51         /// </summary>
52         UPDATE_PRESENT_FLAG,
53 
54         /// <summary>
55         /// Indicates that the created <seealso cref="WantAgent"/> should be immutable.
56         /// </summary>
57         CONSTANT_FLAG,
58 
59         /// <summary>
60         /// Indicates that the current value of {@code element} can be replaced
61         /// when the <seealso cref="WantAgent"/> is triggered.
62         /// </summary>
63         REPLACE_ELEMENT,
64 
65         /// <summary>
66         /// Indicates that the current value of {@code action} can be replaced
67         /// when the <seealso cref="WantAgent"/> is triggered.
68         /// </summary>
69         REPLACE_ACTION,
70 
71         /// <summary>
72         /// Indicates that the current value of {@code uri} can be replaced when the <seealso cref="WantAgent"/> is
73         /// triggered.
74         /// </summary>
75         REPLACE_URI,
76 
77         /// <summary>
78         /// Indicates that the current value of {@code entities} can be replaced
79         /// when the <seealso cref="WantAgent"/> is triggered.
80         /// </summary>
81         REPLACE_ENTITIES,
82 
83         /// <summary>
84         /// Indicates that the current value of {@code bundleName} can be replaced
85         /// when the <seealso cref="WantAgent"/> is triggered.
86         /// </summary>
87         REPLACE_BUNDLE,
88 
89         /// <summary>
90         /// Indicates that the existing <seealso cref="WantAgent"/> allow canceled by user.
91         /// </summary>
92         ALLOW_CANCEL_FLAG
93     };
94 
95     /// <summary>
96     /// Identifies the operation for using an <seealso cref="WantAgent"/>, such as starting an ability or sending a
97     /// common event.
98     ///
99     /// </summary>
100 public:
101     enum class OperationType {
102         /// <summary>
103         /// Unknown operation.
104         /// </summary>
105         UNKNOWN_TYPE,
106 
107         /// <summary>
108         /// Starts an ability with a UI.
109         /// </summary>
110         START_ABILITY,
111 
112         /// <summary>
113         /// Starts multiple abilities.
114         /// </summary>
115         START_ABILITIES,
116 
117         /// <summary>
118         /// Starts an ability without a UI.
119         /// </summary>
120         START_SERVICE,
121 
122         /// <summary>
123         /// Sends a common event.
124         /// </summary>
125         SEND_COMMON_EVENT,
126 
127         /// <summary>
128         /// Starts a foreground ability without a UI.
129         /// </summary>
130         START_FOREGROUND_SERVICE,
131 
132         START_SERVICE_EXTENSION
133     };
134 
135 private:
WantAgentConstant()136     WantAgentConstant() {};
137     virtual ~WantAgentConstant() = default;
138 };
139 }  // namespace OHOS::AbilityRuntime::WantAgent
140 #endif  // OHOS_ABILITY_RUNTIME_WANT_AGENT_CONSTANT_H
141