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_MANAGER_SERVICE_IMPL_H 17 #define OHOS_ABILITY_MANAGER_SERVICE_IMPL_H 18 19 #include "ability_connect_trans_param.h" 20 #include "ability_worker.h" 21 #include "client/ability_dump_client.h" 22 #include "client/bundlems_client.h" 23 #include "message.h" 24 #include "nocopyable.h" 25 26 namespace OHOS { 27 class AbilityMgrHandler : public NoCopyable { 28 public: GetInstance()29 static AbilityMgrHandler &GetInstance() 30 { 31 static AbilityMgrHandler instance; 32 return instance; 33 } 34 ~AbilityMgrHandler() = default; 35 void Init(); 36 void ServiceMsgProcess(const Request& request); 37 private: 38 AbilityMgrHandler() = default; 39 void OnServiceInited(); 40 void StartKeepAliveApps(); 41 void StartKeepAliveApp(const BundleInfo &bundleInfo); 42 void StartLauncher(); 43 int StartAbility(const Want *want, pid_t callingUid); 44 void AttachBundle(AbilityThreadClient *client); 45 void TerminateAbility(const uint64_t *token); 46 void AbilityTransaction(TransactionState *state); 47 void TerminateApp(const char *bundleName); 48 void RestartApp(const char *bundleName); 49 50 int ConnectAbility(AbilityConnectTransParam *transParam); 51 void DisconnectAbility(AbilityConnectTransParam *transParam); 52 void ConnectAbilityDone(AbilityConnectTransParam *transParam); 53 void DisconnectAbilityDone(const uint64_t *token); 54 void TerminateService(Want *want, pid_t callingUid); 55 void StartAbilityCallback(const Want *want, int code); 56 void DumpAbility(const AbilityDumpClient *client); 57 void ConnectAbilityCallback(AbilityConnectTransParam *transParam, int code); 58 59 AbilityWorker abilityWorker_; 60 BundleMsClient bundleMsClient_; 61 }; 62 } // namespace OHOS 63 #endif // OHOS_ABILITY_MANAGER_SERVICE_IMPL_H 64