• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class LiteContext {
24 public:
25     LiteContext() = default;
26     ~LiteContext() = default;
27 
28     /**
29      * @brief Starts an {@link Ability} based on the specified {@link Want} information.
30      *
31      * @param want Indicates the pointer to the {@link Want} structure containing information about the ability to
32      *             start.
33      * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
34      */
35     int StartAbility(const Want &want);
36 
37     /**
38      * @brief Destroys this {@link Ability}.
39      *
40      * This function can be called only by this ability.
41      *
42      * @return Returns <b>0</b> if the operation is successful; returns <b>-1</b> otherwise.
43      */
44     int TerminateAbility();
45 private:
46     friend class SliteAbility;
47     uint64_t token_ { 0 };
48 };
49 } //  OHOS
50 
51 #endif //  OHOS_LITE_CONTEXT_H
52