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