Merge pull request !1657 from Aurora/master
This commit is contained in:
openharmony_ci 2023-12-22 14:17:22 +00:00 committed by Gitee
commit 14aba8f89c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
58 changed files with 263 additions and 582 deletions

View File

@ -115,7 +115,6 @@ ohos_shared_library("tel_core_service") {
"services/core/src/core_service_dump_helper.cpp",
"services/core/src/core_service_hisysevent.cpp",
"services/core/src/core_service_stub.cpp",
"services/core/src/runner_pool.cpp",
]
include_dirs = [

View File

@ -17,11 +17,13 @@
#define TELEPHONY_IMS_CORE_SERVICE_CALLBACK_STUB_H
#include <map>
#include "iremote_stub.h"
#include "ims_core_service_callback_interface.h"
#include "ims_core_service_callback_ipc_interface_code.h"
#include "ims_reg_types.h"
#include "iremote_stub.h"
#include "radio_event.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {

View File

@ -1,44 +0,0 @@
/*
* 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

View File

@ -22,7 +22,6 @@
#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"
@ -62,7 +61,6 @@ void CoreService::OnStart()
}
registerToService_ = true;
}
RunnerPool::GetInstance().Init();
IPCSkeleton::SetMaxWorkThreadNum(MAX_IPC_THREAD_NUM);
if (!Init()) {
TELEPHONY_LOGE("failed to init CoreService");

View File

@ -1,66 +0,0 @@
/*
* 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

View File

@ -17,6 +17,7 @@
#include "ims_core_service_client.h"
#include "radio_event.h"
#include "tel_event_handler.h"
#include "telephony_errors.h"
#include "telephony_log_wrapper.h"
@ -91,7 +92,8 @@ int32_t ImsCoreServiceCallbackStub::UpdateImsServiceStatusChanged(
}
*imsServiceState = imsServiceStatus;
imsCoreServiceClient->GetHandler(slotId)->SendEvent(RadioEvent::RADIO_IMS_SERVICE_STATUS_UPDATE, imsServiceState);
TelEventHandler::SendTelEvent(
imsCoreServiceClient->GetHandler(slotId), RadioEvent::RADIO_IMS_SERVICE_STATUS_UPDATE, imsServiceState);
return TELEPHONY_SUCCESS;
}
@ -119,7 +121,8 @@ int32_t ImsCoreServiceCallbackStub::GetImsRegistrationStatusResponse(
}
std::shared_ptr<int32_t> isRegisterd = std::make_shared<int32_t>();
*isRegisterd = imsRegStatus.isRegisterd ? 1 : 0;
imsCoreServiceClient->GetHandler(slotId)->SendEvent(RadioEvent::RADIO_IMS_REGISTER_STATE_UPDATE, isRegisterd);
TelEventHandler::SendTelEvent(
imsCoreServiceClient->GetHandler(slotId), RadioEvent::RADIO_IMS_REGISTER_STATE_UPDATE, isRegisterd);
return TELEPHONY_SUCCESS;
}
} // namespace Telephony

View File

@ -19,7 +19,6 @@
#include <memory>
#include "cell_info.h"
#include "event_handler.h"
#include "i_sim_manager.h"
#include "i_tel_ril_manager.h"
#include "network_register.h"
@ -32,15 +31,15 @@
#include "radio_info.h"
#include "signal_info.h"
#include "system_ability_status_change_stub.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {
class NetworkSearchManager;
class NetworkSearchHandler : public AppExecFwk::EventHandler {
class NetworkSearchHandler : public TelEventHandler {
public:
using NsHandlerFunc = void (NetworkSearchHandler::*)(const AppExecFwk::InnerEvent::Pointer &);
NetworkSearchHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::weak_ptr<NetworkSearchManager> &networkSearchManager,
explicit NetworkSearchHandler(const std::weak_ptr<NetworkSearchManager> &networkSearchManager,
const std::weak_ptr<ITelRilManager> &telRilManager, const std::weak_ptr<ISimManager> &simManager,
int32_t slotId);
virtual ~NetworkSearchHandler();

View File

@ -26,7 +26,6 @@
#include "device_state_handler.h"
#include "device_state_observer.h"
#include "event_handler.h"
#include "i_network_search.h"
#include "i_sim_manager.h"
#include "i_tel_ril_manager.h"
@ -56,7 +55,6 @@ struct NetworkSearchManagerInner {
static const int64_t SERIAL_NUMBER_EXEMPT = 1100;
std::shared_ptr<NetworkSearchState> networkSearchState_ = nullptr;
std::shared_ptr<NetworkSearchHandler> networkSearchHandler_ = nullptr;
std::shared_ptr<AppExecFwk::EventRunner> eventLoop_ = nullptr;
std::unique_ptr<ObserverHandler> observerHandler_ = nullptr;
std::shared_ptr<DeviceStateHandler> deviceStateHandler_ = nullptr;
std::shared_ptr<DeviceStateObserver> deviceStateObserver_ = nullptr;
@ -105,9 +103,6 @@ struct NetworkSearchManagerInner {
return false;
}
}
if (eventLoop_ != nullptr) {
eventLoop_->Run();
}
state_ = HandleRunningState::STATE_RUNNING;
return true;
}

View File

@ -21,12 +21,12 @@
#include <utility>
#include <vector>
#include "event_handler.h"
#include "inner_event.h"
#ifdef ABILITY_LOCATION_SUPPORT
#include "location.h"
#endif
#include "refbase.h"
#include "tel_event_handler.h"
#include "telephony_log_wrapper.h"
namespace OHOS {
@ -67,9 +67,9 @@ protected:
bool isActive_ = false;
};
class StateMachineEventHandler : public AppExecFwk::EventHandler {
class StateMachineEventHandler : public TelEventHandler {
public:
explicit StateMachineEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
StateMachineEventHandler();
~StateMachineEventHandler() = default;
virtual void SetOriginalState(sptr<State> &originalState);
virtual void TransitionTo(sptr<State> &destState);
@ -94,7 +94,7 @@ private:
class StateMachine {
public:
explicit StateMachine(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
StateMachine();
virtual ~StateMachine() {}
void Quit();
void Start();
@ -109,7 +109,7 @@ protected:
class TimeZoneLocationSuggester : public StateMachine, public std::enable_shared_from_this<TimeZoneLocationSuggester> {
public:
explicit TimeZoneLocationSuggester(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
TimeZoneLocationSuggester();
~TimeZoneLocationSuggester() = default;
void Init();
void NitzUpdate();

View File

@ -18,7 +18,6 @@
#include "common_event_subscriber.h"
#include "data_ability_observer_stub.h"
#include "event_handler.h"
#include "network_search_manager.h"
#include "system_ability_status_change_stub.h"
#include "time_zone_location_suggester.h"
@ -26,9 +25,9 @@
namespace OHOS {
namespace Telephony {
class TimeZoneUpdater : public AppExecFwk::EventHandler {
class TimeZoneUpdater : public TelEventHandler {
public:
explicit TimeZoneUpdater(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
TimeZoneUpdater();
virtual ~TimeZoneUpdater();
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override;
void Init();

View File

@ -73,11 +73,10 @@ const std::map<uint32_t, NetworkSearchHandler::NsHandlerFunc> NetworkSearchHandl
{ SettingEventCode::MSG_AUTO_AIRPLANE_MODE, &NetworkSearchHandler::AirplaneModeChange }
};
NetworkSearchHandler::NetworkSearchHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::weak_ptr<NetworkSearchManager> &networkSearchManager, const std::weak_ptr<ITelRilManager> &telRilManager,
const std::weak_ptr<ISimManager> &simManager, int32_t slotId)
: AppExecFwk::EventHandler(runner), networkSearchManager_(networkSearchManager), telRilManager_(telRilManager),
simManager_(simManager), slotId_(slotId)
NetworkSearchHandler::NetworkSearchHandler(const std::weak_ptr<NetworkSearchManager> &networkSearchManager,
const std::weak_ptr<ITelRilManager> &telRilManager, const std::weak_ptr<ISimManager> &simManager, int32_t slotId)
: TelEventHandler("NetworkSearchManager_" + std::to_string(slotId)), networkSearchManager_(networkSearchManager),
telRilManager_(telRilManager), simManager_(simManager), slotId_(slotId)
{}
NetworkSearchHandler::~NetworkSearchHandler()

View File

@ -69,13 +69,6 @@ bool NetworkSearchManager::InitPointer(std::shared_ptr<NetworkSearchManagerInner
TELEPHONY_LOGE("NetworkSearchManager::InitPointer failed . inner is null");
return false;
}
std::string name = "NetworkSearchManager_";
name.append(std::to_string(slotId));
inner->eventLoop_ = AppExecFwk::EventRunner::Create(name.c_str());
if (inner->eventLoop_.get() == nullptr) {
TELEPHONY_LOGE("NetworkSearchManager failed to create EventRunner slotId:%{public}d", slotId);
return false;
}
inner->observerHandler_ = std::make_unique<ObserverHandler>();
if (inner->observerHandler_ == nullptr) {
TELEPHONY_LOGE("failed to create new ObserverHandler slotId:%{public}d", slotId);
@ -86,8 +79,8 @@ bool NetworkSearchManager::InitPointer(std::shared_ptr<NetworkSearchManagerInner
TELEPHONY_LOGE("failed to create new NetworkSearchState slotId:%{public}d", slotId);
return false;
}
inner->networkSearchHandler_ = std::make_shared<NetworkSearchHandler>(
inner->eventLoop_, shared_from_this(), telRilManager_, simManager_, slotId);
inner->networkSearchHandler_ =
std::make_shared<NetworkSearchHandler>(shared_from_this(), telRilManager_, simManager_, slotId);
if (inner->networkSearchHandler_ == nullptr) {
TELEPHONY_LOGE("failed to create new NetworkSearchHandler slotId:%{public}d", slotId);
return false;

View File

@ -45,7 +45,7 @@ std::string State::GetStateMachineName() const
return name_;
}
StateMachineEventHandler::StateMachineEventHandler(const std::shared_ptr<EventRunner> &runner) : EventHandler(runner) {}
StateMachineEventHandler::StateMachineEventHandler() : TelEventHandler("StateMachineEventHandler") {}
void StateMachineEventHandler::SetOriginalState(sptr<State> &originalState)
{
@ -153,9 +153,9 @@ void StateMachineEventHandler::SendDeferredEvent()
deferEvents_.clear();
}
StateMachine::StateMachine(const std::shared_ptr<EventRunner> &runner)
StateMachine::StateMachine()
{
stateMachineEventHandler_ = std::make_shared<StateMachineEventHandler>(runner);
stateMachineEventHandler_ = std::make_shared<StateMachineEventHandler>();
if (stateMachineEventHandler_ == nullptr) {
TELEPHONY_LOGE("stateMachineEventHandler_ is null");
return;
@ -226,7 +226,7 @@ void StateMachine::SendEvent(InnerEvent::Pointer &event)
stateMachineEventHandler_->SendEvent(event);
}
TimeZoneLocationSuggester::TimeZoneLocationSuggester(const std::shared_ptr<EventRunner> &runner) : StateMachine(runner)
TimeZoneLocationSuggester::TimeZoneLocationSuggester() : StateMachine()
{}
void TimeZoneLocationSuggester::Init()

View File

@ -40,12 +40,7 @@ void TimeZoneManager::Init(std::weak_ptr<NetworkSearchManager> networkSearchMana
TELEPHONY_LOGE("NetworkSearchManager is null");
return;
}
auto inner = nsm->FindManagerInner(DEFAULT_SIM_SLOT_ID);
if (inner == nullptr || inner->eventLoop_ == nullptr) {
TELEPHONY_LOGE("Eventloop is null");
return;
}
timeZoneUpdater_ = std::make_shared<TimeZoneUpdater>(inner->eventLoop_);
timeZoneUpdater_ = std::make_shared<TimeZoneUpdater>();
if (timeZoneUpdater_ == nullptr) {
TELEPHONY_LOGE("failed to create new TimeZoneUpdater");
return;

View File

@ -46,7 +46,7 @@ constexpr int32_t TIMEZONE_OFFSET_INVALID = TIMEZONE_OFFSET_MAX + 1;
constexpr int32_t QUARTER_TO_MILLISECOND = 15 * 60 * 1000;
constexpr int LOCATION_TIME_OUT_MS = 30 * 1000;
TimeZoneUpdater::TimeZoneUpdater(const std::shared_ptr<EventRunner> &runner) : EventHandler(runner)
TimeZoneUpdater::TimeZoneUpdater() : TelEventHandler("TimeZoneUpdater")
{
offset_ = TIMEZONE_OFFSET_INVALID;
memberFuncMap_[SettingEventCode::MSG_AUTO_TIMEZONE] = &TimeZoneUpdater::HandleAutoTimeZoneChange;
@ -87,7 +87,7 @@ void TimeZoneUpdater::Init()
return;
}
locationSuggester_ = std::make_shared<TimeZoneLocationSuggester>(GetEventRunner());
locationSuggester_ = std::make_shared<TimeZoneLocationSuggester>();
if (locationSuggester_ == nullptr) {
TELEPHONY_LOGE("failed to create new TimeZoneLocationSuggester");
return;
@ -593,7 +593,7 @@ void TimeZoneUpdater::AutoTimezoneObserver::OnChange()
{
if (eventHandler_ != nullptr) {
InnerEvent::Pointer event = InnerEvent::Get(SettingEventCode::MSG_AUTO_TIMEZONE);
eventHandler_->SendEvent(event);
TelEventHandler::SendTelEvent(eventHandler_, event);
}
}
@ -605,7 +605,7 @@ void TimeZoneUpdater::AirplaneModeObserver::OnChange()
{
if (eventHandler_ != nullptr) {
InnerEvent::Pointer event = InnerEvent::Get(SettingEventCode::MSG_AUTO_AIRPLANE_MODE);
eventHandler_->SendEvent(event);
TelEventHandler::SendTelEvent(eventHandler_, event);
}
}
@ -624,7 +624,7 @@ void TimeZoneUpdater::DeviceStateEventSubscriber::OnReceiveEvent(const EventFwk:
std::string action = want.GetAction();
if (action == CommonEventSupport::COMMON_EVENT_SCREEN_ON) {
InnerEvent::Pointer event = InnerEvent::Get(TimeZoneEventCode::EVENT_SCREEN_ON);
eventHandler_->SendEvent(event);
TelEventHandler::SendTelEvent(eventHandler_, event);
} else if (action == CommonEventSupport::COMMON_EVENT_CONNECTIVITY_CHANGE) {
int32_t bearType = data.GetWant().GetIntParam(NET_TYPE, NetManagerStandard::NetBearType::BEARER_DEFAULT);
if (bearType != NetManagerStandard::NetBearType::BEARER_WIFI &&
@ -634,7 +634,7 @@ void TimeZoneUpdater::DeviceStateEventSubscriber::OnReceiveEvent(const EventFwk:
bool isConnected = data.GetCode() == NetManagerStandard::NetConnState::NET_CONN_STATE_CONNECTED;
if (isConnected) {
InnerEvent::Pointer event = InnerEvent::Get(TimeZoneEventCode::EVENT_NETWORK_CONNECTED);
eventHandler_->SendEvent(event);
TelEventHandler::SendTelEvent(eventHandler_, event);
}
}
}

View File

@ -18,12 +18,13 @@
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <vector>
#include "icc_dialling_numbers_handler.h"
#include "icc_file_controller.h"
#include "sim_file_manager.h"
#include "icc_dialling_numbers_handler.h"
#include "tel_event_handler.h"
#include "usim_dialling_numbers_service.h"
namespace OHOS {
@ -35,10 +36,9 @@ enum {
};
const int ADD_FLAG = -1;
class IccDiallingNumbersCache : public AppExecFwk::EventHandler {
class IccDiallingNumbersCache : public TelEventHandler {
public:
IccDiallingNumbersCache(
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimFileManager> simFileManager);
explicit IccDiallingNumbersCache(std::shared_ptr<SimFileManager> simFileManager);
~IccDiallingNumbersCache();
void Init();
std::shared_ptr<std::vector<std::shared_ptr<DiallingNumbersInfo>>> LoadReadyDiallingNumbers(int fileId);

View File

@ -16,16 +16,15 @@
#ifndef OHOS_SIM_DIALLING_NUMBERS_HANDLER_H
#define OHOS_SIM_DIALLING_NUMBERS_HANDLER_H
#include <unordered_map>
#include <thread>
#include <unordered_map>
#include "event_handler.h"
#include "event_runner.h"
#include "dialling_numbers_info.h"
#include "icc_file_controller.h"
#include "sim_data_type.h"
#include "sim_number_decode.h"
#include "sim_utils.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {
@ -185,10 +184,9 @@ struct DiallingNumberUpdateInfor {
std::string pin2 = "";
bool isDel = false;
};
class IccDiallingNumbersHandler : public AppExecFwk::EventHandler {
class IccDiallingNumbersHandler : public TelEventHandler {
public:
IccDiallingNumbersHandler(
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<IccFileController> fh);
explicit IccDiallingNumbersHandler(std::shared_ptr<IccFileController> fh);
~IccDiallingNumbersHandler();
void GetDiallingNumbers(int ef, int extensionEF, int recordNumber, AppExecFwk::InnerEvent::Pointer &response);
void GetAllDiallingNumbers(int ef, int extensionEF, AppExecFwk::InnerEvent::Pointer &response);

View File

@ -16,14 +16,15 @@
#ifndef OHOS_ICC_DIALLING_NUMBERS_MANAGER_H
#define OHOS_ICC_DIALLING_NUMBERS_MANAGER_H
#include <iostream>
#include <cstring>
#include <iostream>
#include <string>
#include "dialling_numbers_info.h"
#include "i_tel_ril_manager.h"
#include "icc_dialling_numbers_cache.h"
#include "sim_file_manager.h"
#include "dialling_numbers_info.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {
@ -33,9 +34,9 @@ enum DiallingNumbersMessageType {
MSG_SIM_DIALLING_NUMBERS_WRITE_DONE,
MSG_SIM_DIALLING_NUMBERS_DELETE_DONE,
};
class IccDiallingNumbersManager : public AppExecFwk::EventHandler {
class IccDiallingNumbersManager : public TelEventHandler {
public:
IccDiallingNumbersManager(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
explicit IccDiallingNumbersManager(
std::weak_ptr<SimFileManager> simFileManager, std::shared_ptr<SimStateManager> simState);
~IccDiallingNumbersManager();
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);

View File

@ -19,16 +19,14 @@
#include <atomic>
#include <string_view>
#include "event_handler.h"
#include "event_runner.h"
#include "sim_state_manager.h"
#include "i_tel_ril_manager.h"
#include "icc_operator_rule.h"
#include "sim_state_manager.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {
class IccOperatorPrivilegeController : public AppExecFwk::EventHandler {
class IccOperatorPrivilegeController : public TelEventHandler {
public:
enum : uint32_t {
MSG_OPEN_LOGICAL_CHANNEL_DONE = 0x7ffffff0,
@ -36,9 +34,8 @@ public:
MSG_CLOSE_LOGICAL_CHANNEL_DONE = 0x7ffffff2
};
IccOperatorPrivilegeController(std::shared_ptr<AppExecFwk::EventRunner> runner,
std::shared_ptr<Telephony::ITelRilManager> telRilManager,
std::shared_ptr<SimStateManager> simStateManager);
explicit IccOperatorPrivilegeController(
std::shared_ptr<Telephony::ITelRilManager> telRilManager, std::shared_ptr<SimStateManager> simStateManager);
virtual ~IccOperatorPrivilegeController();

View File

@ -34,8 +34,7 @@ class MultiSimController {
public:
MultiSimController(std::shared_ptr<Telephony::ITelRilManager> telRilManager,
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager,
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager,
const std::shared_ptr<AppExecFwk::EventRunner> &runner);
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager);
virtual ~MultiSimController();
void Init();

View File

@ -25,6 +25,7 @@
#include "sim_file_manager.h"
#include "system_ability_definition.h"
#include "system_ability_status_change_stub.h"
#include "tel_event_handler.h"
#include "telephony_log_wrapper.h"
#include "telephony_state_registry_client.h"
@ -33,10 +34,9 @@ namespace Telephony {
using namespace OHOS::EventFwk;
using CommonEventSubscribeInfo = OHOS::EventFwk::CommonEventSubscribeInfo;
using CommonEventSubscriber = OHOS::EventFwk::CommonEventSubscriber;
class MultiSimMonitor : public AppExecFwk::EventHandler {
class MultiSimMonitor : public TelEventHandler {
public:
MultiSimMonitor(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::shared_ptr<MultiSimController> &controller,
explicit MultiSimMonitor(const std::shared_ptr<MultiSimController> &controller,
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager,
std::vector<std::weak_ptr<Telephony::SimFileManager>> simFileManager);
~MultiSimMonitor();

View File

@ -22,10 +22,9 @@
namespace OHOS {
namespace Telephony {
class OperatorConfigCache : public AppExecFwk::EventHandler {
class OperatorConfigCache : public TelEventHandler {
public:
explicit OperatorConfigCache(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
std::weak_ptr<SimFileManager> simFileManager, int32_t slotId);
explicit OperatorConfigCache(std::weak_ptr<SimFileManager> simFileManager, int32_t slotId);
virtual ~OperatorConfigCache() = default;
void ClearAllCache(int32_t slotId);
void ClearMemoryCache(int32_t slotId);

View File

@ -16,20 +16,18 @@
#ifndef OHOS_RADIO_PROTOCOL_CONTROLLER_H
#define OHOS_RADIO_PROTOCOL_CONTROLLER_H
#include <mutex>
#include <condition_variable>
#include <mutex>
#include "event_handler.h"
#include "event_runner.h"
#include "i_tel_ril_manager.h"
#include "sim_constant.h"
#include "tel_event_handler.h"
namespace OHOS {
namespace Telephony {
class RadioProtocolController : public AppExecFwk::EventHandler {
class RadioProtocolController : public TelEventHandler {
public:
RadioProtocolController(
std::weak_ptr<Telephony::ITelRilManager> telRilManager, const std::shared_ptr<AppExecFwk::EventRunner> &runner);
explicit RadioProtocolController(std::weak_ptr<Telephony::ITelRilManager> telRilManager);
virtual ~RadioProtocolController() = default;
void Init();

View File

@ -46,8 +46,6 @@ private:
std::shared_ptr<SimStateTracker> simStateTracker_ = nullptr;
std::shared_ptr<OperatorConfigCache> operatorConfigCache_ = nullptr;
std::shared_ptr<IccOperatorPrivilegeController> privilegeController_ = nullptr;
std::shared_ptr<AppExecFwk::EventRunner> operatorConfigCacheRunner_;
std::shared_ptr<AppExecFwk::EventRunner> simStateTrackerRunner_;
std::shared_ptr<AppExecFwk::EventRunner> privilegesRunner_;
};
} // namespace Telephony

View File

@ -37,10 +37,9 @@ enum {
SIM_SMS_DELETE_COMPLETED = 4
};
class SimSmsController : public AppExecFwk::EventHandler {
class SimSmsController : public TelEventHandler {
public:
SimSmsController(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
std::shared_ptr<SimStateManager> simStateManager);
explicit SimSmsController(std::shared_ptr<SimStateManager> simStateManager);
~SimSmsController();
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
int32_t AddSmsToIcc(int status, std::string &pdu, std::string &smsc);

View File

@ -45,7 +45,6 @@ protected:
std::shared_ptr<SimFileManager> simFileManager_ = nullptr;
std::shared_ptr<SimStateManager> stateManager_ = nullptr;
std::shared_ptr<SimSmsController> smsController_ = nullptr;
std::shared_ptr<AppExecFwk::EventRunner> eventLoopSms_ = nullptr;
HandleRunningState stateSms_ = HandleRunningState::STATE_NOT_START;
};
} // namespace Telephony

View File

@ -31,11 +31,10 @@ namespace Telephony {
using namespace OHOS::EventFwk;
using CommonEventSubscribeInfo = OHOS::EventFwk::CommonEventSubscribeInfo;
using CommonEventSubscriber = OHOS::EventFwk::CommonEventSubscriber;
class SimStateTracker : public AppExecFwk::EventHandler {
class SimStateTracker : public TelEventHandler {
public:
SimStateTracker(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
std::weak_ptr<SimFileManager> simFileManager, std::shared_ptr<OperatorConfigCache> operatorConfigCache,
int32_t slotId);
SimStateTracker(std::weak_ptr<SimFileManager> simFileManager,
std::shared_ptr<OperatorConfigCache> operatorConfigCache, int32_t slotId);
~SimStateTracker();
void InitListener();
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);

View File

@ -16,18 +16,17 @@
#ifndef OHOS_STK_CONTROLLER_H
#define OHOS_STK_CONTROLLER_H
#include "event_handler.h"
#include "inner_event.h"
#include "i_tel_ril_manager.h"
#include "inner_event.h"
#include "sim_state_manager.h"
#include "tel_event_handler.h"
#include "want.h"
namespace OHOS {
namespace Telephony {
class StkController : public AppExecFwk::EventHandler {
class StkController : public TelEventHandler {
public:
StkController(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::weak_ptr<Telephony::ITelRilManager> &telRilManager,
explicit StkController(const std::weak_ptr<Telephony::ITelRilManager> &telRilManager,
const std::weak_ptr<Telephony::SimStateManager> &simStateManager, int32_t slotId);
virtual ~StkController() = default;
void Init();

View File

@ -16,12 +16,13 @@
#ifndef OHOS_USIM_DIALLING_NUMBERS_SERVICE_H
#define OHOS_USIM_DIALLING_NUMBERS_SERVICE_H
#include "icc_dialling_numbers_handler.h"
#include "icc_file_controller.h"
#include "sim_constant.h"
#include "icc_dialling_numbers_handler.h"
#include "tag_service.h"
#include "telephony_log_wrapper.h"
#include "sim_utils.h"
#include "tag_service.h"
#include "tel_event_handler.h"
#include "telephony_log_wrapper.h"
namespace OHOS {
namespace Telephony {
@ -42,9 +43,9 @@ enum UsimConstant {
BIT_OF_BYTE = 8
};
class UsimDiallingNumbersService : public AppExecFwk::EventHandler {
class UsimDiallingNumbersService : public TelEventHandler {
public:
explicit UsimDiallingNumbersService(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
UsimDiallingNumbersService();
~UsimDiallingNumbersService();
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
void ObtainUsimElementaryFiles(const AppExecFwk::InnerEvent::Pointer &pointer);

View File

@ -15,13 +15,10 @@
#include "icc_dialling_numbers_cache.h"
#include "runner_pool.h"
namespace OHOS {
namespace Telephony {
IccDiallingNumbersCache::IccDiallingNumbersCache(
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimFileManager> simFileManager)
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager)
IccDiallingNumbersCache::IccDiallingNumbersCache(std::shared_ptr<SimFileManager> simFileManager)
: TelEventHandler("IccDiallingNumbersCache"), simFileManager_(simFileManager)
{
InitFileTypeMap();
}
@ -44,12 +41,7 @@ void IccDiallingNumbersCache::Init()
return;
}
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = RunnerPool::GetInstance().GetCommonRunner();
if (loaderLoop.get() == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersCache failed to create usimpdiallingnumbers loop");
return;
}
usimDiallingNumberSrv_ = std::make_shared<UsimDiallingNumbersService>(loaderLoop);
usimDiallingNumberSrv_ = std::make_shared<UsimDiallingNumbersService>();
if (usimDiallingNumberSrv_ == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersCache failed to create usimpdiallingnumbers.");
return;
@ -322,7 +314,7 @@ void IccDiallingNumbersCache::SendBackResult(const AppExecFwk::InnerEvent::Point
data->result = static_cast<std::shared_ptr<void>>(ar);
data->exception = object;
if (owner != nullptr) {
owner->SendEvent(id, data);
TelEventHandler::SendTelEvent(owner, id, data);
} else {
TELEPHONY_LOGE("IccDiallingNumbersCache::SendBackResult null owner");
}

View File

@ -24,9 +24,8 @@ std::atomic_int IccDiallingNumbersHandler::nextSerialId_(1);
std::unordered_map<int, std::shared_ptr<DiallingNumberLoadRequest>> IccDiallingNumbersHandler::requestMap_;
static std::mutex requestLock_;
IccDiallingNumbersHandler::IccDiallingNumbersHandler(
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<IccFileController> fh)
: AppExecFwk::EventHandler(runner), fileController_(fh)
IccDiallingNumbersHandler::IccDiallingNumbersHandler(std::shared_ptr<IccFileController> fh)
: TelEventHandler("IccDiallingNumbersHandler"), fileController_(fh)
{
InitFuncMap();
}

View File

@ -17,7 +17,6 @@
#include "core_service_errors.h"
#include "radio_event.h"
#include "runner_pool.h"
#include "telephony_errors.h"
namespace OHOS {
@ -25,9 +24,9 @@ namespace Telephony {
constexpr static const int32_t WAIT_TIME_SECOND = 1;
constexpr static const int32_t WAIT_QUERY_TIME_SECOND = 30;
IccDiallingNumbersManager::IccDiallingNumbersManager(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
IccDiallingNumbersManager::IccDiallingNumbersManager(
std::weak_ptr<SimFileManager> simFileManager, std::shared_ptr<SimStateManager> simState)
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager), simStateManager_(simState)
: TelEventHandler("IccDiallingNumbersManager"), simFileManager_(simFileManager), simStateManager_(simState)
{}
void IccDiallingNumbersManager::Init()
@ -38,19 +37,13 @@ void IccDiallingNumbersManager::Init()
return;
}
eventLoopDiallingNumbers_ = RunnerPool::GetInstance().GetCommonRunner();
if (eventLoopDiallingNumbers_.get() == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersManager failed to create EventRunner");
return;
}
auto simFileManager = simFileManager_.lock();
if (simFileManager == nullptr) {
TELEPHONY_LOGE("SimFileManager null pointer");
return;
}
diallingNumbersCache_ = std::make_shared<IccDiallingNumbersCache>(eventLoopDiallingNumbers_, simFileManager);
diallingNumbersCache_ = std::make_shared<IccDiallingNumbersCache>(simFileManager);
if (diallingNumbersCache_ == nullptr) {
TELEPHONY_LOGE("simFile create nullptr.");
return;
@ -98,12 +91,10 @@ void IccDiallingNumbersManager::InitFdnCache()
if (diallingNumbersCache_ != nullptr) {
diallingNumbersCache_->ClearDiallingNumberCache();
}
std::thread initTask([&]() {
pthread_setname_np(pthread_self(), "init_fdn_cache");
TelFFRTUtils::Submit([&]() {
std::vector<std::shared_ptr<DiallingNumbersInfo>> diallingNumbers;
QueryIccDiallingNumbers(DiallingNumbersInfo::SIM_FDN, diallingNumbers);
});
initTask.detach();
}
void IccDiallingNumbersManager::ProcessLoadDone(const AppExecFwk::InnerEvent::Pointer &event)
@ -349,17 +340,11 @@ bool IccDiallingNumbersManager::IsValidType(int type)
std::shared_ptr<IccDiallingNumbersManager> IccDiallingNumbersManager::CreateInstance(
std::weak_ptr<SimFileManager> simFile, std::shared_ptr<SimStateManager> simState)
{
std::shared_ptr<AppExecFwk::EventRunner> eventLoop = RunnerPool::GetInstance().GetCommonRunner();
if (eventLoop.get() == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersManager failed to create EventRunner");
return nullptr;
}
if (simFile.lock() == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersManager::Init SimFileManager null pointer");
return nullptr;
}
std::shared_ptr<IccDiallingNumbersManager> manager =
std::make_shared<IccDiallingNumbersManager>(eventLoop, simFile, simState);
std::shared_ptr<IccDiallingNumbersManager> manager = std::make_shared<IccDiallingNumbersManager>(simFile, simState);
if (manager == nullptr) {
TELEPHONY_LOGE("IccDiallingNumbersManager::Init manager create nullptr.");
return nullptr;

View File

@ -22,6 +22,7 @@
#include "radio_event.h"
#include "system_ability_definition.h"
#include "telephony_ext_wrapper.h"
#include "tel_event_handler.h"
#include "telephony_state_registry_client.h"
using namespace std;
@ -341,7 +342,7 @@ void IccFile::RegisterImsiLoaded(std::shared_ptr<AppExecFwk::EventHandler> event
}
if (!ObtainIMSI().empty()) {
if (eventHandler != nullptr) {
eventHandler->SendEvent(RadioEvent::RADIO_IMSI_LOADED_READY);
TelEventHandler::SendTelEvent(eventHandler, RadioEvent::RADIO_IMSI_LOADED_READY);
}
}
}
@ -363,7 +364,7 @@ void IccFile::RegisterAllFilesLoaded(std::shared_ptr<AppExecFwk::EventHandler> e
if (ObtainFilesFetched()) {
TELEPHONY_LOGI("IccFile::RegisterAllFilesLoaded: notify");
if (eventHandler != nullptr) {
eventHandler->SendEvent(RadioEvent::RADIO_SIM_RECORDS_LOADED, slotId_, 0);
TelEventHandler::SendTelEvent(eventHandler, RadioEvent::RADIO_SIM_RECORDS_LOADED, slotId_, 0);
}
PublishSimFileEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SIM_STATE_CHANGED,
static_cast<int32_t>(SimState::SIM_STATE_LOADED), "");

View File

@ -22,7 +22,6 @@
#include "inner_event.h"
#include "radio_event.h"
#include "runner_pool.h"
#include "sim_data_type.h"
#include "telephony_log_wrapper.h"
@ -169,10 +168,9 @@ public:
}
};
IccOperatorPrivilegeController::IccOperatorPrivilegeController(std::shared_ptr<AppExecFwk::EventRunner> runner,
std::shared_ptr<Telephony::ITelRilManager> telRilManager,
std::shared_ptr<SimStateManager> simStateManager)
: AppExecFwk::EventHandler(runner), slotId_(0), telRilManager_(telRilManager),
IccOperatorPrivilegeController::IccOperatorPrivilegeController(
std::shared_ptr<Telephony::ITelRilManager> telRilManager, std::shared_ptr<SimStateManager> simStateManager)
: TelEventHandler("IccOperatorPrivilegeController"), slotId_(0), telRilManager_(telRilManager),
simStateManager_(simStateManager), state_(new IccOperatorPrivilegeController::LogicalStateMachine())
{}
@ -193,14 +191,6 @@ void IccOperatorPrivilegeController::Init(const int32_t slotId)
TELEPHONY_LOGE("simStateManager_ can not be nullptr!!");
return;
}
if (this->GetEventRunner() == nullptr) {
auto runner = RunnerPool::GetInstance().GetCommonRunner();
if (runner == nullptr) {
TELEPHONY_LOGE("IccOperatorPrivilegeController::Init Create thread fail!");
return;
}
this->SetEventRunner(runner);
}
auto self = this->shared_from_this();
simStateManager_->RegisterCoreNotify(self, RadioEvent::RADIO_SIM_STATE_CHANGE);
/* try to load data */
@ -327,7 +317,7 @@ void IccOperatorPrivilegeController::ProcessOpenLogicalChannelDone(const AppExec
return;
}
TELEPHONY_LOGI("Will to SimTransmitApduLogicalChannel");
auto resultPtr = event->GetUniqueObject<OpenLogicalChannelResponse>();
auto resultPtr = event->GetSharedObject<OpenLogicalChannelResponse>();
if (resultPtr == nullptr) {
TELEPHONY_LOGE("the data of result is nullptr! then will Close Logical Channel");
return;
@ -352,7 +342,7 @@ void IccOperatorPrivilegeController::ProcessOpenLogicalChannelDone(const AppExec
void IccOperatorPrivilegeController::ProcessTransmitLogicalChannelDone(const AppExecFwk::InnerEvent::Pointer &event)
{
TELEPHONY_LOGI("Transmit Logical Channel Done!!");
auto resultPtr = event->GetUniqueObject<IccIoResultInfo>();
auto resultPtr = event->GetSharedObject<IccIoResultInfo>();
do {
if (resultPtr == nullptr) {
TELEPHONY_LOGE("the data of result is nullptr! then will Close Logical Channel");

View File

@ -45,13 +45,11 @@ static const std::string PRIMARY_SLOTID = "0";
MultiSimController::MultiSimController(std::shared_ptr<Telephony::ITelRilManager> telRilManager,
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager,
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager,
const std::shared_ptr<AppExecFwk::EventRunner> &runner)
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager)
: simStateManager_(simStateManager), simFileManager_(simFileManager)
{
TELEPHONY_LOGI("MultiSimController::MultiSimController");
radioProtocolController_ =
std::make_shared<RadioProtocolController>(std::weak_ptr<ITelRilManager>(telRilManager), runner);
radioProtocolController_ = std::make_shared<RadioProtocolController>(std::weak_ptr<ITelRilManager>(telRilManager));
InitMainCardSlotId();
}

View File

@ -26,11 +26,10 @@
namespace OHOS {
namespace Telephony {
const int64_t DELAY_TIME = 1000;
MultiSimMonitor::MultiSimMonitor(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::shared_ptr<MultiSimController> &controller,
MultiSimMonitor::MultiSimMonitor(const std::shared_ptr<MultiSimController> &controller,
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager,
std::vector<std::weak_ptr<Telephony::SimFileManager>> simFileManager)
: AppExecFwk::EventHandler(runner), controller_(controller), simStateManager_(simStateManager),
: TelEventHandler("MultiSimMonitor"), controller_(controller), simStateManager_(simStateManager),
simFileManager_(simFileManager)
{
if (observerHandler_ == nullptr) {
@ -133,7 +132,7 @@ void MultiSimMonitor::RegisterCoreNotify(
return;
}
if (controller_->IsSimActive(slotId)) {
handler->SendEvent(RadioEvent::RADIO_SIM_ACCOUNT_LOADED, slotId, 0);
TelEventHandler::SendTelEvent(handler, RadioEvent::RADIO_SIM_ACCOUNT_LOADED, slotId, 0);
}
}

View File

@ -27,9 +27,8 @@
namespace OHOS {
namespace Telephony {
OperatorConfigCache::OperatorConfigCache(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
std::weak_ptr<SimFileManager> simFileManager, int32_t slotId)
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager), slotId_(slotId)
OperatorConfigCache::OperatorConfigCache(std::weak_ptr<SimFileManager> simFileManager, int32_t slotId)
: TelEventHandler("OperatorConfigCache"), simFileManager_(simFileManager), slotId_(slotId)
{
TELEPHONY_LOGI("OperatorConfigCache create");
if (TELEPHONY_EXT_WRAPPER.checkOpcVersionIsUpdate_ != nullptr &&

View File

@ -24,9 +24,8 @@ static const int64_t SET_ACTIVE_OUT_TIME = 10 * 1000;
std::mutex RadioProtocolController::ctx_;
std::condition_variable RadioProtocolController::cv_;
RadioProtocolController::RadioProtocolController(
std::weak_ptr<Telephony::ITelRilManager> telRilManager, const std::shared_ptr<AppExecFwk::EventRunner> &runner)
: AppExecFwk::EventHandler(runner), telRilManager_(telRilManager)
RadioProtocolController::RadioProtocolController(std::weak_ptr<Telephony::ITelRilManager> telRilManager)
: TelEventHandler("RadioProtocolController"), telRilManager_(telRilManager)
{}
void RadioProtocolController::Init()

View File

@ -15,7 +15,6 @@
#include "sim_account_manager.h"
#include "runner_pool.h"
#include "string_ex.h"
namespace OHOS {
@ -48,25 +47,15 @@ void SimAccountManager::Init(int32_t slotId)
TELEPHONY_LOGE("SimAccountManager::init SimAccountManager invalid slotId = %{public}d", slotId);
return;
}
operatorConfigCacheRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
if (operatorConfigCacheRunner_.get() == nullptr) {
TELEPHONY_LOGE("SimAccountManager::Init operatorConfigCacheRunner_ failed");
return;
}
operatorConfigCache_ = std::make_shared<OperatorConfigCache>(
operatorConfigCacheRunner_, std::weak_ptr<SimFileManager>(simFileManager_), slotId);
operatorConfigCache_ =
std::make_shared<OperatorConfigCache>(std::weak_ptr<SimFileManager>(simFileManager_), slotId);
if (operatorConfigCache_ == nullptr) {
TELEPHONY_LOGE("SimAccountManager::operatorConfigCache_ is null");
return;
}
operatorConfigCache_->RegisterForIccChange();
simStateTrackerRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
if (simStateTrackerRunner_.get() == nullptr) {
TELEPHONY_LOGE("SimAccountManager::Init simStateTrackerRunner_ failed");
return;
}
simStateTracker_ = std::make_shared<SimStateTracker>(
simStateTrackerRunner_, std::weak_ptr<SimFileManager>(simFileManager_), operatorConfigCache_, slotId);
simStateTracker_ =
std::make_shared<SimStateTracker>(std::weak_ptr<SimFileManager>(simFileManager_), operatorConfigCache_, slotId);
if (simStateTracker_ == nullptr) {
TELEPHONY_LOGE("SimAccountManager::simStateTracker_ is null");
return;
@ -111,16 +100,11 @@ int32_t SimAccountManager::HasOperatorPrivileges(const int32_t slotId, bool &has
if (privilegeController_ != nullptr) {
return privilegeController_->HasOperatorPrivileges(hasOperatorPrivileges);
}
if (privilegesRunner_.get() == nullptr) {
TELEPHONY_LOGE("make privilegesRunner_");
privilegesRunner_ = RunnerPool::GetInstance().GetCommonRunner();
}
if ((privilegesRunner_ == nullptr) || (telRilManager_ == nullptr) || (simStateManager_ == nullptr)) {
TELEPHONY_LOGE("has nullptr at privilegesRunner_ or telRilManager_ or simStateManager_");
if ((telRilManager_ == nullptr) || (simStateManager_ == nullptr)) {
TELEPHONY_LOGE("has nullptr at telRilManager_ or simStateManager_");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
auto controller =
std::make_shared<IccOperatorPrivilegeController>(privilegesRunner_, telRilManager_, simStateManager_);
auto controller = std::make_shared<IccOperatorPrivilegeController>(telRilManager_, simStateManager_);
if (controller == nullptr) {
TELEPHONY_LOGE("Make IccOperatorPrivilegeController fail!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;

View File

@ -20,7 +20,6 @@
#include "network_state.h"
#include "parameters.h"
#include "radio_event.h"
#include "runner_pool.h"
#include "system_ability_definition.h"
#include "telephony_ext_wrapper.h"
@ -608,12 +607,7 @@ bool SimFileManager::InitDiallingNumberHandler()
diallingNumberHandler_->UpdateFileController(fileController_);
return true;
}
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = RunnerPool::GetInstance().GetCommonRunner();
if (loaderLoop.get() == nullptr) {
TELEPHONY_LOGE("SimFileManager failed to create diallingNumberloader loop");
return false;
}
diallingNumberHandler_ = std::make_shared<IccDiallingNumbersHandler>(loaderLoop, fileController_);
diallingNumberHandler_ = std::make_shared<IccDiallingNumbersHandler>(fileController_);
if (diallingNumberHandler_ == nullptr) {
TELEPHONY_LOGE("SimFileManager failed to create IccDiallingNumbersHandler.");
return false;

View File

@ -17,7 +17,6 @@
#include "core_service_errors.h"
#include "radio_event.h"
#include "runner_pool.h"
#include "telephony_errors.h"
namespace OHOS {
@ -86,26 +85,17 @@ void SimManager::InitMultiSimObject()
void SimManager::InitSingleSimObject()
{
controllerRunner_ = RunnerPool::GetInstance().GetCommonRunner();
if (controllerRunner_.get() == nullptr) {
TELEPHONY_LOGE("SimManager::InitSingleSimObject get controllerRunner_ failed");
return;
}
multiSimController_ =
std::make_shared<MultiSimController>(telRilManager_, simStateManager_, simFileManager_, controllerRunner_);
multiSimController_ = std::make_shared<MultiSimController>(telRilManager_, simStateManager_, simFileManager_);
if (multiSimController_ == nullptr) {
TELEPHONY_LOGE("SimManager::InitSingleSimObject multiSimController init failed");
return;
}
multiSimController_->Init();
monitorRunner_ = RunnerPool::GetInstance().GetSimDbAndFileRunner();
std::vector<std::weak_ptr<Telephony::SimFileManager>> simFileManager;
for (auto simFile : simFileManager_) {
simFileManager.push_back(std::weak_ptr<Telephony::SimFileManager>(simFile));
}
multiSimMonitor_ =
std::make_shared<MultiSimMonitor>(monitorRunner_, multiSimController_, simStateManager_, simFileManager);
multiSimMonitor_ = std::make_shared<MultiSimMonitor>(multiSimController_, simStateManager_, simFileManager);
if (multiSimMonitor_ == nullptr) {
TELEPHONY_LOGE("SimAccountManager:: multiSimMonitor is null");
return;

View File

@ -23,9 +23,8 @@ std::mutex SimSmsController::mtx_;
constexpr static const int32_t WAIT_TIME_SECOND = 1;
constexpr static const int32_t WAIT_TIME_TEN_SECOND = 10;
SimSmsController::SimSmsController(
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager)
: AppExecFwk::EventHandler(runner), stateManager_(simStateManager)
SimSmsController::SimSmsController(std::shared_ptr<SimStateManager> simStateManager)
: TelEventHandler("SimSmsController"), stateManager_(simStateManager)
{}
void SimSmsController::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)

View File

@ -16,7 +16,7 @@
#include "sim_sms_manager.h"
#include "telephony_errors.h"
#include "runner_pool.h"
namespace OHOS {
namespace Telephony {
@ -43,19 +43,13 @@ void SimSmsManager::Init(int slotId)
return;
}
eventLoopSms_ = RunnerPool::GetInstance().GetCommonRunner();
if (eventLoopSms_.get() == nullptr) {
TELEPHONY_LOGE("simSmsController failed to create EventRunner");
return;
}
if (simFileManager_ == nullptr) {
TELEPHONY_LOGE("SimSmsManager::Init SimFileManager null pointer");
return;
}
std::shared_ptr<SimFileManager> fileManager = std::static_pointer_cast<SimFileManager>(simFileManager_);
smsController_ = std::make_shared<SimSmsController>(eventLoopSms_, stateManager_);
smsController_ = std::make_shared<SimSmsController>(stateManager_);
if (smsController_ == nullptr) {
TELEPHONY_LOGE("SimSmsManager::Init simFile create nullptr.");
return;

View File

@ -28,6 +28,7 @@
#include "sim_constant.h"
#include "sim_state_manager.h"
#include "system_ability_definition.h"
#include "tel_event_handler.h"
#include "telephony_log_wrapper.h"
#include "telephony_state_registry_client.h"
#include "telephony_types.h"
@ -791,7 +792,7 @@ void SimStateHandle::RegisterCoreNotify(const std::shared_ptr<AppExecFwk::EventH
observerHandler_->RegObserver(RadioEvent::RADIO_SIM_STATE_READY, handler);
if (IsIccReady() && handler != nullptr) {
TELEPHONY_LOGI("SimStateHandle::RegisterIccReady() OK send");
handler->SendEvent(RadioEvent::RADIO_SIM_STATE_READY);
TelEventHandler::SendTelEvent(handler, RadioEvent::RADIO_SIM_STATE_READY);
}
break;
case RadioEvent::RADIO_SIM_STATE_LOCKED:

View File

@ -16,7 +16,6 @@
#include "sim_state_manager.h"
#include "core_service_errors.h"
#include "runner_pool.h"
#include "telephony_errors.h"
#include "telephony_log_wrapper.h"

View File

@ -25,10 +25,9 @@
namespace OHOS {
namespace Telephony {
const int32_t ACTIVE_USER_ID = 100;
SimStateTracker::SimStateTracker(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
std::weak_ptr<SimFileManager> simFileManager, std::shared_ptr<OperatorConfigCache> operatorConfigCache,
int32_t slotId)
: AppExecFwk::EventHandler(runner), simFileManager_(simFileManager), operatorConfigCache_(operatorConfigCache),
SimStateTracker::SimStateTracker(std::weak_ptr<SimFileManager> simFileManager,
std::shared_ptr<OperatorConfigCache> operatorConfigCache, int32_t slotId)
: TelEventHandler("SimStateTracker"), simFileManager_(simFileManager), operatorConfigCache_(operatorConfigCache),
slotId_(slotId)
{
if (simFileManager.lock() == nullptr) {

View File

@ -37,11 +37,10 @@ const std::string PARAM_ALPHA_STRING = "alphaString";
const std::string PARAM_REFRESH_RESULT = "refreshResult";
} // namespace
StkController::StkController(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
const std::weak_ptr<Telephony::ITelRilManager> &telRilManager,
StkController::StkController(const std::weak_ptr<Telephony::ITelRilManager> &telRilManager,
const std::weak_ptr<Telephony::SimStateManager> &simStateManager, int32_t slotId)
: AppExecFwk::EventHandler(runner), telRilManager_(telRilManager),
simStateManager_(simStateManager), slotId_(slotId)
: TelEventHandler("StkController"), telRilManager_(telRilManager), simStateManager_(simStateManager),
slotId_(slotId)
{}
void StkController::Init()

View File

@ -15,11 +15,9 @@
#include "stk_manager.h"
#include "runner_pool.h"
#include "telephony_errors.h"
#include "telephony_log_wrapper.h"
namespace OHOS {
namespace Telephony {
StkManager::StkManager(std::shared_ptr<ITelRilManager> telRilManager, std::shared_ptr<SimStateManager> simStateManager)
@ -41,12 +39,7 @@ void StkManager::Init(int slotId)
TELEPHONY_LOGE("StkManager[%{public}d]::Init() telRilManager or simStateManager_ is nullptr", slotId);
return;
}
stkEventLoop_ = RunnerPool::GetInstance().GetCommonRunner();
if (stkEventLoop_.get() == nullptr) {
TELEPHONY_LOGE("StkManager[%{public}d]::Init() failed to create EventRunner", slotId);
return;
}
stkController_ = std::make_shared<StkController>(stkEventLoop_, telRilManager_, simStateManager_, slotId);
stkController_ = std::make_shared<StkController>(telRilManager_, simStateManager_, slotId);
if (stkController_ == nullptr) {
TELEPHONY_LOGE("StkManager[%{public}d]::Init() failed to create StkController", slotId);
return;

View File

@ -19,8 +19,7 @@ namespace OHOS {
namespace Telephony {
std::mutex UsimDiallingNumbersService::mtx_;
UsimDiallingNumbersService::UsimDiallingNumbersService(const std::shared_ptr<AppExecFwk::EventRunner> &runner)
: AppExecFwk::EventHandler(runner)
UsimDiallingNumbersService::UsimDiallingNumbersService() : TelEventHandler("UsimDiallingNumbersService")
{
InitFuncMap();
}
@ -314,7 +313,7 @@ void UsimDiallingNumbersService::SendBackResult(
std::unique_ptr<UsimFetcher> fd = callerPointer_->GetUniqueObject<UsimFetcher>();
std::unique_ptr<UsimResult> data = std::make_unique<UsimResult>(fd.get());
data->result = static_cast<std::shared_ptr<void>>(diallingnumbers);
owner->SendEvent(id, data);
TelEventHandler::SendTelEvent(owner, id, data);
TELEPHONY_LOGI("UsimDiallingNumbersService::SendBackResult send end");
}

View File

@ -98,25 +98,19 @@ int32_t TelRilCall::CallSupplementResponse(const HDI::Ril::V1_1::RilRadioRespons
int32_t TelRilCall::GetCallWaitingResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CallWaitResult &callWaitResult)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
std::shared_ptr<CallWaitResult> callWaitInfoResult = std::make_shared<CallWaitResult>();
if (callWaitInfoResult == nullptr) {
TELEPHONY_LOGE("ERROR : callWaitInfoResult == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
callWaitInfoResult->result.result = callWaitResult.result;
callWaitInfoResult->status = callWaitResult.status;
callWaitInfoResult->classCw = callWaitResult.classCw;
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(responseInfo);
std::shared_ptr<TelRilRequest> telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
} else if (radioResponseInfo.error != HRilErrType::NONE) {
callWaitInfoResult->result.index = telRilRequest->pointer_->GetParam();
if (radioResponseInfo.error != HRilErrType::NONE) {
callWaitInfoResult->result.result = TELEPHONY_ERR_FAIL;
}
callWaitInfoResult->result.index = telRilRequest->pointer_->GetParam();
return telRilRequest->pointer_->GetOwner()->SendEvent(
telRilRequest->pointer_->GetInnerEventId(), callWaitInfoResult);
return callWaitInfoResult;
};
return Response<std::shared_ptr<CallWaitResult>>(TELEPHONY_LOG_FUNC_NAME, responseInfo, getDataFunc);
}
int32_t TelRilCall::SetCallWaitingResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
@ -132,46 +126,36 @@ int32_t TelRilCall::SetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioRe
int32_t TelRilCall::GetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
const HDI::Ril::V1_1::CallForwardQueryInfoList &cFQueryList)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
std::shared_ptr<CallForwardQueryInfoList> cFQueryInfoList = std::make_shared<CallForwardQueryInfoList>();
if (cFQueryInfoList == nullptr) {
TELEPHONY_LOGE("ERROR : cFQueryInfoList == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(responseInfo);
BuildCFQueryInfoList(cFQueryInfoList, cFQueryList);
cFQueryInfoList->result.result = TELEPHONY_SUCCESS;
std::shared_ptr<TelRilRequest> telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
} else if (radioResponseInfo.error != HRilErrType::NONE) {
cFQueryInfoList->result.index = telRilRequest->pointer_->GetParam();
if (radioResponseInfo.error != HRilErrType::NONE) {
cFQueryInfoList->result.result = TELEPHONY_ERR_FAIL;
}
cFQueryInfoList->result.index = telRilRequest->pointer_->GetParam();
return telRilRequest->pointer_->GetOwner()->SendEvent(telRilRequest->pointer_->GetInnerEventId(), cFQueryInfoList);
return cFQueryInfoList;
};
return Response<std::shared_ptr<CallForwardQueryInfoList>>(TELEPHONY_LOG_FUNC_NAME, responseInfo, getDataFunc);
}
int32_t TelRilCall::GetClipResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::GetClipResult &getClipResult)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
std::shared_ptr<GetClipResult> clipResult = std::make_shared<GetClipResult>();
if (clipResult == nullptr) {
TELEPHONY_LOGE("ERROR : clipResult == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
clipResult->result.result = getClipResult.result;
clipResult->action = getClipResult.action;
clipResult->clipStat = getClipResult.clipStat;
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(responseInfo);
std::shared_ptr<TelRilRequest> telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
} else if (radioResponseInfo.error != HRilErrType::NONE) {
clipResult->result.index = telRilRequest->pointer_->GetParam();
if (radioResponseInfo.error != HRilErrType::NONE) {
clipResult->result.result = TELEPHONY_ERR_FAIL;
}
clipResult->result.index = telRilRequest->pointer_->GetParam();
return telRilRequest->pointer_->GetOwner()->SendEvent(telRilRequest->pointer_->GetInnerEventId(), clipResult);
return clipResult;
};
return Response<std::shared_ptr<GetClipResult>>(TELEPHONY_LOG_FUNC_NAME, responseInfo, getDataFunc);
}
int32_t TelRilCall::SetClipResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
@ -182,24 +166,19 @@ int32_t TelRilCall::SetClipResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &
int32_t TelRilCall::GetClirResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::GetClirResult &getClirResult)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
std::shared_ptr<GetClirResult> result = std::make_shared<GetClirResult>();
if (result == nullptr) {
TELEPHONY_LOGE("ERROR : result == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
result->result.result = getClirResult.result;
result->action = getClirResult.action;
result->clirStat = getClirResult.clirStat;
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(responseInfo);
std::shared_ptr<TelRilRequest> telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
} else if (radioResponseInfo.error != HRilErrType::NONE) {
if (radioResponseInfo.error != HRilErrType::NONE) {
result->result.result = TELEPHONY_ERR_FAIL;
}
result->result.index = telRilRequest->pointer_->GetParam();
return telRilRequest->pointer_->GetOwner()->SendEvent(telRilRequest->pointer_->GetInnerEventId(), result);
return result;
};
return Response<std::shared_ptr<GetClirResult>>(TELEPHONY_LOG_FUNC_NAME, responseInfo, getDataFunc);
}
int32_t TelRilCall::SetClirResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
@ -210,25 +189,19 @@ int32_t TelRilCall::SetClirResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &
int32_t TelRilCall::GetCallRestrictionResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CallRestrictionResult &result)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
std::shared_ptr<CallRestrictionResult> callRestrictionResult = std::make_shared<CallRestrictionResult>();
if (callRestrictionResult == nullptr) {
TELEPHONY_LOGE("ERROR : callRestrictionResult == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
callRestrictionResult->result.result = result.result;
callRestrictionResult->status = result.status;
callRestrictionResult->classCw = result.classCw;
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(responseInfo);
std::shared_ptr<TelRilRequest> telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
} else if (radioResponseInfo.error != HRilErrType::NONE) {
callRestrictionResult->result.index = telRilRequest->pointer_->GetParam();
if (radioResponseInfo.error != HRilErrType::NONE) {
callRestrictionResult->result.result = TELEPHONY_ERR_FAIL;
}
callRestrictionResult->result.index = telRilRequest->pointer_->GetParam();
return telRilRequest->pointer_->GetOwner()->SendEvent(
telRilRequest->pointer_->GetInnerEventId(), callRestrictionResult);
return callRestrictionResult;
};
return Response<std::shared_ptr<CallRestrictionResult>>(TELEPHONY_LOG_FUNC_NAME, responseInfo, getDataFunc);
}
int32_t TelRilCall::SetCallRestrictionResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
@ -250,12 +223,12 @@ int32_t TelRilCall::SendDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo
radioResponseInfo->error = static_cast<HRilErrType>(responseInfo.error);
AppExecFwk::InnerEvent::Pointer response =
AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SEND_DTMF, radioResponseInfo, TYPE_CS);
bool ret = telRilRequest->pointer_->GetOwner()->SendEvent(response);
if (!ret) {
TELEPHONY_LOGE("SendEvent fail!");
return TELEPHONY_ERR_FAIL;
const std::shared_ptr<OHOS::AppExecFwk::EventHandler> &handler = telRilRequest->pointer_->GetOwner();
if (handler == nullptr) {
TELEPHONY_LOGE("ERROR : ErrorResponse --> handler == nullptr !!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return TELEPHONY_SUCCESS;
return TelEventHandler::SendTelEvent(handler, response);
}
int32_t TelRilCall::StartDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
@ -735,19 +708,17 @@ void TelRilCall::BuildCFQueryInfoList(std::shared_ptr<CallForwardQueryInfoList>
int32_t TelRilCall::ResponseSupplement(const char *funcName, const HDI::Ril::V1_1::RilRadioResponseInfo &iResponseInfo)
{
auto getDataFunc = [&] (std::shared_ptr<TelRilRequest> telRilRequest) {
const auto &radioResponseInfo = BuildHRilRadioResponseInfo(iResponseInfo);
auto telRilRequest = FindTelRilRequest(radioResponseInfo);
int32_t ret = ConfirmSupplementOfTelRilRequestInfo(TELEPHONY_LOG_FUNC_NAME, telRilRequest);
if (ret != TELEPHONY_SUCCESS) {
return ret;
}
auto resultInfo = std::make_shared<SsBaseResult>();
resultInfo->index = telRilRequest->pointer_->GetParam();
resultInfo->result = TELEPHONY_SUCCESS;
if (radioResponseInfo.error != HRilErrType::NONE) {
resultInfo->result = TELEPHONY_ERR_FAIL;
}
return telRilRequest->pointer_->GetOwner()->SendEvent(telRilRequest->pointer_->GetInnerEventId(), resultInfo);
return resultInfo;
};
return Response<std::shared_ptr<SsBaseResult>>(TELEPHONY_LOG_FUNC_NAME, iResponseInfo, getDataFunc);
}
} // namespace Telephony
} // namespace OHOS

View File

@ -40,7 +40,10 @@ ohos_executable("tel_ril_test") {
configs = [ "$TELEPHONY_CORE_SERVICE_ROOT/utils:telephony_log_config" ]
deps = [ "$TELEPHONY_CORE_SERVICE_ROOT:tel_core_service" ]
deps = [
"$TELEPHONY_CORE_SERVICE_ROOT:tel_core_service",
"$TELEPHONY_CORE_SERVICE_ROOT/utils:libtel_common",
]
external_deps = [
"c_utils:utils",

View File

@ -49,7 +49,6 @@ bool IsServiceInited()
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto inner = std::make_shared<NetworkSearchManagerInner>();
networkSearchManager->AddManagerInner(DEFAULT_SIM_SLOT_ID, inner);
inner->eventLoop_ = AppExecFwk::EventRunner::Create("test");
TimeZoneManager::GetInstance().Init(networkSearchManager);
g_isInited = true;
}

View File

@ -44,8 +44,7 @@ void DoSomethingInterestingWithMyAPI(const uint8_t *data, size_t size)
auto telRilManager_ = std::make_shared<TelRilManager>();
auto stateManager_ = std::make_shared<SimStateManager>(telRilManager_);
auto eventLoopSms_ = AppExecFwk::EventRunner::Create("simSmsController");
auto simSmsController = std::make_shared<SimSmsController>(eventLoopSms_, stateManager_);
auto simSmsController = std::make_shared<SimSmsController>(stateManager_);
std::int32_t eventId = static_cast<int32_t>(size);
std::unique_ptr<uint8_t> object = std::make_unique<uint8_t>(*data);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventId, object);

View File

@ -43,8 +43,7 @@ constexpr int32_t TIMEZONE_OFFSET_NEGATIVE_1 = -1;
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_UpdateCountryCode_0100, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>(eventLoop);
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>();
timeZoneUpdater->Init();
std::string countryCode = "cn";
timeZoneUpdater->UpdateCountryCode(countryCode, DEFAULT_SIM_SLOT_ID);
@ -78,8 +77,7 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_UpdateCountryCode_0100, Func
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_UpdateTimeZoneOffset_0100, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>(eventLoop);
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>();
timeZoneUpdater->Init();
std::string countryCode = "cn";
timeZoneUpdater->UpdateCountryCode(countryCode, DEFAULT_SIM_SLOT_ID);
@ -123,8 +121,7 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_UpdateTimeZoneOffset_0100, F
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_TimeZoneID_0100, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>(eventLoop);
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>();
timeZoneUpdater->Init();
std::string countryCode = "cn";
timeZoneUpdater->UpdateCountryCode(countryCode, DEFAULT_SIM_SLOT_ID);
@ -166,8 +163,7 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_TimeZoneID_0100, Function |
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_Location_0100, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto suggester = std::make_shared<TimeZoneLocationSuggester>(eventLoop);
auto suggester = std::make_shared<TimeZoneLocationSuggester>();
auto idleState = new (std::nothrow) IdleState(std::weak_ptr<TimeZoneLocationSuggester>(suggester), "IdleState");
auto nitzState = new (std::nothrow) NitzState(std::weak_ptr<TimeZoneLocationSuggester>(suggester), "NitzState");
auto locationState =

View File

@ -107,7 +107,7 @@ bool SimTest::ParseOperatorConf(int32_t slotId)
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
auto simFileManager = std::make_shared<SimFileManager>(subcribeInfo,
std::weak_ptr<ITelRilManager>(telRilManager), std::weak_ptr<SimStateManager>(simStateManager));
OperatorConfigCache ofpc(nullptr, std::weak_ptr<SimFileManager>(simFileManager), slotId);
OperatorConfigCache ofpc(std::weak_ptr<SimFileManager>(simFileManager), slotId);
OperatorFileParser ofp;
OperatorConfig poc;
std::u16string result;

View File

@ -75,13 +75,6 @@ const int32_t CORE_NETWORK_MODE_NR = 31;
const int32_t VALUE_LENGTH = 128;
} // namespace
class DemoHandler : public AppExecFwk::EventHandler {
public:
explicit DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> &runner) : AppExecFwk::EventHandler(runner) {}
virtual ~DemoHandler() {}
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) {}
};
class BranchTest : public testing::Test {
public:
static void SetUpTestCase();
@ -1166,8 +1159,7 @@ HWTEST_F(BranchTest, Telephony_SimSmsController_001, Function | MediumTest | Lev
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("SimSmsController");
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::SimSmsController> simSmsController =
std::make_shared<SimSmsController>(runner, simStateManager);
std::shared_ptr<Telephony::SimSmsController> simSmsController = std::make_shared<SimSmsController>(simStateManager);
auto event = AppExecFwk::InnerEvent::Get(0);
auto eventGet = simSmsController->BuildCallerInfo(SIM_SMS_GET_COMPLETED);
auto eventUpdate = simSmsController->BuildCallerInfo(SIM_SMS_UPDATE_COMPLETED);
@ -1206,11 +1198,10 @@ HWTEST_F(BranchTest, Telephony_SimSmsController_001, Function | MediumTest | Lev
HWTEST_F(BranchTest, Telephony_MultiSimController_001, Function | MediumTest | Level1)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("MultiSimController");
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager = { nullptr, nullptr };
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager = { nullptr, nullptr };
std::shared_ptr<Telephony::MultiSimController> multiSimController =
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager, runner);
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager);
multiSimController->SortCache();
std::shared_ptr<RadioProtocolController> radioProtocolController = nullptr;
EXPECT_FALSE(multiSimController->InitData(0));
@ -1241,11 +1232,10 @@ HWTEST_F(BranchTest, Telephony_MultiSimController_002, Function | MediumTest | L
std::u16string testU16Str = u"";
std::string testStr = "";
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("MultiSimController");
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager = { nullptr, nullptr };
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager = { nullptr, nullptr };
std::shared_ptr<Telephony::MultiSimController> multiSimController =
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager, runner);
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager);
multiSimController->GetDefaultVoiceSlotId();
EXPECT_NE(multiSimController->SetDefaultVoiceSlotId(0), TELEPHONY_ERR_SUCCESS);
multiSimController->GetDefaultSmsSlotId();
@ -1508,7 +1498,6 @@ HWTEST_F(BranchTest, Telephony_SimStateManager_001, Function | MediumTest | Leve
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("test");
simStateManager->RegisterCoreNotify(nullptr, 1);
simStateManager->UnRegisterCoreNotify(nullptr, 1);
EXPECT_FALSE(simStateManager->HasSimCard());
@ -1917,9 +1906,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_002, Function | MediumTest |
auto simManager = std::make_shared<SimManager>(telRilManager);
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
auto inner = std::make_shared<NetworkSearchManagerInner>();
inner->networkSearchState_ = networkSearchState;
inner->observerHandler_ = std::make_unique<ObserverHandler>();
@ -1973,9 +1961,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_003, Function | MediumTest |
std::shared_ptr<SimManager> simManager = nullptr;
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
sptr<INetworkSearchCallback> networkSearchCallback = nullptr;
networkSearchManager->TriggerSimRefresh(INVALID_SLOTID);
networkSearchManager->RegisterCoreNotify(INVALID_SLOTID, networkSearchHandler, 1);
@ -2022,9 +2009,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_004, Function | MediumTest |
std::shared_ptr<SimManager> simManager = nullptr;
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
auto inner = std::make_shared<NetworkSearchManagerInner>();
inner->networkSearchState_ = networkSearchState;
inner->observerHandler_ = std::make_unique<ObserverHandler>();
@ -2066,9 +2052,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_005, Function | MediumTest |
std::shared_ptr<SimManager> simManager = nullptr;
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
networkSearchManager->OnInit();
sptr<INetworkSearchCallback> networkSearchCallback = nullptr;
sptr<NetworkSearchCallBackBase> callback = nullptr;
@ -2116,9 +2101,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_006, Function | MediumTest |
std::shared_ptr<SimManager> simManager = nullptr;
auto nsm = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(nsm, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, nsm, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(nsm, telRilManager, simManager, INVALID_SLOTID);
nsm->OnInit();
auto inner = std::make_shared<NetworkSearchManagerInner>();
inner->networkSearchState_ = networkSearchState;
@ -2182,9 +2166,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchHandler_001, Function | MediumTest |
auto simManager = std::make_shared<SimManager>(telRilManager);
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SIM_STATE_CHANGE, 1);
networkSearchHandler->GetRadioStateResponse(event);
networkSearchHandler->SetRadioStateResponse(event);
@ -2239,9 +2222,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchHandler_002, Function | MediumTest |
auto simManager = std::make_shared<SimManager>(telRilManager);
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto networkSearchState = std::make_shared<NetworkSearchState>(networkSearchManager, INVALID_SLOTID);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SIM_STATE_CHANGE, 1);
std::vector<sptr<SignalInformation>> signals;
std::vector<sptr<CellInformation>> cells;
@ -2295,9 +2277,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchHandler_003, Function | MediumTest |
std::shared_ptr<TelRilManager> telRilManager = nullptr;
auto simManager = std::make_shared<SimManager>(telRilManager);
auto networkSearchManager = std::make_shared<NetworkSearchManager>(telRilManager, simManager);
auto runner = AppExecFwk::EventRunner::Create("test");
auto networkSearchHandler =
std::make_shared<NetworkSearchHandler>(runner, networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
std::make_shared<NetworkSearchHandler>(networkSearchManager, telRilManager, simManager, INVALID_SLOTID);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RadioEvent::DELAY_NOTIFY_STATE_CHANGE);
event = nullptr;
RegServiceState regState = RegServiceState::REG_STATE_UNKNOWN;
@ -2466,10 +2447,9 @@ HWTEST_F(BranchTest, Telephony_UsimFileController_001, Function | MediumTest | L
HWTEST_F(BranchTest, Telephony_RadioProtocolController_001, Function | MediumTest | Level1)
{
auto telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("test");
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(INVALID_SLOTID, 1);
auto radioProtocolController =
std::make_shared<RadioProtocolController>(std::weak_ptr<TelRilManager>(telRilManager), runner);
std::make_shared<RadioProtocolController>(std::weak_ptr<TelRilManager>(telRilManager));
radioProtocolController->UnRegisterEvents();
radioProtocolController->ProcessGetRadioProtocol(event);
radioProtocolController->ProcessCheckRadioProtocol(event);
@ -2520,11 +2500,10 @@ HWTEST_F(BranchTest, Telephony_RadioProtocolController_001, Function | MediumTes
HWTEST_F(BranchTest, Telephony_StkController_001, Function | MediumTest | Level1)
{
std::string name = "StkController_";
auto stkEventLoop = AppExecFwk::EventRunner::Create(name.c_str());
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_STK_CALL_SETUP, 1);
std::shared_ptr<TelRilManager> telRilManager = nullptr;
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
auto stkController = std::make_shared<StkController>(stkEventLoop, telRilManager, simStateManager, INVALID_SLOTID);
auto stkController = std::make_shared<StkController>(telRilManager, simStateManager, INVALID_SLOTID);
std::string strCmd = "";
stkController->UnRegisterEvents();
stkController->ProcessEvent(event);
@ -2678,7 +2657,6 @@ HWTEST_F(BranchTest, Telephony_SimNumberDecode_001, Function | MediumTest | Leve
*/
HWTEST_F(BranchTest, Telephony_IccFile_001, Function | MediumTest | Level1)
{
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("test");
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<IccFile> iccFile = std::make_shared<IsimFile>(simStateManager);
@ -2723,6 +2701,17 @@ HWTEST_F(BranchTest, Telephony_IccFile_001, Function | MediumTest | Level1)
iccFile->oplFiles_.push_back(nullptr);
EXPECT_EQ(iccFile->ObtainEons(plmn, 0, true), "");
EXPECT_EQ(iccFile->ObtainEons(plmn, 0, false), "");
}
/**
* @tc.number Telephony_IccFile_002
* @tc.name test error branch
* @tc.desc Function test
*/
HWTEST_F(BranchTest, Telephony_IccFile_002, Function | MediumTest | Level1) {
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<IccFile> iccFile = std::make_shared<IsimFile>(simStateManager);
std::string langData = "";
EXPECT_EQ(iccFile->ObtainValidLanguage(langData), "");
}
@ -2758,7 +2747,6 @@ HWTEST_F(BranchTest, Telephony_SimRdbHelper_001, Function | MediumTest | Level1)
*/
HWTEST_F(BranchTest, Telephony_MultiSimMonitor_001, Function | MediumTest | Level1)
{
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("test");
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
auto simStateManagerPtr = std::make_shared<SimStateManager>(telRilManager);
auto telRilManagerWeak = std::weak_ptr<TelRilManager>(telRilManager);
@ -2771,13 +2759,12 @@ HWTEST_F(BranchTest, Telephony_MultiSimMonitor_001, Function | MediumTest | Leve
simStateManagerPtr };
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager = { simFileManagerPtr, simFileManagerPtr };
std::shared_ptr<Telephony::MultiSimController> multiSimController =
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager, runner);
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager);
std::vector<std::weak_ptr<Telephony::SimFileManager>> simFileManagerWeak = {
std::weak_ptr<Telephony::SimFileManager>(simFileManagerPtr),
std::weak_ptr<Telephony::SimFileManager>(simFileManagerPtr)
};
auto multiSimMonitor =
std::make_shared<MultiSimMonitor>(runner, multiSimController, simStateManager, simFileManagerWeak);
auto multiSimMonitor = std::make_shared<MultiSimMonitor>(multiSimController, simStateManager, simFileManagerWeak);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SIM_RECORDS_LOADED, 1);
multiSimMonitor->ProcessEvent(event);
event = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SIM_STATE_CHANGE, 1);

View File

@ -26,7 +26,6 @@
#include "network_search_test_callback_stub.h"
#include "operator_name.h"
#include "operator_name_utils.h"
#include "runner_pool.h"
#include "security_token.h"
#include "sim_manager.h"
#include "tel_ril_manager.h"
@ -45,13 +44,6 @@ const std::string NITZ_STR = "23/10/16,09:10:33+32,00";
const std::string NITZ_STR_INVALID = "202312102359";
} // namespace
class DemoHandler : public AppExecFwk::EventHandler {
public:
explicit DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> &runner) : AppExecFwk::EventHandler(runner) {}
virtual ~DemoHandler() {}
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) {}
};
class CoreServiceBranchTest : public testing::Test {
public:
static void SetUpTestCase();
@ -61,7 +53,6 @@ public:
};
void CoreServiceBranchTest::SetUpTestCase()
{
RunnerPool::GetInstance().Init();
DelayedSingleton<CoreService>::GetInstance()->Init();
}
@ -410,21 +401,6 @@ HWTEST_F(CoreServiceBranchTest, Telephony_CoreService_HiSysEvent_001, Function |
coreServiceHiSysEvent->WriteAirplaneModeChangeEvent(argInt);
}
/**
* @tc.number Telephony_CoreService_RunnerPool_001
* @tc.name test normal branch
* @tc.desc Function test
*/
HWTEST_F(CoreServiceBranchTest, Telephony_CoreService_RunnerPool_001, Function | MediumTest | Level1)
{
RunnerPool::GetInstance().Init();
RunnerPool::GetInstance().Init();
std::string name = "";
EXPECT_TRUE(RunnerPool::GetInstance().CreateRunner(name) != nullptr);
EXPECT_TRUE(RunnerPool::GetInstance().GetCommonRunner() != nullptr);
EXPECT_TRUE(RunnerPool::GetInstance().GetSimDbAndFileRunner() != nullptr);
}
/**
* @tc.number Telephony_TimeZoneManager_001
* @tc.name test normal branch
@ -451,7 +427,6 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneManager_001, Function | Medium
auto inner = std::make_shared<NetworkSearchManagerInner>();
networkSearchManager->AddManagerInner(DEFAULT_SIM_SLOT_ID, inner);
TimeZoneManager::GetInstance().Init(networkSearchManager);
inner->eventLoop_ = AppExecFwk::EventRunner::Create("test");
TimeZoneManager::GetInstance().Init(networkSearchManager);
TimeZoneManager::GetInstance().Init(networkSearchManager);
TimeZoneManager::GetInstance().UpdateCountryCode(countryCode, DEFAULT_SIM_SLOT_ID);
@ -471,8 +446,7 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneManager_001, Function | Medium
*/
HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneUpdater_001, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>(eventLoop);
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>();
timeZoneUpdater->Init();
auto event = AppExecFwk::InnerEvent::Get(0);
timeZoneUpdater->ProcessEvent(event);
@ -524,8 +498,7 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneUpdater_001, Function | Medium
*/
HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneUpdater_002, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>(eventLoop);
auto timeZoneUpdater = std::make_shared<TimeZoneUpdater>();
auto event = AppExecFwk::InnerEvent::Get(0);
timeZoneUpdater->ProcessEvent(event);
std::string countryCode = "cn";
@ -561,8 +534,7 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneUpdater_002, Function | Medium
*/
HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneLocationSuggester_001, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto suggester = std::make_shared<TimeZoneLocationSuggester>(eventLoop);
auto suggester = std::make_shared<TimeZoneLocationSuggester>();
suggester->Init();
suggester->NitzUpdate();
#ifdef ABILITY_LOCATION_SUPPORT
@ -583,8 +555,7 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneLocationSuggester_001, Functio
*/
HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneLocationUpdate_001, Function | MediumTest | Level1)
{
auto eventLoop = AppExecFwk::EventRunner::Create("test");
auto suggester = std::make_shared<TimeZoneLocationSuggester>(eventLoop);
auto suggester = std::make_shared<TimeZoneLocationSuggester>();
auto update = std::make_shared<TimeZoneLocationUpdate>(suggester);
update->StartPassiveUpdate();
update->StopPassiveUpdate();
@ -612,11 +583,10 @@ HWTEST_F(CoreServiceBranchTest, Telephony_TimeZoneLocationUpdate_001, Function |
HWTEST_F(CoreServiceBranchTest, Telephony_MultiSimController_003, Function | MediumTest | Level1)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("MultiSimController");
std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager = { nullptr, nullptr };
std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager = { nullptr, nullptr };
std::shared_ptr<Telephony::MultiSimController> multiSimController =
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager, runner);
std::make_shared<MultiSimController>(telRilManager, simStateManager, simFileManager);
std::shared_ptr<RadioProtocolController> radioProtocolController = nullptr;
multiSimController->EncryptIccId("");
multiSimController->CheckIfNeedSwitchMainSlotId();

View File

@ -27,7 +27,6 @@
#include "operator_config_loader.h"
#include "parcel.h"
#include "plmn_file.h"
#include "runner_pool.h"
#include "sim_account_manager.h"
#include "sim_data_type.h"
#include "sim_file_controller.h"
@ -74,19 +73,13 @@ void SimRilBranchTest::TearDown() {}
*/
HWTEST_F(SimRilBranchTest, Telephony_IccOperatorPrivilegeController_001, Function | MediumTest | Level1)
{
auto runner = AppExecFwk::EventRunner::Create("test");
auto telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
auto iccOperatorPrivilegeController =
std::make_shared<IccOperatorPrivilegeController>(runner, telRilManager, simStateManager);
auto iccOperatorPrivilegeController1 =
std::make_shared<IccOperatorPrivilegeController>(nullptr, telRilManager, simStateManager);
auto iccOperatorPrivilegeController2 =
std::make_shared<IccOperatorPrivilegeController>(runner, nullptr, simStateManager);
auto iccOperatorPrivilegeController3 =
std::make_shared<IccOperatorPrivilegeController>(runner, telRilManager, nullptr);
std::make_shared<IccOperatorPrivilegeController>(telRilManager, simStateManager);
auto iccOperatorPrivilegeController2 = std::make_shared<IccOperatorPrivilegeController>(nullptr, simStateManager);
auto iccOperatorPrivilegeController3 = std::make_shared<IccOperatorPrivilegeController>(telRilManager, nullptr);
iccOperatorPrivilegeController->Init(0);
iccOperatorPrivilegeController1->Init(0);
iccOperatorPrivilegeController2->Init(0);
iccOperatorPrivilegeController3->Init(0);
int slotId = 2;
@ -165,12 +158,11 @@ HWTEST_F(SimRilBranchTest, Telephony_OperatorConfigLoader_001, Function | Medium
{
auto telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
auto runner = AppExecFwk::EventRunner::Create("SimAccountManager");
EventFwk::MatchingSkills matchingSkills;
matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
auto simFileManager = std::make_shared<SimFileManager>(subcribeInfo, telRilManager, simStateManager);
auto operatorConfigCache = std::make_shared<OperatorConfigCache>(runner, simFileManager, 0);
auto operatorConfigCache = std::make_shared<OperatorConfigCache>(simFileManager, 0);
auto operatorConfigLoader = std::make_shared<OperatorConfigLoader>(simFileManager, operatorConfigCache);
operatorConfigLoader->LoadOperatorConfig(0);
operatorConfigLoader->operatorConfigCache_ = nullptr;
@ -209,17 +201,15 @@ HWTEST_F(SimRilBranchTest, Telephony_StkManager_001, Function | MediumTest | Lev
*/
HWTEST_F(SimRilBranchTest, Telephony_SimStateTracker_001, Function | MediumTest | Level1)
{
auto simStateTrackerRunner = AppExecFwk::EventRunner::Create("test");
auto operatorConfigCacheRunner = AppExecFwk::EventRunner::Create("test");
auto telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
auto simFileManager = std::make_shared<SimFileManager>(subcribeInfo, telRilManager, simStateManager);
auto operatorConfigCache = std::make_shared<OperatorConfigCache>(operatorConfigCacheRunner, simFileManager, 0);
auto operatorConfigCache = std::make_shared<OperatorConfigCache>(simFileManager, 0);
auto simStateTracker =
std::make_shared<SimStateTracker>(simStateTrackerRunner, simFileManager, operatorConfigCache, 0);
std::make_shared<SimStateTracker>(simFileManager, operatorConfigCache, 0);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(1, 1);
event = nullptr;
simStateTracker->ProcessEvent(event);
@ -255,7 +245,6 @@ HWTEST_F(SimRilBranchTest, Telephony_PlmnFile_001, Function | MediumTest | Level
*/
HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersCache_001, Function | MediumTest | Level1)
{
auto eventLoopDiallingNumbers = AppExecFwk::EventRunner::Create("test");
auto telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
@ -263,7 +252,7 @@ HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersCache_001, Function | Med
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
auto simFileManager = std::make_shared<SimFileManager>(subcribeInfo, telRilManager, simStateManager);
auto diallingNumbersCache = std::make_shared<IccDiallingNumbersCache>(eventLoopDiallingNumbers, simFileManager);
auto diallingNumbersCache = std::make_shared<IccDiallingNumbersCache>(simFileManager);
diallingNumbersCache->simFileManager_ = nullptr;
diallingNumbersCache->Init();
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(1, 1);
@ -285,10 +274,9 @@ HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersCache_001, Function | Med
*/
HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersHandler_001, Function | MediumTest | Level1)
{
std::shared_ptr<AppExecFwk::EventRunner> loaderLoop = AppExecFwk::EventRunner::Create("test");
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create("test");
std::shared_ptr<IccFileController> iccFileController = std::make_shared<SimFileController>(1);
auto diallingNumberHandler = std::make_shared<IccDiallingNumbersHandler>(loaderLoop, iccFileController);
auto diallingNumberHandler = std::make_shared<IccDiallingNumbersHandler>(iccFileController);
diallingNumberHandler->fileController_ = nullptr;
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(1, 1);
DiallingNumberUpdateInfor infor;
@ -331,7 +319,6 @@ HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersHandler_001, Function | M
*/
HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersManager_001, Function | MediumTest | Level1)
{
RunnerPool::GetInstance().Init();
auto telRilManager = std::make_shared<TelRilManager>();
auto simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
@ -380,8 +367,7 @@ HWTEST_F(SimRilBranchTest, Telephony_IccDiallingNumbersManager_001, Function | M
*/
HWTEST_F(SimRilBranchTest, Telephony_UsimDiallingNumbersService_001, Function | MediumTest | Level1)
{
auto runner = AppExecFwk::EventRunner::Create("test");
auto usimDiallingNumbersService = std::make_shared<UsimDiallingNumbersService>(runner);
auto usimDiallingNumbersService = std::make_shared<UsimDiallingNumbersService>();
usimDiallingNumbersService->InitFuncMap();
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(1, 1);
event = nullptr;
@ -620,7 +606,6 @@ HWTEST_F(SimRilBranchTest, Telephony_SimManager_001, Function | MediumTest | Lev
{
std::shared_ptr<ITelRilManager> telRilManager = nullptr;
auto simManager = std::make_shared<SimManager>(telRilManager);
RunnerPool::GetInstance().commonRunner_ = nullptr;
simManager->InitSingleSimObject();
simManager->slotCount_ = 1;
int32_t slotId;
@ -647,7 +632,6 @@ HWTEST_F(SimRilBranchTest, Telephony_SimManager_001, Function | MediumTest | Lev
simManager->slotCount_ = 0;
simManager->GetPrimarySlotId(slotId);
EXPECT_GT(simManager->GetDefaultSmsSlotId(), TELEPHONY_PERMISSION_ERROR);
RunnerPool::GetInstance().commonRunner_ = RunnerPool::GetInstance().CreateRunner("CoreServiceCommonRunner");
}
AppExecFwk::InnerEvent::Pointer GetControllerToFileMsgEvent(int32_t code, bool withException)