!2320 添加esim接口

Merge pull request !2320 from yang/master
This commit is contained in:
openharmony_ci 2024-10-13 09:45:34 +00:00 committed by Gitee
commit 816aeb04f5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
25 changed files with 1222 additions and 4 deletions

View File

@ -1296,6 +1296,38 @@ int32_t CoreServiceClient::RemoveNotificationFromList(
}
return proxy->RemoveNotificationFromList(slotId, portIndex, seqNumber, enumResult);
}
int32_t CoreServiceClient::DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
TELEPHONY_LOGE("proxy is null!");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->DeleteProfile(slotId, iccId, enumResult);
}
int32_t CoreServiceClient::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
TELEPHONY_LOGE("proxy is null!");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, enumResult);
}
int32_t CoreServiceClient::SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
TELEPHONY_LOGE("proxy is null!");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->SetProfileNickname(slotId, iccId, nickname, enumResult);
}
#endif
} // namespace Telephony
} // namespace OHOS

View File

@ -4039,6 +4039,102 @@ int32_t CoreServiceProxy::RemoveNotificationFromList(
}
return result;
}
int32_t CoreServiceProxy::DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!WriteInterfaceToken(data)) {
TELEPHONY_LOGE("WriteInterfaceToken is false");
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
if (!data.WriteInt32(slotId) || data.WriteString16(iccId)) {
TELEPHONY_LOGE("WriteInt32 or WriteString16 is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
auto remote = Remote();
if (remote == nullptr) {
TELEPHONY_LOGE("Remote is null");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t sendRequestRet = remote->SendRequest(static_cast<uint32_t>(
CoreServiceInterfaceCode::DELETE_PROFILE), data, reply, option);
if (sendRequestRet != ERR_NONE) {
TELEPHONY_LOGE("DeleteProfile failed, error code is %{public}d", sendRequestRet);
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
enumResult = static_cast<ResultState>(reply.ReadInt32());
}
return result;
}
int32_t CoreServiceProxy::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!WriteInterfaceToken(data)) {
TELEPHONY_LOGE("WriteInterfaceToken is false");
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
if (!data.WriteInt32(slotId) || !data.WriteInt32(portIndex) ||
!data.WriteString16(iccId) || !data.WriteBool(forceDeactivateSim)) {
TELEPHONY_LOGE("Write is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
auto remote = Remote();
if (remote == nullptr) {
TELEPHONY_LOGE("Remote is null");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t sendRequestRet = remote->SendRequest(static_cast<uint32_t>(
CoreServiceInterfaceCode::SWITCH_TO_PROFILE), data, reply, option);
if (sendRequestRet != ERR_NONE) {
TELEPHONY_LOGE("SwitchToProfile failed, error code is %{public}d", sendRequestRet);
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
enumResult = static_cast<ResultState>(reply.ReadInt32());
}
return result;
}
int32_t CoreServiceProxy::SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!WriteInterfaceToken(data)) {
TELEPHONY_LOGE("WriteInterfaceToken is false");
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
if (!data.WriteInt32(slotId) || data.WriteString16(iccId) || !data.WriteString16(nickname)) {
TELEPHONY_LOGE("Write is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
auto remote = Remote();
if (remote == nullptr) {
TELEPHONY_LOGE("Remote is null");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t sendRequestRet = remote->SendRequest(
static_cast<uint32_t>(CoreServiceInterfaceCode::UPDATE_PROFILE_NICKNAME), data, reply, option);
if (sendRequestRet != ERR_NONE) {
TELEPHONY_LOGE("SetProfileNickname failed, error code is %{public}d", st);
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
enumResult = static_cast<ResultState>(reply.ReadInt32());
}
return result;
}
#endif
} // namespace Telephony
} // namespace OHOS

View File

@ -1138,6 +1138,42 @@ public:
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t RemoveNotificationFromList(int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult);
/**
* @brief Deletes the given profile.
*
* @param slotId[in], sim slot id
* @param iccId[in], the iccId of the profile
* @param enumResult[out], the response to obtain
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult);
/**
* @brief Obtain the international mobile subscriber identity
*
* @param slotId[in], sim slot id
* @param portIndex[in], index of the port from the slot
* @param iccId[in], the iccId of the profile
* @param forceDeactivateSim[in], if true, and if an active SIM must be deactivated to access the eUICC,
* perform this action automatically
* @param enumResult[out], the response to obtain
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim,
ResultState &enumResult);
/**
* @brief Obtain the international mobile subscriber identity
*
* @param slotId[in], sim slot id
* @param iccId[in], the iccId of the profile
* @param nickname[in], the nickname of the profile
* @param enumResult[out], the response to obtain
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult);
#endif
private:

View File

@ -180,6 +180,11 @@ public:
int32_t slotId, int32_t portIndex, int32_t seqNumber, EuiccNotification &notification) override;
int32_t RemoveNotificationFromList(
int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult) override;
int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult) override;
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim,
ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;
#endif
private:

View File

@ -186,6 +186,11 @@ public:
int32_t slotId, int32_t portIndex, int32_t seqNumber, EuiccNotification &notification) = 0;
virtual int32_t RemoveNotificationFromList(
int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult) = 0;
virtual int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult) = 0;
virtual int32_t SwitchToProfile(int32_t slotId, int32_t portIndex,
const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult) = 0;
virtual int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) = 0;
#endif
protected:

View File

@ -178,6 +178,11 @@ public:
int32_t slotId, int32_t portIndex, int32_t seqNumber, EuiccNotification &notification) = 0;
virtual int32_t RemoveNotificationFromList(
int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult) = 0;
virtual int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult) = 0;
virtual int32_t SwitchToProfile(int32_t slotId, int32_t portIndex,
const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult) = 0;
virtual int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) = 0;
#endif
};
} // namespace Telephony

View File

@ -313,6 +313,16 @@ public:
int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult) override;
#endif
#ifdef CORE_SERVICE_SUPPORT_ESIM
int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult) override;
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId,
bool forceDeactivateSim, ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;
#endif
private:
bool Init();

View File

@ -165,6 +165,9 @@ private:
int32_t OnRetrieveNotificationList(MessageParcel &data, MessageParcel &reply);
int32_t OnRetrieveNotification(MessageParcel &data, MessageParcel &reply);
int32_t OnRemoveNotificationFromList(MessageParcel &data, MessageParcel &reply);
int32_t OnDeleteProfile(MessageParcel &data, MessageParcel &reply);
int32_t OnSwitchToProfile(MessageParcel &data, MessageParcel &reply);
int32_t OnSetProfileNickname(MessageParcel &data, MessageParcel &reply);
#endif
private:

View File

@ -1992,6 +1992,59 @@ int32_t CoreService::RemoveNotificationFromList(
}
return simManager_->RemoveNotificationFromList(slotId, portIndex, seqNumber, enumResult);
}
int32_t CoreService::DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {
TELEPHONY_LOGE("Non-system applications use system APIs!");
return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API;
}
if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_ESIM_STATE)) {
TELEPHONY_LOGE("Failed because no permission:SET_TELEPHONY_ESIM_STATE");
return TELEPHONY_ERR_PERMISSION_ERR;
}
if (simManager_ == nullptr) {
TELEPHONY_LOGE("simManager_ is null");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return simManager_->DeleteProfile(slotId, iccId, enumResult);
}
int32_t CoreService::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {
TELEPHONY_LOGE("Non-system applications use system APIs!");
return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API;
}
if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_ESIM_STATE_OPEN)) {
TELEPHONY_LOGE("Failed because no permission:SET_TELEPHONY_ESIM_STATE_OPEN");
return TELEPHONY_ERR_PERMISSION_ERR;
}
if (simManager_ == nullptr) {
TELEPHONY_LOGE("simManager_ is null");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return simManager_->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, enumResult);
}
int32_t CoreService::SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {
TELEPHONY_LOGE("Non-system applications use system APIs!");
return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API;
}
if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_ESIM_STATE_OPEN)) {
TELEPHONY_LOGE("Failed because no permission:SET_TELEPHONY_ESIM_STATE_OPEN");
return TELEPHONY_ERR_PERMISSION_ERR;
}
if (simManager_ == nullptr) {
TELEPHONY_LOGE("simManager_ is null");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return simManager_->SetProfileNickname(slotId, iccId, nickname, enumResult);
}
#endif
} // namespace Telephony
} // namespace OHOS

View File

@ -318,6 +318,12 @@ void CoreServiceStub::AddHandlerEsimToMap()
[this](MessageParcel &data, MessageParcel &reply) { return OnRetrieveNotification(data, reply); };
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::REMOVE_NOTIFICATION)] =
[this](MessageParcel &data, MessageParcel &reply) { return OnRemoveNotificationFromList(data, reply); };
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::DELETE_PROFILE)] =
[this](MessageParcel &data, MessageParcel &reply) { return OnDeleteProfile(data, reply); };
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::SWITCH_TO_PROFILE)] =
[this](MessageParcel &data, MessageParcel &reply) { return OnSwitchToProfile(data, reply); };
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::UPDATE_PROFILE_NICKNAME)] =
[this](MessageParcel &data, MessageParcel &reply) { return OnSetProfileNickname(data, reply); };
}
#endif
@ -2421,6 +2427,60 @@ int32_t CoreServiceStub::OnRemoveNotificationFromList(MessageParcel &data, Messa
}
return NO_ERROR;
}
int32_t CoreServiceStub::OnDeleteProfile(MessageParcel &data, MessageParcel &reply)
{
int32_t slotId = data.ReadInt32();
std::u16string iccId = data.ReadString16();
ResultState enumResult;
int32_t result = DeleteProfile(slotId, iccId, enumResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(enumResult)));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
return NO_ERROR;
}
int32_t CoreServiceStub::OnSwitchToProfile(MessageParcel &data, MessageParcel &reply)
{
int32_t slotId = data.ReadInt32();
int32_t portIndex = data.ReadInt32();
std::u16string iccId = data.ReadString16();
bool forceDeactivateSim = data.ReadBool();
ResultState enumResult;
int32_t result = SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, enumResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(enumResult)));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
return NO_ERROR;
}
int32_t CoreServiceStub::OnSetProfileNickname(MessageParcel &data, MessageParcel &reply)
{
int32_t slotId = data.ReadInt32();
std::u16string iccId = data.ReadString16();
std::u16string nickname = data.ReadString16();
ResultState enumResult;
int32_t result = SetProfileNickname(slotId, iccId, nickname, enumResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(enumResult)));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
return NO_ERROR;
}
#endif
} // namespace Telephony
} // namespace OHOS

View File

@ -90,6 +90,9 @@ public:
EuiccNotificationList RetrieveNotificationList(int32_t portIndex, Event events);
EuiccNotification ObtainRetrieveNotification(int32_t portIndex, int32_t seqNumber);
ResultState RemoveNotificationFromList(int32_t portIndex, int32_t seqNumber);
ResultState DeleteProfile(const std::u16string &iccId);
ResultState SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim);
ResultState SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname);
private:
using FileProcessFunc = std::function<bool(const AppExecFwk::InnerEvent::Pointer &event)>;
@ -172,6 +175,12 @@ private:
bool RetrieveNotificatioParseTagCtxComp0(std::shared_ptr<Asn1Node> &root);
bool ProcessRemoveNotification(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent);
bool ProcessRemoveNotificationDone(const AppExecFwk::InnerEvent::Pointer &event);
bool ProcessDeleteProfile(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent);
bool ProcessDeleteProfileDone(const AppExecFwk::InnerEvent::Pointer &event);
bool ProcessSwitchToProfile(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent);
bool ProcessSwitchToProfileDone(const AppExecFwk::InnerEvent::Pointer &event);
bool ProcessSetNickname(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent);
bool ProcessSetNicknameDone(const AppExecFwk::InnerEvent::Pointer &event);
private:
std::map<int32_t, FileProcessFunc> memberFuncMap_;
@ -184,7 +193,7 @@ private:
ResultState delProfile_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState setDpAddressResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState switchResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState updateNicknameResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState setNicknameResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState resetResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState disableProfileResult_ = ResultState::RESULT_UNDEFINED_ERROR;
ResultState factoryResetResult_ = ResultState::RESULT_UNDEFINED_ERROR;
@ -287,6 +296,18 @@ private:
std::mutex removeNotificationMutex_;
std::condition_variable removeNotificationCv_;
bool isRemoveNotificationReady_ = false;
std::mutex deleteProfileMutex_;
std::condition_variable deleteProfileCv_;
bool isDeleteProfileReady_ = false;
std::mutex switchToProfileMutex_;
std::condition_variable switchToProfileCv_;
bool isSwitchToProfileReady_ = false;
std::mutex setNicknameMutex_;
std::condition_variable setNicknameCv_;
bool isSetNicknameReady_ = false;
};
} // namespace Telephony
} // namespace OHOS

View File

@ -115,6 +115,12 @@ public:
ResultState RemoveNotificationFromList(int32_t portIndex, int32_t seqNumber);
#endif
#ifdef CORE_SERVICE_SUPPORT_ESIM
ResultState DeleteProfile(const std::u16string &iccId);
ResultState SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim);
ResultState SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname);
#endif
protected:
std::weak_ptr<Telephony::ITelRilManager> telRilManager_;
std::shared_ptr<IccFileController> fileController_ = nullptr;

View File

@ -189,6 +189,14 @@ public:
int32_t slotId, int32_t portIndex, int32_t seqNumber, ResultState &enumResult) override;
#endif
#ifdef CORE_SERVICE_SUPPORT_ESIM
int32_t DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult) override;
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId,
bool forceDeactivateSim, ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;
#endif
private:
bool IsValidSlotId(int32_t slotId);
template<class N>

View File

@ -2442,6 +2442,222 @@ bool EsimFile::ProcessRemoveNotificationDone(const AppExecFwk::InnerEvent::Point
return true;
}
ResultState EsimFile::DeleteProfile(const std::u16string &iccId)
{
esimProfile_.iccId = iccId;
SyncOpenChannel();
AppExecFwk::InnerEvent::Pointer eventDeleteProfile = BuildCallerInfo(MSG_ESIM_DELETE_PROFILE);
if (!ProcessDeleteProfile(slotId_, eventDeleteProfile)) {
TELEPHONY_LOGE("ProcessDeleteProfile encode failed");
return ResultState();
}
isDeleteProfileReady_ = false;
std::unique_lock<std::mutex> lock(deleteProfileMutex_);
if (!deleteProfileCv_.wait_for(lock, std::chrono::seconds(WAIT_TIME_LONG_SECOND_FOR_ESIM),
[this]() { return isDeleteProfileReady_; })) {
SyncCloseChannel();
return ResultState();
}
SyncCloseChannel();
return delProfile_;
}
ResultState EsimFile::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim)
{
esimProfile_.portIndex = portIndex;
esimProfile_.iccId = iccId;
esimProfile_.forceDeactivateSim = forceDeactivateSim;
SyncOpenChannel();
AppExecFwk::InnerEvent::Pointer eventSwitchToProfile = BuildCallerInfo(MSG_ESIM_SWITCH_PROFILE);
if (!ProcessSwitchToProfile(slotId_, eventSwitchToProfile)) {
TELEPHONY_LOGE("ProcessSwitchToProfile encode failed");
return ResultState();
}
isSwitchToProfileReady_ = false;
std::unique_lock<std::mutex> lock(switchToProfileMutex_);
if (!switchToProfileCv_.wait_for(lock, std::chrono::seconds(WAIT_TIME_LONG_SECOND_FOR_ESIM),
[this]() { return isSwitchToProfileReady_; })) {
SyncCloseChannel();
return ResultState();
}
SyncCloseChannel();
return switchResult_;
}
ResultState EsimFile::SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname)
{
esimProfile_.iccId = iccId;
esimProfile_.nickname = nickname;
SyncOpenChannel();
AppExecFwk::InnerEvent::Pointer eventSetNickName = BuildCallerInfo(MSG_ESIM_SET_NICK_NAME);
if (!ProcessSetNickname(slotId_, eventSetNickName)) {
TELEPHONY_LOGE("ProcessSetNickname encode failed");
return ResultState();
}
isSetNicknameReady_ = false;
std::unique_lock<std::mutex> lock(setNicknameMutex_);
if (!setNicknameCv_.wait_for(lock, std::chrono::seconds(WAIT_TIME_LONG_SECOND_FOR_ESIM),
[this]() { return isSetNicknameReady_; })) {
SyncCloseChannel();
return ResultState();
}
SyncCloseChannel();
return setNicknameResult_;
}
bool EsimFile::ProcessDeleteProfile(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent)
{
if (!IsLogicChannelOpen()) {
return false;
}
std::shared_ptr<Asn1Builder> builder = std::make_shared<Asn1Builder>(TAG_ESIM_DELETE_PROFILE);
if (builder == nullptr) {
TELEPHONY_LOGE("builder is nullptr");
return false;
}
std::vector<uint8_t> iccidBytes;
std::string strIccId = OHOS::Telephony::ToUtf8(esimProfile_.iccId);
Asn1Utils::BcdToBytes(strIccId, iccidBytes);
builder->Asn1AddChildAsBytes(TAG_ESIM_ICCID, iccidBytes, iccidBytes.size());
ApduSimIORequestInfo reqInfo;
CommBuildOneApduReqInfo(reqInfo, builder);
if (telRilManager_ == nullptr) {
return false;
}
int32_t apduResult = telRilManager_->SimTransmitApduLogicalChannel(slotId, reqInfo, responseEvent);
if (apduResult == TELEPHONY_ERR_FAIL) {
return false;
}
return true;
}
bool EsimFile::ProcessSetNickname(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent)
{
if (!IsLogicChannelOpen()) {
return false;
}
std::shared_ptr<Asn1Builder> builder = std::make_shared<Asn1Builder>(TAG_ESIM_SET_NICKNAME);
if (builder == nullptr) {
TELEPHONY_LOGE("builder is nullptr");
return false;
}
std::vector<uint8_t> iccidBytes;
std::string strIccId = OHOS::Telephony::ToUtf8(esimProfile_.iccId);
std::string childStr = OHOS::Telephony::ToUtf8(esimProfile_.nickname);
Asn1Utils::BcdToBytes(strIccId, iccidBytes);
builder->Asn1AddChildAsBytes(TAG_ESIM_ICCID, iccidBytes, iccidBytes.size());
builder->Asn1AddChildAsString(TAG_ESIM_NICKNAME, childStr);
ApduSimIORequestInfo reqInfo;
CommBuildOneApduReqInfo(reqInfo, builder);
if (telRilManager_ == nullptr) {
return false;
}
int32_t apduResult = telRilManager_->SimTransmitApduLogicalChannel(slotId, reqInfo, responseEvent);
if (apduResult == TELEPHONY_ERR_FAIL) {
return false;
}
return true;
}
bool EsimFile::ProcessDeleteProfileDone(const AppExecFwk::InnerEvent::Pointer &event)
{
std::shared_ptr<Asn1Node> root = ParseEvent(event);
if (root == nullptr) {
TELEPHONY_LOGE("Asn1ParseResponse failed");
return false;
}
std::shared_ptr<Asn1Node> Asn1NodeData = root->Asn1GetChild(TAG_ESIM_CTX_0);
if (Asn1NodeData == nullptr) {
TELEPHONY_LOGE("pAsn1Node is nullptr");
return false;
}
delProfile_ = static_cast<ResultState>(Asn1NodeData->Asn1AsInteger());
{
std::lock_guard<std::mutex> lock(deleteProfileMutex_);
isDeleteProfileReady_ = true;
}
deleteProfileCv_.notify_one();
return true;
}
bool EsimFile::ProcessSwitchToProfile(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &responseEvent)
{
if (!IsLogicChannelOpen()) {
return false;
}
std::shared_ptr<Asn1Builder> builder = std::make_shared<Asn1Builder>(TAG_ESIM_ENABLE_PROFILE);
std::shared_ptr<Asn1Builder> subBuilder = std::make_shared<Asn1Builder>(TAG_ESIM_CTX_COMP_0);
if (builder == nullptr || subBuilder == nullptr) {
TELEPHONY_LOGE("get builder failed");
return false;
}
std::vector<uint8_t> iccidBytes;
std::string strIccId = OHOS::Telephony::ToUtf8(esimProfile_.iccId);
Asn1Utils::BcdToBytes(strIccId, iccidBytes);
subBuilder->Asn1AddChildAsBytes(TAG_ESIM_ICCID, iccidBytes, iccidBytes.size());
std::shared_ptr<Asn1Node> subNode = subBuilder->Asn1Build();
if (subNode == nullptr) {
TELEPHONY_LOGE("subNode is nullptr");
return false;
}
builder->Asn1AddChild(subNode);
builder->Asn1AddChildAsBoolean(TAG_ESIM_CTX_1, true);
ApduSimIORequestInfo reqInfo;
CommBuildOneApduReqInfo(reqInfo, builder);
if (telRilManager_ == nullptr) {
return false;
}
int32_t apduResult = telRilManager_->SimTransmitApduLogicalChannel(slotId, reqInfo, responseEvent);
if (apduResult == TELEPHONY_ERR_FAIL) {
return false;
}
return true;
}
bool EsimFile::ProcessSwitchToProfileDone(const AppExecFwk::InnerEvent::Pointer &event)
{
std::shared_ptr<Asn1Node> root = ParseEvent(event);
if (root == nullptr) {
TELEPHONY_LOGE("Asn1ParseResponse failed");
return false;
}
std::shared_ptr<Asn1Node> asn1NodeData = root->Asn1GetChild(TAG_ESIM_CTX_0);
if (asn1NodeData == nullptr) {
TELEPHONY_LOGE("asn1NodeData is nullptr");
return false;
}
switchResult_ = static_cast<ResultState>(asn1NodeData->Asn1AsInteger());
{
std::lock_guard<std::mutex> lock(switchToProfileMutex_);
isSwitchToProfileReady_ = true;
}
switchToProfileCv_.notify_one();
return true;
}
bool EsimFile::ProcessSetNicknameDone(const AppExecFwk::InnerEvent::Pointer &event)
{
std::shared_ptr<Asn1Node> root = ParseEvent(event);
if (root == nullptr) {
TELEPHONY_LOGE("Asn1ParseResponse failed");
return false;
}
std::shared_ptr<Asn1Node> asn1NodeData = root->Asn1GetChild(TAG_ESIM_CTX_0);
if (asn1NodeData == nullptr) {
TELEPHONY_LOGE("asn1NodeData is nullptr");
return false;
}
updateNicknameResult_ = static_cast<ResultState>(asn1NodeData->Asn1AsInteger());
{
std::lock_guard<std::mutex> lock(setNicknameMutex_);
isSetNicknameReady_ = true;
}
setNicknameCv_.notify_one();
return true;
}
void EsimFile::InitMemberFunc()
{
memberFuncMap_[MSG_ESIM_OPEN_CHANNEL_DONE] =
@ -2486,6 +2702,12 @@ void EsimFile::InitMemberFunc()
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessRetrieveNotificationDone(event); };
memberFuncMap_[MSG_ESIM_RETRIEVE_NOTIFICATION_LIST] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessRetrieveNotificationListDone(event); };
memberFuncMap_[MSG_ESIM_DELETE_PROFILE] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessDeleteProfileDone(event); };
memberFuncMap_[MSG_ESIM_SWITCH_PROFILE] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSwitchToProfileDone(event); };
memberFuncMap_[MSG_ESIM_SET_NICK_NAME] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetNicknameDone(event); };
}
void EsimFile::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)

View File

@ -1191,6 +1191,36 @@ ResultState SimFileManager::RemoveNotificationFromList(int32_t portIndex, int32_
}
return eSimFile_->RemoveNotificationFromList(portIndex, seqNumber);
}
ResultState SimFileManager::DeleteProfile(const std::u16string &iccId)
{
if (eSimFile_ == nullptr) {
TELEPHONY_LOGE("esimFile is nullptr");
return ResultState::RESULT_UNDEFINED_ERROR;
}
ResultState result = eSimFile_->DeleteProfile(iccId);
return result;
}
ResultState SimFileManager::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim)
{
if (eSimFile_ == nullptr) {
TELEPHONY_LOGE("esimFile is nullptr");
return ResultState::RESULT_UNDEFINED_ERROR;
}
ResultState result = eSimFile_->SwitchToProfile(portIndex, iccId, forceDeactivateSim);
return result;
}
ResultState SimFileManager::SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname)
{
if (eSimFile_ == nullptr) {
TELEPHONY_LOGE("esimFile is nullptr");
return ResultState::RESULT_UNDEFINED_ERROR;
}
ResultState result = eSimFile_->SetProfileNickname(iccId, nickname);
return result;
}
#endif
} // namespace Telephony
} // namespace OHOS

View File

@ -1477,6 +1477,38 @@ int32_t SimManager::RemoveNotificationFromList(
enumResult = simFileManager_[slotId]->RemoveNotificationFromList(portIndex, seqNumber);
return TELEPHONY_ERR_SUCCESS;
}
int32_t SimManager::DeleteProfile(int32_t slotId, const std::u16string &iccId, ResultState &enumResult)
{
if ((!IsValidSlotId(slotId, simFileManager_)) || (simFileManager_[slotId] == nullptr)) {
TELEPHONY_LOGE("simFileManager is null!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
enumResult = simFileManager_[slotId]->DeleteProfile(iccId);
return TELEPHONY_ERR_SUCCESS;
}
int32_t SimManager::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
{
if ((!IsValidSlotId(slotId, simFileManager_)) || (simFileManager_[slotId] == nullptr)) {
TELEPHONY_LOGE("simFileManager is null!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
enumResult = simFileManager_[slotId]->SwitchToProfile(portIndex, iccId, forceDeactivateSim);
return TELEPHONY_ERR_SUCCESS;
}
int32_t SimManager::SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult)
{
if ((!IsValidSlotId(slotId, simFileManager_)) || (simFileManager_[slotId] == nullptr)) {
TELEPHONY_LOGE("simFileManager is null!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
enumResult = simFileManager_[slotId]->SetProfileNickname(iccId, nickname);
return TELEPHONY_ERR_SUCCESS;
}
#endif
} // namespace Telephony
} // namespace OHOS

0
test/BUILD.gn Executable file → Normal file
View File

View File

@ -273,5 +273,39 @@ HWTEST_F(EsimCoreServiceClientBranchTest, RemoveNotificationFromList_0100, Funct
seqNumber, enumResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceClientBranchTest, DeleteProfile_0001, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState DeleteProfileResult;
EXPECT_CALL(*samgr, CheckSystemAbility(testing::_)).WillOnce(testing::Return(nullptr));
int32_t result = CoreServiceClient::GetInstance().DeleteProfile(slotId, iccId, DeleteProfileResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceClientBranchTest, SwitchToProfile_0100, Function | MediumTest | Level1)
{
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
EXPECT_CALL(*samgr, CheckSystemAbility(testing::_)).WillOnce(testing::Return(nullptr));
int32_t result = CoreServiceClient::GetInstance().SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceClientBranchTest, SetProfileNickname_0100, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState UpdateResult;
EXPECT_CALL(*samgr, CheckSystemAbility(testing::_)).WillOnce(testing::Return(nullptr));
int32_t result = CoreServiceClient::GetInstance().SetProfileNickname(slotId, iccId, nickname, UpdateResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
} // namespace Telephony
} // namespace OHOS

View File

@ -240,5 +240,36 @@ HWTEST_F(EsimCoreServiceClientTest, RemoveNotificationFromList_0001, Function |
slotId, portIndex, seqNumber, enumResult);
EXPECT_NE(result, TELEPHONY_SUCCESS);
}
HWTEST_F(EsimCoreServiceClientTest, DeleteProfile_0001, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState DeleteProfileResult;
int32_t result = CoreServiceClient::GetInstance().DeleteProfile(slotId, iccId, DeleteProfileResult);
EXPECT_NE(result, TELEPHONY_SUCCESS);
}
HWTEST_F(EsimCoreServiceClientTest, SwitchToProfile_0001, Function | MediumTest | Level1)
{
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
int32_t result = CoreServiceClient::GetInstance().SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_NE(result, TELEPHONY_SUCCESS);
}
HWTEST_F(EsimCoreServiceClientTest, SetProfileNickname_0001, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState UpdateResult;
int32_t result = CoreServiceClient::GetInstance().SetProfileNickname(slotId, iccId, nickname, UpdateResult);
EXPECT_NE(result, TELEPHONY_SUCCESS);
}
} // namespace Telephony
} // namespace OHOS

View File

@ -773,5 +773,119 @@ HWTEST_F(EsimCoreServiceProxyTest, RemoveNotificationFromList_003, Function | Me
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(0));
EXPECT_EQ(proxy.RemoveNotificationFromList(SLOT_ID, portIndex, seqNumber, enumResult), 0);
}
HWTEST_F(EsimCoreServiceProxyTest, DeleteProfile_001, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = nullptr;
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState deleteProfileResult;
int32_t ret = proxy.DeleteProfile(SLOT_ID, iccId, deleteProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, DeleteProfile_002, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState deleteProfileResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(-500));
int32_t ret = proxy.DeleteProfile(SLOT_ID, iccId, deleteProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, DeleteProfile_003, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState deleteProfileResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(0));
int32_t ret = proxy.DeleteProfile(SLOT_ID, iccId, deleteProfileResult);
EXPECT_EQ(ret, 0);
}
HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_001, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = nullptr;
CoreServiceProxy proxy(remote);
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_002, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(-500));
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_003, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(0));
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(ret, 0);
}
HWTEST_F(EsimCoreServiceProxyTest, SetProfileNickname_001, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = nullptr;
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState setProfileNicknameResult;
int32_t ret = proxy.SetProfileNickname(SLOT_ID, iccId, nickname, setProfileNicknameResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, SetProfileNickname_002, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState setProfileNicknameResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(-500));
int32_t ret = proxy.SetProfileNickname(SLOT_ID, iccId, nickname, setProfileNicknameResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimCoreServiceProxyTest, SetProfileNickname_003, Function | MediumTest | Level2)
{
sptr<MockIRemoteObject> remote = new (std::nothrow) MockIRemoteObject();
CoreServiceProxy proxy(remote);
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState setProfileNicknameResult;
EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(0));
int32_t ret = proxy.SetProfileNickname(SLOT_ID, iccId, nickname, setProfileNicknameResult);
EXPECT_EQ(ret, 0);
}
} // namespace Telephony
} // namespace OHOS

View File

@ -243,5 +243,35 @@ HWTEST_F(EsimCoreServiceStubTest, OnRemoveNotificationFromList_001, Function | M
int32_t ret = SendRemoteRequest(data, CoreServiceInterfaceCode::REMOVE_NOTIFICATION);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimCoreServiceStubTest, OnDeleteProfile_001, Function | MediumTest | Level2)
{
MessageParcel data;
if (!data.WriteInterfaceToken(CoreServiceStub::GetDescriptor())) {
return;
}
int32_t ret = SendRemoteRequest(data, CoreServiceInterfaceCode::DELETE_PROFILE);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimCoreServiceStubTest, OnSwitchToProfile_001, Function | MediumTest | Level2)
{
MessageParcel data;
if (!data.WriteInterfaceToken(CoreServiceStub::GetDescriptor())) {
return;
}
int32_t ret = SendRemoteRequest(data, CoreServiceInterfaceCode::SWITCH_TO_PROFILE);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimCoreServiceStubTest, OnSetProfileNickname_001, Function | MediumTest | Level2)
{
MessageParcel data;
if (!data.WriteInterfaceToken(CoreServiceStub::GetDescriptor())) {
return;
}
int32_t ret = SendRemoteRequest(data, CoreServiceInterfaceCode::UPDATE_PROFILE_NICKNAME);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
} // namespace Telephony
} // namespace OHOS
} // namespace OHOS

View File

@ -343,5 +343,53 @@ HWTEST_F(EsimCoreServiceTest, RemoveNotificationFromList_0001, Function | Medium
EXPECT_EQ(mCoreService->RemoveNotificationFromList(
slotId, portIndex, seqNumber, removeNotifFromListResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
}
HWTEST_F(EsimCoreServiceTest, DeleteProfile_0001, Function | MediumTest | Level1)
{
std::shared_ptr<CoreService> mCoreService = std::make_shared<CoreService>();
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
mCoreService->simManager_ = std::make_shared<SimManager>(telRilManager);
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState deleteProfileResult;
EXPECT_NE(mCoreService->DeleteProfile(slotId, iccId, deleteProfileResult), TELEPHONY_ERR_SUCCESS);
mCoreService->simManager_ = nullptr;
EXPECT_EQ(mCoreService->DeleteProfile(slotId, iccId, deleteProfileResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
}
HWTEST_F(EsimCoreServiceTest, SwitchToProfile_0001, Function | MediumTest | Level1)
{
std::shared_ptr<CoreService> mCoreService = std::make_shared<CoreService>();
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
mCoreService->simManager_ = std::make_shared<SimManager>(telRilManager);
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState switchProfileResult;
EXPECT_NE(mCoreService->SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, switchProfileResult), TELEPHONY_ERR_SUCCESS);
mCoreService->simManager_ = nullptr;
EXPECT_EQ(mCoreService->SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, switchProfileResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
}
HWTEST_F(EsimCoreServiceTest, SetProfileNickname_0001, Function | MediumTest | Level1)
{
std::shared_ptr<CoreService> mCoreService = std::make_shared<CoreService>();
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
mCoreService->simManager_ = std::make_shared<SimManager>(telRilManager);
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState UpdateResult;
EXPECT_NE(mCoreService->SetProfileNickname(
slotId, iccId, nickname, UpdateResult), TELEPHONY_ERR_SUCCESS);
mCoreService->simManager_ = nullptr;
EXPECT_EQ(mCoreService->SetProfileNickname(
slotId, iccId, nickname, UpdateResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
}
} // namespace Telephony
} // namespace OHOS

View File

@ -428,5 +428,65 @@ HWTEST_F(EsimFileManagerTest, RemoveNotificationFromList_001, Function | MediumT
res = simFileManager.RemoveNotificationFromList(portIndex, seqNumber);
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}
HWTEST_F(EsimFileManagerTest, DeleteProfile_001, Function | MediumTest | Level2)
{
std::string expectedEid = "12345";
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
SimFileManager simFileManager { subcribeInfo, std::weak_ptr<ITelRilManager>(telRilManager),
std::weak_ptr<SimStateManager>(simStateManager) };
simFileManager.eSimFile_ = std::make_shared<EsimFile>(simStateManager);
std::u16string iccId = u"";
ResultState res = simFileManager.DeleteProfile(iccId);
EXPECT_NE(res, ResultState::RESULT_UNDEFINED_ERROR);
simFileManager.eSimFile_ = nullptr;
res = simFileManager.DeleteProfile(iccId);
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}
HWTEST_F(EsimFileManagerTest, SwitchToProfile_001, Function | MediumTest | Level2)
{
std::string expectedEid = "12345";
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
SimFileManager simFileManager { subcribeInfo, std::weak_ptr<ITelRilManager>(telRilManager),
std::weak_ptr<SimStateManager>(simStateManager) };
simFileManager.eSimFile_ = std::make_shared<EsimFile>(simStateManager);
int32_t portIndex = 0;
std::u16string iccId = u"";
bool forceDeactivateSim = false;
ResultState res = simFileManager.SwitchToProfile(portIndex, iccId, forceDeactivateSim);
EXPECT_NE(res, ResultState::RESULT_UNDEFINED_ERROR);
simFileManager.eSimFile_ = nullptr;
res = simFileManager.SwitchToProfile(portIndex, iccId, forceDeactivateSim);
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}
HWTEST_F(EsimFileManagerTest, SetProfileNickname_001, Function | MediumTest | Level2)
{
std::string expectedEid = "12345";
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
EventFwk::MatchingSkills matchingSkills;
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
EventFwk::CommonEventSubscribeInfo subcribeInfo(matchingSkills);
SimFileManager simFileManager { subcribeInfo, std::weak_ptr<ITelRilManager>(telRilManager),
std::weak_ptr<SimStateManager>(simStateManager) };
simFileManager.eSimFile_ = std::make_shared<EsimFile>(simStateManager);
std::u16string iccId = u"";
std::u16string nickname = u"";
ResultState res = simFileManager.SetProfileNickname(iccId, nickname);
EXPECT_NE(res, ResultState::RESULT_UNDEFINED_ERROR);
simFileManager.eSimFile_ = nullptr;
res = simFileManager.SetProfileNickname(iccId, nickname);
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}
} // namespace Telephony
} // namespace OHOS
} // namespace OHOS

View File

@ -578,5 +578,92 @@ HWTEST_F(EsimManagerTest, RemoveNotificationFromList, Function | MediumTest | Le
ret = simManager->RemoveNotificationFromList(slotId, portIndex, seqNumber, enumResult);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimManagerTest, DeleteProfile, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
ResultState DeleteProfileResult;
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimManager> simManager = std::make_shared<SimManager>(telRilManager);
int32_t ret = simManager->DeleteProfile(slotId, iccId, DeleteProfileResult);
EXPECT_NE(ret, TELEPHONY_ERR_SUCCESS);
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
simManager->simStateManager_.push_back(simStateManager);
simManager->simStateManager_[slotId]->Init(slotId);
simManager->simStateManager_[slotId]->simStateHandle_->iccState_.simStatus_ = -1;
ret = simManager->DeleteProfile(slotId, iccId, DeleteProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->DeleteProfile(slotId, iccId, DeleteProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimManagerTest, SwitchToProfile, Function | MediumTest | Level1)
{
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
ResultState SwitchProfileResult;
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimManager> simManager = std::make_shared<SimManager>(telRilManager);
int32_t ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_NE(ret, TELEPHONY_ERR_SUCCESS);
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
simManager->simStateManager_.push_back(simStateManager);
simManager->simStateManager_[slotId]->Init(slotId);
simManager->simStateManager_[slotId]->simStateHandle_->iccState_.simStatus_ = -1;
ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
HWTEST_F(EsimManagerTest, SetProfileNickname, Function | MediumTest | Level1)
{
int32_t slotId = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState UpdateResult;
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimManager> simManager = std::make_shared<SimManager>(telRilManager);
int32_t ret = simManager->SetProfileNickname(slotId, iccId, nickname, UpdateResult);
EXPECT_NE(ret, TELEPHONY_ERR_SUCCESS);
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
simManager->simStateManager_.push_back(simStateManager);
simManager->simStateManager_[slotId]->Init(slotId);
simManager->simStateManager_[slotId]->simStateHandle_->iccState_.simStatus_ = -1;
ret = simManager->SetProfileNickname(slotId, iccId, nickname, UpdateResult);
EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->SetProfileNickname(slotId, iccId, nickname, UpdateResult);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}
} // namespace Telephony
} // namespace OHOS
} // namespace OHOS

View File

@ -1609,5 +1609,195 @@ HWTEST_F(EsimTest, RetrieveNotificationParseCompTag_001, Function | MediumTest |
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
EXPECT_TRUE(esimFile->RetrieveNotificationParseCompTag(root));
}
HWTEST_F(EsimTest, DeleteProfile_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
std::u16string iccId;
ResultState disableProfileResult_ = ResultState::RESULT_UNDEFINED_ERROR;
esimFile->currentChannelId_ = 0;
EXPECT_NE(disableProfileResult_, esimFile->DeleteProfile(iccId));
int32_t slotId = 0;
esimFile->currentChannelId_ = 2;
std::shared_ptr<IccFileController> file = std::make_shared<SimFileController>(slotId);
std::shared_ptr<IccDiallingNumbersHandler> handler = std::make_shared<IccDiallingNumbersHandler>(file);
esimFile->SetRilAndFileController(telRilManager, file, handler);
EXPECT_NE(disableProfileResult_, esimFile->DeleteProfile(iccId));
}
HWTEST_F(EsimTest, SwitchToProfile_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
int32_t portIndex = 0;
std::u16string iccId;
bool forceDeactivateSim = false;
ResultState switchResult_ = ResultState::RESULT_UNDEFINED_ERROR;
esimFile->currentChannelId_ = 0;
EXPECT_NE(switchResult_, esimFile->SwitchToProfile(portIndex, iccId, forceDeactivateSim));
int32_t slotId = 0;
esimFile->currentChannelId_ = 2;
std::shared_ptr<IccFileController> file = std::make_shared<SimFileController>(slotId);
std::shared_ptr<IccDiallingNumbersHandler> handler = std::make_shared<IccDiallingNumbersHandler>(file);
esimFile->SetRilAndFileController(telRilManager, file, handler);
EXPECT_NE(switchResult_, esimFile->SwitchToProfile(portIndex, iccId, forceDeactivateSim));
}
HWTEST_F(EsimTest, SetProfileNickname_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
std::u16string iccId = Str8ToStr16("98760000000000543210");
std::u16string nickname = Str8ToStr16("nick");
ResultState updateNicknameResult_ = ResultState::RESULT_UNDEFINED_ERROR;
esimFile->currentChannelId_ = 0;
EXPECT_NE(updateNicknameResult_, esimFile->SetProfileNickname(iccId, nickname));
int32_t slotId = 0;
esimFile->currentChannelId_ = 2;
std::shared_ptr<IccFileController> file = std::make_shared<SimFileController>(slotId);
std::shared_ptr<IccDiallingNumbersHandler> handler = std::make_shared<IccDiallingNumbersHandler>(file);
esimFile->SetRilAndFileController(telRilManager, file, handler);
EXPECT_NE(updateNicknameResult_, esimFile->SetProfileNickname(iccId, nickname));
}
HWTEST_F(EsimTest, ProcessDeleteProfile_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
int slotId = 0;
std::shared_ptr<Telephony::IccFile> iccFile = std::make_shared<EsimFile>(simStateManager);
AppExecFwk::InnerEvent::Pointer eventDeleteProfile = iccFile->BuildCallerInfo(MSG_ESIM_DELETE_PROFILE);
esimFile->currentChannelId_ = 0;
EXPECT_FALSE(esimFile->ProcessDeleteProfile(slotId, eventDeleteProfile));
esimFile->currentChannelId_ = 2;
std::string iccIdStr = "ABCDEFG";
esimFile->esimProfile_.iccId = Str8ToStr16(iccIdStr);
EXPECT_FALSE(esimFile->ProcessDeleteProfile(slotId, eventDeleteProfile));
std::string str = "ABCDEFGG";
esimFile->esimProfile_.iccId = Str8ToStr16(str);
EXPECT_FALSE(esimFile->ProcessDeleteProfile(slotId, eventDeleteProfile));
}
HWTEST_F(EsimTest, ProcessDeleteProfileDone_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
std::shared_ptr<IccControllerHolder> holder = nullptr;
std::unique_ptr<Telephony::IccFromRilMsg> rcvMsg = std::make_unique<Telephony::IccFromRilMsg>(holder);
rcvMsg->fileData.resultData = "BF33038001009000";
auto event = AppExecFwk::InnerEvent::Get(0, rcvMsg);
EXPECT_TRUE(esimFile->ProcessDeleteProfileDone(event));
auto event1 = AppExecFwk::InnerEvent::Get(0);
EXPECT_FALSE(esimFile->ProcessDeleteProfileDone(event1));
event1 = nullptr;
EXPECT_FALSE(esimFile->ProcessDeleteProfileDone(event1));
}
HWTEST_F(EsimTest, ProcessSwitchToProfile_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
int slotId = 0;
std::shared_ptr<Telephony::IccFile> iccFile = std::make_shared<EsimFile>(simStateManager);
AppExecFwk::InnerEvent::Pointer eventSwitchToProfile = iccFile->BuildCallerInfo(MSG_ESIM_SWITCH_PROFILE);
esimFile->currentChannelId_ = 0;
EXPECT_FALSE(esimFile->ProcessSwitchToProfile(slotId, eventSwitchToProfile));
esimFile->currentChannelId_ = 2;
std::string iccIdStr = "ABCDEFG";
esimFile->esimProfile_.iccId = Str8ToStr16(iccIdStr);
EXPECT_FALSE(esimFile->ProcessSwitchToProfile(slotId, eventSwitchToProfile));
std::shared_ptr<IccFileController> file = std::make_shared<SimFileController>(slotId);
std::shared_ptr<IccDiallingNumbersHandler> handler = std::make_shared<IccDiallingNumbersHandler>(file);
esimFile->SetRilAndFileController(telRilManager, file, handler);
EXPECT_TRUE(esimFile->ProcessSwitchToProfile(slotId, eventSwitchToProfile));
std::string str = "ABCDEFGG";
esimFile->esimProfile_.iccId = Str8ToStr16(str);
EXPECT_TRUE(esimFile->ProcessSwitchToProfile(slotId, eventSwitchToProfile));
}
HWTEST_F(EsimTest, ProcessSwitchToProfileDone_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
std::shared_ptr<IccControllerHolder> holder = nullptr;
std::unique_ptr<Telephony::IccFromRilMsg> rcvMsg = std::make_unique<Telephony::IccFromRilMsg>(holder);
rcvMsg->fileData.resultData = "BF3103800100";
auto event = AppExecFwk::InnerEvent::Get(0, rcvMsg);
EXPECT_TRUE(esimFile->ProcessSwitchToProfileDone(event));
auto event1 = AppExecFwk::InnerEvent::Get(0);
EXPECT_FALSE(esimFile->ProcessSwitchToProfileDone(event1));
event1 = nullptr;
EXPECT_FALSE(esimFile->ProcessSwitchToProfileDone(event1));
}
HWTEST_F(EsimTest, ProcessSetNickname_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
int slotId = 0;
std::shared_ptr<Telephony::IccFile> iccFile = std::make_shared<EsimFile>(simStateManager);
AppExecFwk::InnerEvent::Pointer eventSetNickName = iccFile->BuildCallerInfo(MSG_ESIM_SET_NICK_NAME);
esimFile->currentChannelId_ = 0;
EXPECT_FALSE(esimFile->ProcessSetNickname(slotId, eventSetNickName));
esimFile->currentChannelId_ = 2;
std::string iccIdStr = "ABCDEFG";
esimFile->esimProfile_.iccId = Str8ToStr16(iccIdStr);
EXPECT_FALSE(esimFile->ProcessSetNickname(slotId, eventSetNickName));
std::shared_ptr<IccFileController> file = std::make_shared<SimFileController>(slotId);
std::shared_ptr<IccDiallingNumbersHandler> handler = std::make_shared<IccDiallingNumbersHandler>(file);
esimFile->SetRilAndFileController(telRilManager, file, handler);
EXPECT_TRUE(esimFile->ProcessSetNickname(slotId, eventSetNickName));
std::string str = "ABCDEFGG";
esimFile->esimProfile_.iccId = Str8ToStr16(str);
EXPECT_TRUE(esimFile->ProcessSetNickname(slotId, eventSetNickName));
}
HWTEST_F(EsimTest, ProcessSetNicknameDone_001, Function | MediumTest | Level2)
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
std::shared_ptr<IccControllerHolder> holder = nullptr;
std::unique_ptr<Telephony::IccFromRilMsg> rcvMsg = std::make_unique<Telephony::IccFromRilMsg>(holder);
rcvMsg->fileData.resultData = "BF31038001009000";
auto event = AppExecFwk::InnerEvent::Get(0, rcvMsg);
EXPECT_TRUE(esimFile->ProcessSetNicknameDone(event));
auto event1 = AppExecFwk::InnerEvent::Get(0);
EXPECT_FALSE(esimFile->ProcessSetNicknameDone(event1));
event1 = nullptr;
EXPECT_FALSE(esimFile->ProcessSetNicknameDone(event1));
}
} // namespace Telephony
} // namespace OHOS