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_ABILITY_WORKER_H
17 #define OHOS_ABILITY_WORKER_H
18 
19 #include "ability_connect_trans_param.h"
20 #include "ability_mgr_context.h"
21 #include "client/ability_dump_client.h"
22 #include "client/ability_thread_client.h"
23 
24 namespace OHOS {
25 class AbilityWorker {
26 public:
27     AbilityWorker();
28     ~AbilityWorker();
29 
30     AbilityMsStatus StartAbility(const Want &want, const AbilityInfo &target, const BundleInfo &bundleInfo, pid_t uid);
31     AbilityMsStatus AttachBundle(const AbilityThreadClient &client);
32     AbilityMsStatus TerminateAbility(uint64_t token);
33     AbilityMsStatus AbilityTransaction(const TransactionState &state);
34     AbilityMsStatus TerminateApp(const char *bundleName);
35     AbilityMsStatus RestartApp(const BundleInfo &bundleInfo);
36     AbilityMsStatus DumpAbility(const AbilityDumpClient &client);
37 
38     AbilityMsStatus TerminateService(const AbilityInfo &target, const BundleInfo &bundleInfo, pid_t callingUid);
39     AbilityMsStatus ConnectAbility(const AbilityConnectTransParam &connectParam, const AbilityInfo &target,
40             const BundleInfo &bundleInfo);
41     AbilityMsStatus DisconnectAbility(const SvcIdentity &identity, uint64_t token);
42     AbilityMsStatus ConnectAbilityDone(const SvcIdentity &identity, uint64_t token);
43     AbilityMsStatus DisconnectAbilityDone(uint64_t token);
44 
45 private:
46     AbilityMgrContext *abilityMgrContext_ { nullptr };
47 };
48 }  // namespace OHOS
49 #endif  // OHOS_ABILITY_WORKER_H
50