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