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_MANAGER_INNER_H 17 #define OHOS_ABILITY_MANAGER_INNER_H 18 19 #include "stdint.h" 20 21 #include "element_name.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif /* __cplusplus */ 28 29 typedef int (*StartCheckFunc)(const char *bundleName); 30 31 /** 32 * @brief Register the check function for the ability starting. 33 * 34 * @param startChecktCallback Indicates the check function for the ability starting. 35 * @return Returns <b>0</b> if this function is successfully called; returns another value otherwise. 36 */ 37 int RegAbilityCallback(StartCheckFunc startChecktCallback); 38 39 /** 40 * @brief Schedule the lifecycle of the ability. 41 * 42 * @param token Indicates the token of the ability. 43 * @param state Indicates the state of the lifecycle. 44 * @return Returns <b>0</b> if this function is successfully called; returns another value otherwise. 45 */ 46 int SchedulerLifecycleDone(uint64_t token, int state); 47 48 /** 49 * @brief Forcestop an ability based on the specified token information. 50 * 51 * @param token Indicates the token of the ability. 52 * @return Returns <b>0</b> if this function is successfully called; returns another value otherwise. 53 */ 54 int ForceStopBundle(uint64_t token); 55 56 /** 57 * @brief Get the element name of the top ability. 58 * 59 * @return Returns the element name of the top ability. 60 */ 61 ElementName *GetTopAbility(); 62 63 /** 64 * @brief Forcestop an ability based on the specified bundlename information. 65 * 66 * @param bundlename Indicates the bundlename of the ability. 67 * @return Returns <b>0</b> if this function is successfully called; returns another value otherwise. 68 */ 69 int ForceStop(char *bundlename); 70 71 /** 72 * @brief get ability callback function 73 * 74 * @return Returns the ability callback function 75 */ 76 StartCheckFunc getAbilityCallback(); 77 78 void setCleanAbilityDataFlag(bool cleanFlag); 79 80 bool getCleanAbilityDataFlag(); 81 82 #ifdef __cplusplus 83 #if __cplusplus 84 } 85 #endif 86 #endif /* __cplusplus */ 87 #endif // OHOS_ABILITY_MANAGER_INNER_H 88