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_LITE_CONTEXT_H
17 #define OHOS_LITE_CONTEXT_H
18 
19 #include "ability_manager.h"
20 #include "want.h"
21 
22 namespace OHOS {
23 namespace AbilitySlite {
24 class LiteContext {
25 public:
26     LiteContext() = default;
27 
28     ~LiteContext() = default;
29 
30     /**
31      * @brief Starts an {@link Ability} based on the specified {@link Want} information.
32      *
33      * @param want Indicates the pointer to the {@link Want} structure containing information about the ability to
34      *             start.
35      * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
36      */
37     int StartAbility(const Want &want);
38 
39     /**
40      * @brief Destroys this {@link Ability}.
41      *
42      * This function can be called only by this ability.
43      *
44      * @return Returns <b>0</b> if the operation is successful; returns <b>-1</b> otherwise.
45      */
46     int TerminateAbility();
47 
48     void SetToken(uint64_t token);
49 
50 protected:
51     uint64_t token_ { 0 };
52 };
53 } // namespace AbilitySlite
54 using AbilitySlite::LiteContext;
55 } // namespace OHOS
56 #endif //  OHOS_LITE_CONTEXT_H
57