mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2024-11-23 16:09:48 +00:00
commit
9f0dbddc75
1
BUILD.gn
1
BUILD.gn
@ -32,6 +32,7 @@ ohos_shared_library("tel_core_service") {
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/core/src/core_service_dump_helper.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/core/src/core_service_hisysevent.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/core/src/core_service_stub.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/core/src/runner_pool.cpp",
|
||||
"$TELEPHONY_IMS_CORE_SERVICE_SRC_PATH/ims_core_service_callback_stub.cpp",
|
||||
"$TELEPHONY_IMS_CORE_SERVICE_SRC_PATH/ims_core_service_client.cpp",
|
||||
"$TELEPHONY_IMS_CORE_SERVICE_SRC_PATH/ims_core_service_proxy.cpp",
|
||||
|
44
services/core/include/runner_pool.h
Executable file
44
services/core/include/runner_pool.h
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RUNNER_POOL_H
|
||||
#define RUNNER_POOL_H
|
||||
|
||||
#include <mutex>
|
||||
#include "event_runner.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class RunnerPool {
|
||||
public:
|
||||
static RunnerPool &GetInstance();
|
||||
void Init();
|
||||
std::shared_ptr<AppExecFwk::EventRunner> GetCommonRunner();
|
||||
std::shared_ptr<AppExecFwk::EventRunner> GetSimDbAndFileRunner();
|
||||
|
||||
private:
|
||||
std::shared_ptr<AppExecFwk::EventRunner> CreateRunner(const std::string &name);
|
||||
RunnerPool() = default;
|
||||
~RunnerPool() = default;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AppExecFwk::EventRunner> commonRunner_ = nullptr;
|
||||
std::shared_ptr<AppExecFwk::EventRunner> simDbAndFileRunner_ = nullptr;
|
||||
static RunnerPool runnerPool_;
|
||||
bool isInit_ = false;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // RUNNER_POOL_H
|
@ -21,6 +21,7 @@
|
||||
#include "network_search_manager.h"
|
||||
#include "network_search_types.h"
|
||||
#include "parameter.h"
|
||||
#include "runner_pool.h"
|
||||
#include "sim_manager.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
@ -56,7 +57,7 @@ void CoreService::OnStart()
|
||||
}
|
||||
registerToService_ = true;
|
||||
}
|
||||
|
||||
RunnerPool::GetInstance().Init();
|
||||
if (!Init()) {
|
||||
TELEPHONY_LOGE("failed to init CoreService");
|
||||
return;
|
||||
|
66
services/core/src/runner_pool.cpp
Normal file
66
services/core/src/runner_pool.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "runner_pool.h"
|
||||
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
RunnerPool RunnerPool::runnerPool_;
|
||||
|
||||
RunnerPool &RunnerPool::GetInstance()
|
||||
{
|
||||
return runnerPool_;
|
||||
}
|
||||
|
||||
void RunnerPool::Init()
|
||||
{
|
||||
if (isInit_) {
|
||||
TELEPHONY_LOGI("RunnerPool has init");
|
||||
return;
|
||||
}
|
||||
commonRunner_ = CreateRunner("CoreServiceCommonRunner");
|
||||
simDbAndFileRunner_ = CreateRunner("SimDbAndFileRunner");
|
||||
if (commonRunner_ == nullptr || simDbAndFileRunner_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
isInit_ = true;
|
||||
TELEPHONY_LOGI("RunnerPool init success");
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::EventRunner> RunnerPool::CreateRunner(const std::string &name)
|
||||
{
|
||||
auto runner = AppExecFwk::EventRunner::Create(name);
|
||||
if (runner == nullptr) {
|
||||
TELEPHONY_LOGE("%{public}s runner create thread fail!", name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
runner->Run();
|
||||
return runner;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::EventRunner> RunnerPool::GetCommonRunner()
|
||||
{
|
||||
return commonRunner_;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::EventRunner> RunnerPool::GetSimDbAndFileRunner()
|
||||
{
|
||||
return simDbAndFileRunner_;
|
||||
}
|
||||
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include "icc_dialling_numbers_cache.h"
|
||||
|
||||
#include "runner_pool.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
IccDiallingNumbersCache::IccDiallingNumbersCache(
|
||||
@ -42,7 +44,7 @@ void IccDiallingNumbersCache::Init()
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = AppExecFwk::EventRunner::Create("usimpdiallingnumbers");
|
||||
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (loaderLoop.get() == nullptr) {
|
||||
TELEPHONY_LOGE("IccDiallingNumbersCache failed to create usimpdiallingnumbers loop");
|
||||
return;
|
||||
@ -54,7 +56,6 @@ void IccDiallingNumbersCache::Init()
|
||||
}
|
||||
std::shared_ptr<IccFileController> fileController = simFileManager_->GetIccFileController();
|
||||
usimDiallingNumberSrv_->SetFileControllerAndDiallingNumberHandler(fileController, diallingNumbersHandler_);
|
||||
loaderLoop->Run();
|
||||
}
|
||||
|
||||
void IccDiallingNumbersCache::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "core_service_errors.h"
|
||||
#include "radio_event.h"
|
||||
#include "runner_pool.h"
|
||||
#include "telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -36,7 +37,7 @@ void IccDiallingNumbersManager::Init()
|
||||
return;
|
||||
}
|
||||
|
||||
eventLoopDiallingNumbers_ = AppExecFwk::EventRunner::Create("diallingNumbersCacheLoop");
|
||||
eventLoopDiallingNumbers_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoopDiallingNumbers_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("IccDiallingNumbersManager failed to create EventRunner");
|
||||
return;
|
||||
@ -53,7 +54,6 @@ void IccDiallingNumbersManager::Init()
|
||||
return;
|
||||
}
|
||||
|
||||
eventLoopDiallingNumbers_->Run();
|
||||
stateDiallingNumbers_ = HandleRunningState::STATE_RUNNING;
|
||||
|
||||
diallingNumbersCache_->Init();
|
||||
@ -340,8 +340,7 @@ bool IccDiallingNumbersManager::IsValidType(int type)
|
||||
std::shared_ptr<IccDiallingNumbersManager> IccDiallingNumbersManager::CreateInstance(
|
||||
const std::shared_ptr<SimFileManager> &simFile, const std::shared_ptr<SimStateManager> &simState)
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::EventRunner> eventLoop =
|
||||
AppExecFwk::EventRunner::Create("diallingNumbersManagerLoop");
|
||||
std::shared_ptr<AppExecFwk::EventRunner> eventLoop = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoop.get() == nullptr) {
|
||||
TELEPHONY_LOGE("IccDiallingNumbersManager failed to create EventRunner");
|
||||
return nullptr;
|
||||
@ -356,7 +355,6 @@ std::shared_ptr<IccDiallingNumbersManager> IccDiallingNumbersManager::CreateInst
|
||||
TELEPHONY_LOGE("IccDiallingNumbersManager::Init manager create nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
eventLoop->Run();
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,10 @@
|
||||
#include <mutex>
|
||||
|
||||
#include "inner_event.h"
|
||||
#include "radio_event.h"
|
||||
#include "runner_pool.h"
|
||||
#include "sim_data_type.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
#include "radio_event.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
@ -193,15 +194,12 @@ void IccOperatorPrivilegeController::Init(const int32_t slotId)
|
||||
return;
|
||||
}
|
||||
if (this->GetEventRunner() == nullptr) {
|
||||
auto runner = AppExecFwk::EventRunner::Create("UsimOperatorPrivilegeManager");
|
||||
auto runner = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (runner == nullptr) {
|
||||
TELEPHONY_LOGE("IccOperatorPrivilegeController::Init Create thread fail!");
|
||||
return;
|
||||
}
|
||||
this->SetEventRunner(runner);
|
||||
if (runner->Run() != ERR_OK) {
|
||||
TELEPHONY_LOGE("runner->Run() fail!!");
|
||||
}
|
||||
}
|
||||
auto self = this->shared_from_this();
|
||||
simStateManager_->RegisterCoreNotify(self, RadioEvent::RADIO_SIM_STATE_CHANGE);
|
||||
|
@ -30,9 +30,6 @@ MultiSimMonitor::MultiSimMonitor(const std::shared_ptr<AppExecFwk::EventRunner>
|
||||
: AppExecFwk::EventHandler(runner), controller_(controller),
|
||||
simStateManager_(simStateManager), simFileManager_(simFileManager)
|
||||
{
|
||||
if (runner != nullptr) {
|
||||
runner->Run();
|
||||
}
|
||||
if (observerHandler_ == nullptr) {
|
||||
observerHandler_ = std::make_unique<ObserverHandler>();
|
||||
}
|
||||
|
@ -30,9 +30,6 @@ OperatorConfigCache::OperatorConfigCache(const std::shared_ptr<AppExecFwk::Event
|
||||
std::shared_ptr<SimFileManager> simFileManager, int32_t slotId)
|
||||
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager), slotId_(slotId)
|
||||
{
|
||||
if (runner != nullptr) {
|
||||
runner->Run();
|
||||
}
|
||||
TELEPHONY_LOGI("OperatorConfigCache create");
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,7 @@ std::condition_variable RadioProtocolController::cv_;
|
||||
RadioProtocolController::RadioProtocolController(std::shared_ptr<Telephony::ITelRilManager> telRilManager,
|
||||
const std::shared_ptr<AppExecFwk::EventRunner> &runner)
|
||||
: AppExecFwk::EventHandler(runner), telRilManager_(telRilManager)
|
||||
{
|
||||
if (runner != nullptr) {
|
||||
runner->Run();
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
void RadioProtocolController::Init()
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "sim_account_manager.h"
|
||||
|
||||
#include "runner_pool.h"
|
||||
#include "string_ex.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -47,7 +48,7 @@ void SimAccountManager::Init(int32_t slotId)
|
||||
TELEPHONY_LOGE("SimAccountManager::init SimAccountManager invalid slotId = %{public}d", slotId);
|
||||
return;
|
||||
}
|
||||
operatorConfigCacheRunner_ = AppExecFwk::EventRunner::Create("OperatorConfigCache");
|
||||
operatorConfigCacheRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
|
||||
if (operatorConfigCacheRunner_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimAccountManager::Init operatorConfigCacheRunner_ failed");
|
||||
return;
|
||||
@ -58,7 +59,7 @@ void SimAccountManager::Init(int32_t slotId)
|
||||
return;
|
||||
}
|
||||
operatorConfigCache_->RegisterForIccChange();
|
||||
simStateTrackerRunner_ = AppExecFwk::EventRunner::Create("SimStateTracker");
|
||||
simStateTrackerRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
|
||||
if (simStateTrackerRunner_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimAccountManager::Init simStateTrackerRunner_ failed");
|
||||
return;
|
||||
@ -111,7 +112,7 @@ int32_t SimAccountManager::HasOperatorPrivileges(const int32_t slotId, bool &has
|
||||
}
|
||||
if (privilegesRunner_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("make privilegesRunner_");
|
||||
privilegesRunner_ = AppExecFwk::EventRunner::Create("PrivilegeController");
|
||||
privilegesRunner_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
}
|
||||
if ((privilegesRunner_ == nullptr) || (telRilManager_ == nullptr) || (simStateManager_ == nullptr)) {
|
||||
TELEPHONY_LOGE("has nullptr at privilegesRunner_ or telRilManager_ or simStateManager_");
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "network_state.h"
|
||||
#include "radio_event.h"
|
||||
#include "runner_pool.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
@ -89,7 +90,7 @@ bool SimFileManager::InitSimFile(SimFileManager::IccType type)
|
||||
return false;
|
||||
}
|
||||
if (eventLoopRecord_ == nullptr) {
|
||||
eventLoopRecord_ = AppExecFwk::EventRunner::Create("IccFile");
|
||||
eventLoopRecord_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoopRecord_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("IccFile failed to create EventRunner");
|
||||
return false;
|
||||
@ -116,7 +117,6 @@ bool SimFileManager::InitSimFile(SimFileManager::IccType type)
|
||||
return false;
|
||||
}
|
||||
simFile_->SetRilAndFileController(telRilManager_, fileController_, diallingNumberHandler_);
|
||||
eventLoopRecord_->Run();
|
||||
simFile_->SetId(slotId_);
|
||||
simFile_->Init();
|
||||
return true;
|
||||
@ -125,7 +125,7 @@ bool SimFileManager::InitSimFile(SimFileManager::IccType type)
|
||||
bool SimFileManager::InitIccFileController(SimFileManager::IccType type)
|
||||
{
|
||||
if (eventLoopFileController_ == nullptr) {
|
||||
eventLoopFileController_ = AppExecFwk::EventRunner::Create("SIMController");
|
||||
eventLoopFileController_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoopFileController_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SIMHandler failed to create EventRunner");
|
||||
return false;
|
||||
@ -153,7 +153,6 @@ bool SimFileManager::InitIccFileController(SimFileManager::IccType type)
|
||||
return false;
|
||||
}
|
||||
fileController_->SetRilManager(telRilManager_);
|
||||
eventLoopFileController_->Run();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -468,7 +467,7 @@ bool SimFileManager::InitDiallingNumberHandler()
|
||||
diallingNumberHandler_->UpdateFileController(fileController_);
|
||||
return true;
|
||||
}
|
||||
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = AppExecFwk::EventRunner::Create("msisdnLoader");
|
||||
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (loaderLoop.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimFileManager failed to create diallingNumberloader loop");
|
||||
return false;
|
||||
@ -478,7 +477,6 @@ bool SimFileManager::InitDiallingNumberHandler()
|
||||
TELEPHONY_LOGE("SimFileManager failed to create IccDiallingNumbersHandler.");
|
||||
return false;
|
||||
}
|
||||
loaderLoop->Run();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -527,7 +525,7 @@ void SimFileManager::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
std::shared_ptr<SimFileManager> SimFileManager::CreateInstance(
|
||||
const std::shared_ptr<ITelRilManager> &ril, const std::shared_ptr<SimStateManager> &simState)
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::EventRunner> eventLoop = AppExecFwk::EventRunner::Create("simFileMgrLoop");
|
||||
std::shared_ptr<AppExecFwk::EventRunner> eventLoop = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoop.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimFileManager failed to create EventRunner");
|
||||
return nullptr;
|
||||
@ -541,7 +539,7 @@ std::shared_ptr<SimFileManager> SimFileManager::CreateInstance(
|
||||
TELEPHONY_LOGE("SimFileManager::Init manager create nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
eventLoop->Run();
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "core_service_errors.h"
|
||||
#include "radio_event.h"
|
||||
#include "runner_pool.h"
|
||||
#include "telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -92,7 +93,7 @@ void SimManager::InitMultiSimObject()
|
||||
|
||||
void SimManager::InitSingleSimObject()
|
||||
{
|
||||
controllerRunner_ = AppExecFwk::EventRunner::Create("MultiSimController");
|
||||
controllerRunner_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (controllerRunner_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimManager::InitSingleSimObject get controllerRunner_ failed");
|
||||
return;
|
||||
@ -105,11 +106,7 @@ void SimManager::InitSingleSimObject()
|
||||
}
|
||||
multiSimController_->Init();
|
||||
|
||||
monitorRunner_ = AppExecFwk::EventRunner::Create("MultiSimMonitor");
|
||||
if (monitorRunner_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("get monitorRunner_ failed");
|
||||
return;
|
||||
}
|
||||
monitorRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
|
||||
multiSimMonitor_ = std::make_shared<MultiSimMonitor>(
|
||||
monitorRunner_, multiSimController_, simStateManager_, simFileManager_);
|
||||
if (multiSimMonitor_ == nullptr) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "sim_sms_manager.h"
|
||||
|
||||
#include "telephony_errors.h"
|
||||
#include "runner_pool.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
@ -42,7 +43,7 @@ void SimSmsManager::Init(int slotId)
|
||||
return;
|
||||
}
|
||||
|
||||
eventLoopSms_ = AppExecFwk::EventRunner::Create("simSmsController");
|
||||
eventLoopSms_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoopSms_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("simSmsController failed to create EventRunner");
|
||||
return;
|
||||
@ -61,7 +62,6 @@ void SimSmsManager::Init(int slotId)
|
||||
}
|
||||
smsController_->SetRilAndFileManager(telRilManager_, fileManager);
|
||||
|
||||
eventLoopSms_->Run();
|
||||
stateSms_ = HandleRunningState::STATE_RUNNING;
|
||||
|
||||
smsController_->Init(slotId_);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "sim_state_manager.h"
|
||||
|
||||
#include "core_service_errors.h"
|
||||
#include "runner_pool.h"
|
||||
#include "telephony_errors.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
@ -43,7 +44,7 @@ void SimStateManager::Init(int32_t slotId)
|
||||
TELEPHONY_LOGE("SimStateManager::Init telRilManager_ is null.");
|
||||
return;
|
||||
}
|
||||
eventLoop_ = AppExecFwk::EventRunner::Create("SimStateHandle");
|
||||
eventLoop_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (eventLoop_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("SimStateHandle failed to create EventRunner");
|
||||
return;
|
||||
@ -55,7 +56,7 @@ void SimStateManager::Init(int32_t slotId)
|
||||
}
|
||||
simStateHandle_->SetRilManager(telRilManager_);
|
||||
simStateHandle_->Init(slotId);
|
||||
eventLoop_->Run();
|
||||
|
||||
TELEPHONY_LOGI("SimStateManager::eventLoop_ is running");
|
||||
simStateRun_ = STATE_RUNNING;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "core_manager_inner.h"
|
||||
#include "radio_event.h"
|
||||
#include "thread"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
@ -26,9 +27,6 @@ SimStateTracker::SimStateTracker(const std::shared_ptr<AppExecFwk::EventRunner>
|
||||
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager), operatorConfigCache_(operatorConfigCache),
|
||||
slotId_(slotId)
|
||||
{
|
||||
if (runner != nullptr) {
|
||||
runner->Run();
|
||||
}
|
||||
if (simFileManager == nullptr) {
|
||||
TELEPHONY_LOGE("can not make OperatorConfigLoader");
|
||||
}
|
||||
@ -71,7 +69,11 @@ void SimStateTracker::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
TELEPHONY_LOGE("sim is not exist");
|
||||
return;
|
||||
}
|
||||
operatorConfigLoader_->LoadOperatorConfig(slotId_);
|
||||
std::thread loadOperatorConfigTask([&]() {
|
||||
pthread_setname_np(pthread_self(), "load_operator_config");
|
||||
operatorConfigLoader_->LoadOperatorConfig(slotId_);
|
||||
});
|
||||
loadOperatorConfigTask.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "stk_manager.h"
|
||||
|
||||
#include "runner_pool.h"
|
||||
#include "telephony_errors.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
@ -40,9 +41,7 @@ void StkManager::Init(int slotId)
|
||||
TELEPHONY_LOGE("StkManager[%{public}d]::Init() telRilManager or simStateManager_ is nullptr", slotId);
|
||||
return;
|
||||
}
|
||||
std::string name = "StkController_";
|
||||
name.append(std::to_string(slotId));
|
||||
stkEventLoop_ = AppExecFwk::EventRunner::Create(name.c_str());
|
||||
stkEventLoop_ = RunnerPool::GetInstance().GetCommonRunner();
|
||||
if (stkEventLoop_.get() == nullptr) {
|
||||
TELEPHONY_LOGE("StkManager[%{public}d]::Init() failed to create EventRunner", slotId);
|
||||
return;
|
||||
@ -53,7 +52,6 @@ void StkManager::Init(int slotId)
|
||||
return;
|
||||
}
|
||||
stkController_->Init();
|
||||
stkEventLoop_->Run();
|
||||
TELEPHONY_LOGI("StkManager[%{public}d]::Init() success", slotId);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user