1 /* 2 * Copyright (c) 2021-2023 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 #include "remote_client_manager.h" 17 18 #include "hilog_wrapper.h" 19 #include "iservice_registry.h" 20 #include "singleton.h" 21 #include "system_ability_definition.h" 22 23 24 namespace OHOS { 25 namespace AppExecFwk { RemoteClientManager()26RemoteClientManager::RemoteClientManager() 27 : appSpawnClient_(std::make_shared<AppSpawnClient>()), nwebSpawnClient_(std::make_shared<AppSpawnClient>(true)) 28 {} 29 ~RemoteClientManager()30RemoteClientManager::~RemoteClientManager() 31 {} 32 GetSpawnClient()33std::shared_ptr<AppSpawnClient> RemoteClientManager::GetSpawnClient() 34 { 35 if (appSpawnClient_) { 36 return appSpawnClient_; 37 } 38 return nullptr; 39 } 40 SetSpawnClient(const std::shared_ptr<AppSpawnClient> & appSpawnClient)41void RemoteClientManager::SetSpawnClient(const std::shared_ptr<AppSpawnClient> &appSpawnClient) 42 { 43 appSpawnClient_ = appSpawnClient; 44 } 45 GetBundleManagerHelper()46std::shared_ptr<BundleMgrHelper> RemoteClientManager::GetBundleManagerHelper() 47 { 48 if (bundleManagerHelper_ == nullptr) { 49 bundleManagerHelper_ = DelayedSingleton<BundleMgrHelper>::GetInstance(); 50 } 51 return bundleManagerHelper_; 52 } 53 SetBundleManagerHelper(const std::shared_ptr<BundleMgrHelper> & bundleMgrHelper)54void RemoteClientManager::SetBundleManagerHelper(const std::shared_ptr<BundleMgrHelper> &bundleMgrHelper) 55 { 56 bundleManagerHelper_ = bundleMgrHelper; 57 } 58 GetNWebSpawnClient()59std::shared_ptr<AppSpawnClient> RemoteClientManager::GetNWebSpawnClient() 60 { 61 return nwebSpawnClient_; 62 } 63 } // namespace AppExecFwk 64 } // namespace OHOS 65