1 /* 2 * Copyright (c) 2020 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_AMS_INTERFACE_H 17 #define OHOS_AMS_INTERFACE_H 18 19 #include "feature.h" 20 #ifndef __LITEOS_M__ 21 #include "iproxy_server.h" 22 #else 23 #include "iunknown.h" 24 #endif 25 #include "want.h" 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif 31 #endif /* __cplusplus */ 32 33 const char AMS_SERVICE[] = "abilityms"; 34 const char AMS_FEATURE[] = "AmsFeature"; 35 const char AMS_SLITE_FEATURE[] = "AmsSliteFeature"; 36 const char AMS_INNER_FEATURE[] = "AmsInnerFeature"; 37 38 enum AmsCommand { 39 START_ABILITY = 0, 40 TERMINATE_ABILITY, 41 ATTACH_BUNDLE, 42 CONNECT_ABILITY, 43 CONNECT_ABILITY_DONE, 44 DISCONNECT_ABILITY, 45 DISCONNECT_ABILITY_DONE, 46 ABILITY_TRANSACTION_DONE, 47 TERMINATE_SERVICE, 48 START_ABILITY_WITH_CB, 49 INNER_BEGIN, 50 TERMINATE_APP = INNER_BEGIN, 51 DUMP_ABILITY, 52 TERMINATE_APP_BY_BUNDLENAME, 53 COMMAND_END, 54 }; 55 56 #ifndef __LITEOS_M__ 57 /** 58 * Expose to start or terminate ability. 59 */ 60 struct AmsInterface { 61 INHERIT_SERVER_IPROXY; 62 int32 (*StartAbility)(const Want *want); 63 int32 (*TerminateAbility)(uint64_t token); 64 int32 (*ConnectAbility)(const Want *want, SvcIdentity *svc, uint64_t token); 65 int32 (*DisconnectAbility)(SvcIdentity *svc, uint64_t token); 66 int32 (*StopAbility)(const Want *want); 67 }; 68 69 struct AmsInnerInterface { 70 INHERIT_SERVER_IPROXY; 71 int32 (*StartKeepAliveApps)(); 72 int32 (*TerminateApp)(const char *bundleName); 73 }; 74 #endif 75 struct AmsSliteInterface { 76 INHERIT_IUNKNOWN; 77 int32 (*StartAbility)(const Want *want); 78 int32 (*TerminateAbility)(uint64_t token); 79 int32 (*SchedulerLifecycleDone)(uint64_t token, int state); 80 int32 (*ForceStopBundle)(uint64_t token); 81 ElementName *(*GetTopAbility)(); 82 }; 83 #ifdef __cplusplus 84 #if __cplusplus 85 } 86 #endif 87 #endif /* __cplusplus */ 88 #endif // OHOS_AMS_INTERFACE_H 89