fix codex

Signed-off-by: wangxingboo <wangxingbo11@h-partners.com>
This commit is contained in:
wangxingboo 2024-10-14 11:06:14 +08:00
parent 1fca5b50e3
commit 5b2c773d69
38 changed files with 468 additions and 480 deletions

View File

@ -66,7 +66,7 @@ struct AsyncSwitchProfileInfo {
AsyncContext<int32_t> asyncContext;
int32_t portIndex = ERROR_DEFAULT;
std::string iccid = "";
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
};
struct AsyncAccessRule {
@ -76,7 +76,7 @@ struct AsyncAccessRule {
};
struct AsyncDownloadableProfile {
std::string encodedActivationCode = "";
std::string activationCode = "";
std::string confirmationCode = "";
std::string carrierName = "";
std::vector<AsyncAccessRule> accessRules{};
@ -87,14 +87,14 @@ struct AsyncDownloadProfileInfo {
int32_t portIndex = ERROR_DEFAULT;
AsyncDownloadableProfile profile;
bool switchAfterDownload = false;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
DownloadProfileResult result;
};
struct AsyncDefaultProfileList {
AsyncContext<napi_value> asyncContext;
int32_t portIndex = ERROR_DEFAULT;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
GetDownloadableProfilesResult result;
};
@ -115,7 +115,7 @@ struct AsyncProfileMetadataInfo {
AsyncContext<napi_value> asyncContext;
int32_t portIndex = ERROR_DEFAULT;
AsyncDownloadableProfile profile;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
GetDownloadableProfileMetadataResult result;
};

View File

@ -187,7 +187,7 @@ napi_value DownloadProfileResultConversion(napi_env env, const DownloadProfileRe
napi_value val = nullptr;
napi_create_object(env, &val);
SetPropertyToNapiObject(env, val, "requestResponseResult", static_cast<int32_t>(resultInfo.result_));
SetPropertyToNapiObject(env, val, "resolvableErrors", static_cast<int32_t>(resultInfo.resolvableErrors_));
SetPropertyToNapiObject(env, val, "solvableErrors", static_cast<int32_t>(resultInfo.resolvableErrors_));
SetPropertyToNapiObject(env, val, "cardId", resultInfo.cardId_);
return val;
@ -208,7 +208,7 @@ napi_value ProfileInfoConversion(napi_env env, const DownloadableProfile &profil
{
napi_value val = nullptr;
napi_create_object(env, &val);
SetPropertyToNapiObject(env, val, "encodedActivationCode", NapiUtil::ToUtf8(profileInfo.encodedActivationCode_));
SetPropertyToNapiObject(env, val, "activationCode", NapiUtil::ToUtf8(profileInfo.encodedActivationCode_));
SetPropertyToNapiObject(env, val, "confirmationCode", NapiUtil::ToUtf8(profileInfo.confirmationCode_));
SetPropertyToNapiObject(env, val, "carrierName", NapiUtil::ToUtf8(profileInfo.carrierName_));
napi_value resultArray = nullptr;
@ -244,7 +244,7 @@ napi_value MetadataResultConversion(napi_env env, const GetDownloadableProfileMe
napi_create_object(env, &val);
SetPropertyToNapiObject(env, val, "pprType", metadataInfo.pprType_);
SetPropertyToNapiObject(env, val, "pprFlag", metadataInfo.pprFlag_);
SetPropertyToNapiObject(env, val, "resolvableErrors", static_cast<int32_t>(metadataInfo.resolvableErrors_));
SetPropertyToNapiObject(env, val, "solvableErrors", static_cast<int32_t>(metadataInfo.resolvableErrors_));
SetPropertyToNapiObject(env, val, "requestResponseResult", static_cast<int32_t>(metadataInfo.result_));
napi_value res = ProfileInfoConversion(env, metadataInfo.downloadableProfiles_);
napi_set_named_property(env, val, "downloadableProfile", res);
@ -328,7 +328,7 @@ AccessRule GetAccessRuleInfo(AsyncAccessRule &accessType)
DownloadableProfile GetProfileInfo(AsyncDownloadableProfile &profileInfo)
{
DownloadableProfile profile;
profile.encodedActivationCode_ = NapiUtil::ToUtf16(profileInfo.encodedActivationCode.data());
profile.encodedActivationCode_ = NapiUtil::ToUtf16(profileInfo.activationCode.data());
profile.confirmationCode_ = NapiUtil::ToUtf16(profileInfo.confirmationCode.data());
profile.carrierName_ = NapiUtil::ToUtf16(profileInfo.carrierName.data());
@ -364,11 +364,11 @@ void AccessRuleInfoAnalyze(napi_env env, napi_value arg, AsyncAccessRule &access
void ProfileInfoAnalyze(napi_env env, napi_value arg, AsyncDownloadableProfile &profileInfo)
{
napi_value activateState = NapiUtil::GetNamedProperty(env, arg, "encodedActivationCode");
napi_value activateState = NapiUtil::GetNamedProperty(env, arg, "activationCode");
if (activateState) {
char activationStr[ARRAY_SIZE] = {0};
NapiValueToCppValue(env, activateState, napi_string, activationStr);
profileInfo.encodedActivationCode = std::string(activationStr);
profileInfo.activationCode = std::string(activationStr);
}
napi_value confirmState = NapiUtil::GetNamedProperty(env, arg, "confirmationCode");
@ -640,7 +640,7 @@ void NativeSwitchToProfile(napi_env env, void *data)
int32_t result = UNDEFINED_VALUE;
int32_t errorCode = DelayedRefSingleton<EsimServiceClient>::GetInstance().SwitchToProfile(
asyncContext.slotId, profileContext->portIndex, profileContext->iccid,
profileContext->forceDeactivateSim, result);
profileContext->forceDisableProfile, result);
TELEPHONY_LOGI("NAPI NativeSwitchToProfile %{public}d", errorCode);
if (errorCode == ERROR_NONE) {
asyncContext.callbackVal = result;
@ -673,7 +673,7 @@ napi_value SwitchToProfile(napi_env env, napi_callback_info info)
char iccIdStr[ARRAY_SIZE] = {0};
auto initPara = std::make_tuple(&profileContext->asyncContext.slotId, &profileContext->portIndex,
iccIdStr, &profileContext->forceDeactivateSim, &context.callbackRef);
iccIdStr, &profileContext->forceDisableProfile, &context.callbackRef);
AsyncPara para {
.funcName = "SwitchToProfile",
@ -842,7 +842,7 @@ void NativeDownloadProfile(napi_env env, void *data)
DownloadProfileConfigInfo configInfo;
configInfo.portIndex_ = profileContext->portIndex;
configInfo.isSwitchAfterDownload_ = profileContext->switchAfterDownload;
configInfo.isForceDeactivateSim_ = profileContext->forceDeactivateSim;
configInfo.isForceDeactivateSim_ = profileContext->forceDisableProfile;
DownloadableProfile profile = GetProfileInfo(profileContext->profile);
int32_t errorCode = DelayedRefSingleton<EsimServiceClient>::GetInstance().DownloadProfile(
profileContext->asyncContext.slotId, configInfo, profile, result);
@ -881,7 +881,7 @@ napi_value DownloadProfile(napi_env env, napi_callback_info info)
BaseContext &context = profileContext->asyncContext.context;
napi_value object = NapiUtil::CreateUndefined(env);
auto initPara = std::make_tuple(&profileContext->asyncContext.slotId, &profileContext->portIndex,
&object, &profileContext->switchAfterDownload, &profileContext->forceDeactivateSim,
&object, &profileContext->switchAfterDownload, &profileContext->forceDisableProfile,
&context.callbackRef);
AsyncPara para {
@ -913,7 +913,7 @@ void NativeGetDownloadableProfiles(napi_env env, void *data)
GetDownloadableProfilesResult result;
int32_t errorCode = DelayedRefSingleton<EsimServiceClient>::GetInstance().GetDownloadableProfiles(
profileContext->asyncContext.slotId, profileContext->portIndex, profileContext->forceDeactivateSim, result);
profileContext->asyncContext.slotId, profileContext->portIndex, profileContext->forceDisableProfile, result);
TELEPHONY_LOGI("NAPI NativeGetDownloadableProfiles %{public}d", errorCode);
if (errorCode == ERROR_NONE) {
profileContext->result = result;
@ -949,7 +949,7 @@ napi_value GetDownloadableProfiles(napi_env env, napi_callback_info info)
BaseContext &context = profileContext->asyncContext.context;
auto initPara = std::make_tuple(&profileContext->asyncContext.slotId, &profileContext->portIndex,
&profileContext->forceDeactivateSim, &context.callbackRef);
&profileContext->forceDisableProfile, &context.callbackRef);
AsyncPara para {
.funcName = "GetDownloadableProfiles",
@ -1197,7 +1197,7 @@ void NativeGetDownloadableProfileMetadata(napi_env env, void *data)
GetDownloadableProfileMetadataResult result;
DownloadableProfile profile = GetProfileInfo(metadata->profile);
int32_t errorCode = DelayedRefSingleton<EsimServiceClient>::GetInstance().GetDownloadableProfileMetadata(
metadata->asyncContext.slotId, metadata->portIndex, profile, metadata->forceDeactivateSim, result);
metadata->asyncContext.slotId, metadata->portIndex, profile, metadata->forceDisableProfile, result);
TELEPHONY_LOGI("NAPI NativeGetDownloadableProfileMetadata %{public}d", errorCode);
if (errorCode == ERROR_NONE) {
metadata->result = result;
@ -1233,7 +1233,7 @@ napi_value GetDownloadableProfileMetadata(napi_env env, napi_callback_info info)
BaseContext &context = metadata->asyncContext.context;
napi_value object = NapiUtil::CreateUndefined(env);
auto initPara = std::make_tuple(&metadata->asyncContext.slotId, &metadata->portIndex,
&object, &metadata->forceDeactivateSim, &context.callbackRef);
&object, &metadata->forceDisableProfile, &context.callbackRef);
AsyncPara para {
.funcName = "GetDownloadableProfileMetadata",
@ -1396,8 +1396,8 @@ napi_status InitEnumResetOption(napi_env env, napi_value exports)
napi_status InitEnumCancelReason(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("CANCEL_REASON_END_USER_REJECTED",
GetNapiValue(env, static_cast<int32_t>(CancelReason::CANCEL_REASON_END_USER_REJECTED))),
DECLARE_NAPI_STATIC_PROPERTY("CANCEL_REASON_END_USER_REJECTION",
GetNapiValue(env, static_cast<int32_t>(CancelReason::CANCEL_REASON_END_USER_REJECTION))),
DECLARE_NAPI_STATIC_PROPERTY("CANCEL_REASON_POSTPONED",
GetNapiValue(env, static_cast<int32_t>(CancelReason::CANCEL_REASON_POSTPONED))),
DECLARE_NAPI_STATIC_PROPERTY("CANCEL_REASON_TIMEOUT",
@ -1414,16 +1414,16 @@ napi_status InitEnumCancelReason(napi_env env, napi_value exports)
napi_status InitEnumOsuStatus(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("EUICC_OSU_IN_PROGRESS",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_OSU_IN_PROGRESS))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_OSU_FAILED",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_OSU_FAILED))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_OSU_SUCCEEDED",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_OSU_SUCCEEDED))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_OSU_NOT_NEEDED",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_OSU_NOT_NEEDED))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_OSU_UNAVAILABLE",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_OSU_UNAVAILABLE))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_UPGRAD_IN_PROGRESS",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_UPGRAD_IN_PROGRESS))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_UPGRAD_FAILED",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_UPGRAD_FAILED))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_UPGRAD_SUCCESSFUL",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_UPGRAD_SUCCESSFUL))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_UPGRAD_ALREADY_LATEST",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_UPGRAD_ALREADY_LATEST))),
DECLARE_NAPI_STATIC_PROPERTY("EUICC_UPGRAD_SERVICE_UNAVAILABLE",
GetNapiValue(env, static_cast<int32_t>(OsuStatus::EUICC_UPGRAD_SERVICE_UNAVAILABLE))),
};
constexpr size_t arrSize = sizeof(desc) / sizeof(desc[0]);
@ -1452,8 +1452,8 @@ napi_status InitEnumProfileClass(napi_env env, napi_value exports)
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("PROFILE_CLASS_UNSPECIFIED",
GetNapiValue(env, static_cast<int32_t>(ProfileClass::PROFILE_CLASS_UNSPECIFIED))),
DECLARE_NAPI_STATIC_PROPERTY("PROFILE_CLASS_TESTING",
GetNapiValue(env, static_cast<int32_t>(ProfileClass::PROFILE_CLASS_TESTING))),
DECLARE_NAPI_STATIC_PROPERTY("PROFILE_CLASS_TEST",
GetNapiValue(env, static_cast<int32_t>(ProfileClass::PROFILE_CLASS_TEST))),
DECLARE_NAPI_STATIC_PROPERTY("PROFILE_CLASS_PROVISIONING",
GetNapiValue(env, static_cast<int32_t>(ProfileClass::PROFILE_CLASS_PROVISIONING))),
DECLARE_NAPI_STATIC_PROPERTY("PROFILE_CLASS_OPERATIONAL",
@ -1468,12 +1468,12 @@ napi_status InitEnumProfileClass(napi_env env, napi_value exports)
napi_status InitEnumPolicyRules(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DO_NOT_DISABLE",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DO_NOT_DISABLE))),
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DO_NOT_DELETE",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DO_NOT_DELETE))),
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DELETE_AFTER_DISABLING",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DELETE_AFTER_DISABLING))),
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DISABLE_NOT_ALLOWED",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DISABLE_NOT_ALLOWED))),
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DELETE_NOT_ALLOWED",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DELETE_NOT_ALLOWED))),
DECLARE_NAPI_STATIC_PROPERTY("POLICY_RULE_DISABLE_AND_DELETE",
GetNapiValue(env, static_cast<int32_t>(PolicyRules::POLICY_RULE_DISABLE_AND_DELETE))),
};
constexpr size_t arrSize = sizeof(desc) / sizeof(desc[0]);
@ -1484,14 +1484,12 @@ napi_status InitEnumPolicyRules(napi_env env, napi_value exports)
napi_status InitEnumResult(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("RESULT_RESOLVABLE_ERRORS",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_RESOLVABLE_ERRORS))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_MUST_DEACTIVATE_SIM",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_MUST_DEACTIVATE_SIM))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_SOLVABLE_ERRORS",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_SOLVABLE_ERRORS))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_MUST_DISABLE_PROFILE",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_MUST_DISABLE_PROFILE))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_OK",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_OK))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_FIRST_USER",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_FIRST_USER))),
DECLARE_NAPI_STATIC_PROPERTY("RESULT_UNDEFINED_ERROR",
GetNapiValue(env, static_cast<int32_t>(ResultState::RESULT_UNDEFINED_ERROR))),
};
@ -1504,14 +1502,14 @@ napi_status InitEnumResult(napi_env env, napi_value exports)
napi_status InitEnumResolvableErrors(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
DECLARE_NAPI_STATIC_PROPERTY("RESOLVABLE_ERROR_CONFIRMATION_CODE",
GetNapiValue(env, static_cast<int32_t>(ResolvableErrors::RESOLVABLE_ERROR_CONFIRMATION_CODE))),
DECLARE_NAPI_STATIC_PROPERTY("RESOLVABLE_ERROR_POLICY_RULES",
GetNapiValue(env, static_cast<int32_t>(ResolvableErrors::RESOLVABLE_ERROR_POLICY_RULES))),
DECLARE_NAPI_STATIC_PROPERTY("SOLVABLE_ERROR_NEEED_CONFIRMATION_CODE",
GetNapiValue(env, static_cast<int32_t>(SolvableErrors::SOLVABLE_ERROR_NEEED_CONFIRMATION_CODE))),
DECLARE_NAPI_STATIC_PROPERTY("SOLVABLE_ERROR_NEEED_POLICY_RULE",
GetNapiValue(env, static_cast<int32_t>(SolvableErrors::SOLVABLE_ERROR_NEEED_POLICY_RULE))),
};
constexpr size_t arrSize = sizeof(desc) / sizeof(desc[0]);
NapiUtil::DefineEnumClassByName(env, exports, "ResolvableErrors", arrSize, desc);
NapiUtil::DefineEnumClassByName(env, exports, "SolvableErrors", arrSize, desc);
return napi_define_properties(env, exports, arrSize, desc);
}

View File

@ -1308,14 +1308,14 @@ int32_t CoreServiceClient::DeleteProfile(int32_t slotId, const std::u16string &i
}
int32_t CoreServiceClient::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile, 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);
return proxy->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, enumResult);
}
int32_t CoreServiceClient::SetProfileNickname(

View File

@ -15,9 +15,6 @@
#include "core_service_proxy.h"
#ifdef CORE_SERVICE_SUPPORT_ESIM
#include "esim_state_type.h"
#endif
#include "network_search_types.h"
#include "parameter.h"
#include "sim_state_type.h"
@ -3228,29 +3225,29 @@ int32_t CoreServiceProxy::GetEid(int32_t slotId, std::u16string &eId)
void CoreServiceProxy::ReadEuiccProfileFromReply(MessageParcel &reply, EuiccProfile &euiccProfile)
{
euiccProfile.iccId = reply.ReadString16();
euiccProfile.nickName = reply.ReadString16();
euiccProfile.serviceProviderName = reply.ReadString16();
euiccProfile.profileName = reply.ReadString16();
euiccProfile.state = static_cast<ProfileState>(reply.ReadInt32());
euiccProfile.profileClass = static_cast<ProfileClass>(reply.ReadInt32());
euiccProfile.carrierId.mcc = reply.ReadString16();
euiccProfile.carrierId.mnc = reply.ReadString16();
euiccProfile.carrierId.gid1 = reply.ReadString16();
euiccProfile.carrierId.gid2 = reply.ReadString16();
euiccProfile.policyRules = static_cast<PolicyRules>(reply.ReadInt32());
euiccProfile.iccId_ = reply.ReadString16();
euiccProfile.nickName_ = reply.ReadString16();
euiccProfile.serviceProviderName_ = reply.ReadString16();
euiccProfile.profileName_ = reply.ReadString16();
euiccProfile.state_ = static_cast<ProfileState>(reply.ReadInt32());
euiccProfile.profileClass_ = static_cast<ProfileClass>(reply.ReadInt32());
euiccProfile.carrierId_.mcc_ = reply.ReadString16();
euiccProfile.carrierId_.mnc_ = reply.ReadString16();
euiccProfile.carrierId_.gid1_ = reply.ReadString16();
euiccProfile.carrierId_.gid2_ = reply.ReadString16();
euiccProfile.policyRules_ = static_cast<PolicyRules>(reply.ReadInt32());
uint32_t accessRulesSize = reply.ReadUint32();
if (accessRulesSize >= ESIM_MAX_SIZE) {
TELEPHONY_LOGE("over max size");
return;
}
euiccProfile.accessRules.resize(accessRulesSize);
euiccProfile.accessRules_.resize(accessRulesSize);
for (uint32_t j = 0; j < accessRulesSize; ++j) {
AccessRule &rule = euiccProfile.accessRules[j];
rule.certificateHashHexStr = reply.ReadString16();
rule.packageName = reply.ReadString16();
rule.accessType = reply.ReadInt32();
AccessRule &rule = euiccProfile.accessRules_[j];
rule.certificateHashHexStr_ = reply.ReadString16();
rule.packageName_ = reply.ReadString16();
rule.accessType_ = reply.ReadInt32();
}
}
@ -3284,13 +3281,13 @@ int32_t CoreServiceProxy::GetEuiccProfileInfoList(int32_t slotId, GetEuiccProfil
TELEPHONY_LOGE("over max size");
return TELEPHONY_ERR_READ_DATA_FAIL;
}
euiccProfileInfoList.profiles.resize(profileCount);
euiccProfileInfoList.profiles_.resize(profileCount);
for (uint32_t i = 0; i < profileCount; ++i) {
EuiccProfile &euiccProfile = euiccProfileInfoList.profiles[i];
EuiccProfile &euiccProfile = euiccProfileInfoList.profiles_[i];
ReadEuiccProfileFromReply(reply, euiccProfile);
}
euiccProfileInfoList.isRemovable = reply.ReadBool();
euiccProfileInfoList.result = static_cast<ResultState>(reply.ReadInt32());
euiccProfileInfoList.isRemovable_ = reply.ReadBool();
euiccProfileInfoList.result_ = static_cast<ResultState>(reply.ReadInt32());
}
return result;
}
@ -3320,8 +3317,8 @@ int32_t CoreServiceProxy::GetEuiccInfo(int32_t slotId, EuiccInfo &eUiccInfo)
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
eUiccInfo.osVersion = reply.ReadString16();
eUiccInfo.response = reply.ReadString16();
eUiccInfo.osVersion_ = reply.ReadString16();
eUiccInfo.response_ = reply.ReadString16();
}
return result;
}
@ -3413,35 +3410,35 @@ int32_t CoreServiceProxy::ParseRulesAuthTableReply(MessageParcel &reply, EuiccRu
if (policyRulesSize > ESIM_MAX_SIZE) {
return TELEPHONY_ERR_FAIL;
}
eUiccRulesAuthTable.policyRules.resize(policyRulesSize);
eUiccRulesAuthTable.policyRules_.resize(policyRulesSize);
for (uint32_t i = 0; i < policyRulesSize; ++i) {
eUiccRulesAuthTable.policyRules[i] = reply.ReadInt32();
eUiccRulesAuthTable.policyRules_[i] = reply.ReadInt32();
}
uint32_t carrierIdsSize = reply.ReadUint32();
if (carrierIdsSize > ESIM_MAX_SIZE) {
return TELEPHONY_ERR_FAIL;
}
eUiccRulesAuthTable.carrierIds.resize(carrierIdsSize);
eUiccRulesAuthTable.carrierIds_.resize(carrierIdsSize);
for (uint32_t j = 0; j < carrierIdsSize; ++j) {
CarrierIdentifier &ci = eUiccRulesAuthTable.carrierIds[j];
ci.mcc = reply.ReadString16();
ci.mnc = reply.ReadString16();
ci.spn = reply.ReadString16();
ci.imsi = reply.ReadString16();
ci.gid1 = reply.ReadString16();
ci.gid2 = reply.ReadString16();
ci.carrierId = reply.ReadInt32();
ci.specificCarrierId = reply.ReadInt32();
CarrierIdentifier &ci = eUiccRulesAuthTable.carrierIds_[j];
ci.mcc_ = reply.ReadString16();
ci.mnc_ = reply.ReadString16();
ci.spn_ = reply.ReadString16();
ci.imsi_ = reply.ReadString16();
ci.gid1_ = reply.ReadString16();
ci.gid2_ = reply.ReadString16();
ci.carrierId_ = reply.ReadInt32();
ci.specificCarrierId_ = reply.ReadInt32();
}
uint32_t policyRuleFlagsSize = reply.ReadUint32();
if (policyRuleFlagsSize > ESIM_MAX_SIZE) {
return TELEPHONY_ERR_FAIL;
}
eUiccRulesAuthTable.policyRuleFlags.resize(policyRuleFlagsSize);
eUiccRulesAuthTable.policyRuleFlags_.resize(policyRuleFlagsSize);
for (uint32_t k = 0; k < policyRuleFlagsSize; ++k) {
eUiccRulesAuthTable.policyRuleFlags[k] = reply.ReadInt32();
eUiccRulesAuthTable.policyRuleFlags_[k] = reply.ReadInt32();
}
eUiccRulesAuthTable.position = reply.ReadInt32();
eUiccRulesAuthTable.position_ = reply.ReadInt32();
}
return result;
}
@ -3509,8 +3506,8 @@ int32_t CoreServiceProxy::GetEuiccChallenge(
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -3582,8 +3579,8 @@ int32_t CoreServiceProxy::CancelSession(
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -3762,8 +3759,8 @@ int32_t CoreServiceProxy::SendApduData(
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -3780,11 +3777,11 @@ int32_t CoreServiceProxy::PrepareDownload(int32_t slotId, const DownLoadConfigIn
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
bool ret = data.WriteInt32(slotId);
ret = (ret && data.WriteInt32(downLoadConfigInfo.portIndex));
ret = (ret && data.WriteString16(downLoadConfigInfo.hashCc));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpSigned2));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpSignature2));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpCertificate));
ret = (ret && data.WriteInt32(downLoadConfigInfo.portIndex_));
ret = (ret && data.WriteString16(downLoadConfigInfo.hashCc_));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpSigned2_));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpSignature2_));
ret = (ret && data.WriteString16(downLoadConfigInfo.smdpCertificate_));
if (!ret) {
TELEPHONY_LOGE("Write data false");
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
@ -3803,8 +3800,8 @@ int32_t CoreServiceProxy::PrepareDownload(int32_t slotId, const DownLoadConfigIn
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -3842,12 +3839,12 @@ int32_t CoreServiceProxy::LoadBoundProfilePackage(int32_t slotId, int32_t portIn
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = reply.ReadInt32();
responseResult.response = reply.ReadString16();
responseResult.seqNumber = reply.ReadInt32();
responseResult.profileManagementOperation = reply.ReadInt32();
responseResult.notificationAddress = reply.ReadString16();
responseResult.iccId = reply.ReadString16();
responseResult.resultCode_ = reply.ReadInt32();
responseResult.response_ = reply.ReadString16();
responseResult.seqNumber_ = reply.ReadInt32();
responseResult.profileManagementOperation_ = reply.ReadInt32();
responseResult.notificationAddress_ = reply.ReadString16();
responseResult.iccId_ = reply.ReadString16();
}
return result;
}
@ -3889,13 +3886,13 @@ int32_t CoreServiceProxy::ListNotifications(
TELEPHONY_LOGE("CoreServiceProxy::RetrieveNotificationList over max size");
return TELEPHONY_ERR_READ_DATA_FAIL;
}
notificationList.euiccNotification.resize(euiccNotificationCount);
notificationList.euiccNotification_.resize(euiccNotificationCount);
for (uint32_t i = 0; i < euiccNotificationCount; ++i) {
EuiccNotification &nf = notificationList.euiccNotification[i];
nf.seq = reply.ReadInt32();
nf.targetAddr = reply.ReadString16();
nf.event = reply.ReadInt32();
nf.data = reply.ReadString16();
EuiccNotification &nf = notificationList.euiccNotification_[i];
nf.seq_ = reply.ReadInt32();
nf.targetAddr_ = reply.ReadString16();
nf.event_ = reply.ReadInt32();
nf.data_ = reply.ReadString16();
}
}
return result;
@ -3943,13 +3940,13 @@ int32_t CoreServiceProxy::RetrieveNotificationList(
TELEPHONY_LOGE("CoreServiceProxy::RetrieveNotificationList over max size");
return TELEPHONY_ERR_READ_DATA_FAIL;
}
notificationList.euiccNotification.resize(euiccNotificationCount);
notificationList.euiccNotification_.resize(euiccNotificationCount);
for (uint32_t i = 0; i < euiccNotificationCount; ++i) {
EuiccNotification &nf = notificationList.euiccNotification[i];
nf.seq = reply.ReadInt32();
nf.targetAddr = reply.ReadString16();
nf.event = reply.ReadInt32();
nf.data = reply.ReadString16();
EuiccNotification &nf = notificationList.euiccNotification_[i];
nf.seq_ = reply.ReadInt32();
nf.targetAddr_ = reply.ReadString16();
nf.event_ = reply.ReadInt32();
nf.data_ = reply.ReadString16();
}
}
return result;
@ -3991,10 +3988,10 @@ int32_t CoreServiceProxy::RetrieveNotification(
}
int32_t res = reply.ReadInt32();
if (res == TELEPHONY_ERR_SUCCESS) {
notification.seq = reply.ReadInt32();
notification.targetAddr = reply.ReadString16();
notification.event = reply.ReadInt32();
notification.data = reply.ReadString16();
notification.seq_ = reply.ReadInt32();
notification.targetAddr_ = reply.ReadString16();
notification.event_ = reply.ReadInt32();
notification.data_ = reply.ReadString16();
}
return res;
}
@ -4072,7 +4069,7 @@ int32_t CoreServiceProxy::DeleteProfile(int32_t slotId, const std::u16string &ic
}
int32_t CoreServiceProxy::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile, ResultState &enumResult)
{
MessageParcel data;
MessageParcel reply;
@ -4082,7 +4079,7 @@ int32_t CoreServiceProxy::SwitchToProfile(
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
if (!data.WriteInt32(slotId) || !data.WriteInt32(portIndex) ||
!data.WriteString16(iccId) || !data.WriteBool(forceDeactivateSim)) {
!data.WriteString16(iccId) || !data.WriteBool(forceDisableProfile)) {
TELEPHONY_LOGE("Write is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
@ -4166,8 +4163,8 @@ int32_t CoreServiceProxy::GetEuiccInfo2(int32_t slotId, int32_t portIndex, Respo
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -4188,8 +4185,8 @@ int32_t CoreServiceProxy::RealAuthenticateServer(const MessageParcel &data, cons
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
responseResult.resultCode = static_cast<ResultState>(reply.ReadInt32());
responseResult.response = reply.ReadString16();
responseResult.resultCode_ = static_cast<ResultState>(reply.ReadInt32());
responseResult.response_ = reply.ReadString16();
}
return result;
}
@ -4208,27 +4205,27 @@ int32_t CoreServiceProxy::AuthenticateServer(
TELEPHONY_LOGE("WriteInt32 slotId is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteInt32(authenticateConfigInfo.portIndex)) {
if (!data.WriteInt32(authenticateConfigInfo.portIndex_)) {
TELEPHONY_LOGE("WriteInt32 portIndex is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteString16(authenticateConfigInfo.matchingId)) {
if (!data.WriteString16(authenticateConfigInfo.matchingId_)) {
TELEPHONY_LOGE("WriteString16 matchingId is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteString16(authenticateConfigInfo.serverSigned1)) {
if (!data.WriteString16(authenticateConfigInfo.serverSigned1_)) {
TELEPHONY_LOGE("WriteString16 serverSigned1 is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteString16(authenticateConfigInfo.serverSignature1)) {
if (!data.WriteString16(authenticateConfigInfo.serverSignature1_)) {
TELEPHONY_LOGE("WriteString16 serverSignature1 is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteString16(authenticateConfigInfo.euiccCiPkIdToBeUsed)) {
if (!data.WriteString16(authenticateConfigInfo.euiccCiPkIdToBeUsed_)) {
TELEPHONY_LOGE("WriteString16 euiccCiPkIdToBeUsed is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}
if (!data.WriteString16(authenticateConfigInfo.serverCertificate)) {
if (!data.WriteString16(authenticateConfigInfo.serverCertificate_)) {
TELEPHONY_LOGE("WriteString16 serverCertificate is false");
return TELEPHONY_ERR_WRITE_DATA_FAIL;
}

View File

@ -29,7 +29,7 @@ bool DownloadProfileResult::ReadFromParcel(Parcel &parcel)
return false;
}
result_ = static_cast<ResultState>(resultValue);
resolvableErrors_ = static_cast<ResolvableErrors>(resolvableErrorsValue);
resolvableErrors_ = static_cast<SolvableErrors>(resolvableErrorsValue);
return true;
}

View File

@ -177,7 +177,7 @@ int32_t EsimServiceClient::StartOsu(int32_t slotId, int32_t &startOsuResult)
int32_t EsimServiceClient::GetDownloadableProfileMetadata(
int32_t slotId, int32_t portIndex, const DownloadableProfile &profile,
bool forceDeactivateSim, GetDownloadableProfileMetadataResult &profileMetadataResult)
bool forceDisableProfile, GetDownloadableProfileMetadataResult &profileMetadataResult)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
@ -185,18 +185,18 @@ int32_t EsimServiceClient::GetDownloadableProfileMetadata(
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->GetDownloadableProfileMetadata(
slotId, portIndex, profile, forceDeactivateSim, profileMetadataResult);
slotId, portIndex, profile, forceDisableProfile, profileMetadataResult);
}
int32_t EsimServiceClient::GetDownloadableProfiles(
int32_t slotId, int32_t portIndex, bool forceDeactivateSim, GetDownloadableProfilesResult &profileListResult)
int32_t slotId, int32_t portIndex, bool forceDisableProfile, GetDownloadableProfilesResult &profileListResult)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
TELEPHONY_LOGE("proxy is null!");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->GetDownloadableProfiles(slotId, portIndex, forceDeactivateSim, profileListResult);
return proxy->GetDownloadableProfiles(slotId, portIndex, forceDisableProfile, profileListResult);
}
int32_t EsimServiceClient::DownloadProfile(int32_t slotId, DownloadProfileConfigInfo configInfo,
@ -241,14 +241,14 @@ int32_t EsimServiceClient::DeleteProfile(int32_t slotId, const std::string &iccI
}
int32_t EsimServiceClient::SwitchToProfile(int32_t slotId, int32_t portIndex,
const std::string &iccId, bool forceDeactivateSim, int32_t &switchToProfileResult)
const std::string &iccId, bool forceDisableProfile, int32_t &switchToProfileResult)
{
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, switchToProfileResult);
return proxy->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, switchToProfileResult);
}
int32_t EsimServiceClient::SetProfileNickname(int32_t slotId, const std::string &iccId,

View File

@ -51,7 +51,7 @@ bool GetDownloadableProfileMetadataResult::ReadFromParcel(Parcel &parcel)
!parcel.ReadInt32(resolvableErrorsValue) || !parcel.ReadInt32(resultValue)) {
return false;
}
resolvableErrors_ = static_cast<ResolvableErrors>(resolvableErrorsValue);
resolvableErrors_ = static_cast<SolvableErrors>(resolvableErrorsValue);
result_ = static_cast<ResultState>(resultValue);
return true;

View File

@ -29,12 +29,12 @@ interface OHOS.Telephony.IEsimService {
[in] int slotId,
[in] int portIndex,
[in] DownloadableProfile profile,
[in] boolean forceDeactivateSim,
[in] boolean forceDisableProfile,
[out] GetDownloadableProfileMetadataResult profileMetadataResult);
void GetDownloadableProfiles(
[in] int slotId,
[in] int portIndex,
[in] boolean forceDeactivateSim,
[in] boolean forceDisableProfile,
[out] GetDownloadableProfilesResult profileListResult);
void DownloadProfile(
[in] int slotId,
@ -48,7 +48,7 @@ interface OHOS.Telephony.IEsimService {
[in] int slotId,
[in] int portIndex,
[in] String iccId,
[in] boolean forceDeactivateSim,
[in] boolean forceDisableProfile,
[out] int switchToProfileResult);
void SetProfileNickname(
[in] int slotId,

View File

@ -1155,12 +1155,12 @@ public:
* @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,
* @param forceDisableProfile[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,
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile,
ResultState &enumResult);
/**
@ -1180,7 +1180,7 @@ public:
*
* @param slotId[in], sim slot id
* @param portIndex[in], the Id of the eUICC
* @param result[out], get the result code and the info2
* @param responseResult[out], get the result code and the info2
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t GetEuiccInfo2(int32_t slotId, int32_t portIndex, ResponseEsimResult &responseResult);

View File

@ -181,7 +181,7 @@ public:
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,
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile,
ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;

View File

@ -27,7 +27,7 @@ namespace Telephony {
*/
struct DownloadProfileResult : public Parcelable {
ResultState result_;
ResolvableErrors resolvableErrors_;
SolvableErrors resolvableErrors_;
uint32_t cardId_ = 0;
bool ReadFromParcel(Parcel &parcel);

View File

@ -75,26 +75,26 @@ public:
* @param slotId[in], indicates the card slot index number.
* @param portIndex[in], index of the port from the slot.
* @param profile[in], the Bound Profile Package data returned by SM-DP+ server.
* @param forceDeactivateSim[in], if true, and if an active SIM must be deactivated to access the eUICC,
* @param forceDisableProfile[in], if true, and if an active SIM must be deactivated to access the eUICC,
* perform this action automatically.
* @param profileMetadataResult[out], the metadata for profile.
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t GetDownloadableProfileMetadata(int32_t slotId, int32_t portIndex, const DownloadableProfile &profile,
bool forceDeactivateSim, GetDownloadableProfileMetadataResult &profileMetadataResult);
bool forceDisableProfile, GetDownloadableProfileMetadataResult &profileMetadataResult);
/**
* @brief Gets downloadable profile List which are available for download on this device.
*
* @param slotId[in], indicates the card slot index number.
* @param forceDeactivateSim[in], if true, and if an active SIM must be deactivated to access the eUICC,
* @param forceDisableProfile[in], if true, and if an active SIM must be deactivated to access the eUICC,
* perform this action automatically.
* @param profileListResult[out], the metadata for downloadableProfile which are
* available for download on this device.
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t GetDownloadableProfiles(
int32_t slotId, int32_t portIndex, bool forceDeactivateSim, GetDownloadableProfilesResult &profileListResult);
int32_t slotId, int32_t portIndex, bool forceDisableProfile, GetDownloadableProfilesResult &profileListResult);
/**
* @brief Attempt to download the given downloadable Profile.
@ -142,13 +142,13 @@ public:
* @param slotId[in], indicates the card slot index number.
* @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,
* @param forceDisableProfile[in], if true, and if an active SIM must be deactivated to access the eUICC,
* perform this action automatically.
* @param switchToProfileResult[out], the response to switch profile.
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex,
const std::string &iccId, bool forceDeactivateSim, int32_t &switchToProfileResult);
const std::string &iccId, bool forceDisableProfile, int32_t &switchToProfileResult);
/**
* @brief Set the nickname for the given profile.

View File

@ -27,29 +27,28 @@ namespace Telephony {
* @brief Result state.
*/
enum class ResultState {
RESULT_RESOLVABLE_ERRORS = -2,
RESULT_MUST_DEACTIVATE_SIM = -1,
RESULT_SOLVABLE_ERRORS = -2,
RESULT_MUST_DISABLE_PROFILE = -1,
RESULT_OK = 0,
RESULT_FIRST_USER = 1,
RESULT_UNDEFINED_ERROR = 2,
RESULT_UNDEFINED_ERROR = 1,
};
/**
* @brief Euicc OTA update status.
*/
enum class OsuStatus {
EUICC_OSU_IN_PROGRESS = 1,
EUICC_OSU_FAILED = 2,
EUICC_OSU_SUCCEEDED = 3,
EUICC_OSU_NOT_NEEDED = 4,
EUICC_OSU_UNAVAILABLE = 5,
EUICC_UPGRAD_IN_PROGRESS = 1,
EUICC_UPGRAD_FAILED = 2,
EUICC_UPGRAD_SUCCESSFUL = 3,
EUICC_UPGRAD_ALREADY_LATEST = 4,
EUICC_UPGRAD_SERVICE_UNAVAILABLE = 5,
};
/**
* @brief Reason for canceling a profile download session.
*/
enum class CancelReason {
CANCEL_REASON_END_USER_REJECTED = 0,
CANCEL_REASON_END_USER_REJECTION = 0,
CANCEL_REASON_POSTPONED = 1,
CANCEL_REASON_TIMEOUT = 2,
CANCEL_REASON_PPR_NOT_ALLOWED = 3,
@ -78,7 +77,7 @@ enum class ProfileState {
*/
enum class ProfileClass {
PROFILE_CLASS_UNSPECIFIED = -1,
PROFILE_CLASS_TESTING = 0,
PROFILE_CLASS_TEST = 0,
PROFILE_CLASS_PROVISIONING = 1,
PROFILE_CLASS_OPERATIONAL = 2,
};
@ -87,17 +86,17 @@ enum class ProfileClass {
* @brief The policy rules of the profile.
*/
enum class PolicyRules {
POLICY_RULE_DO_NOT_DISABLE = 1,
POLICY_RULE_DO_NOT_DELETE = 1 << 1,
POLICY_RULE_DELETE_AFTER_DISABLING = 1 << 2,
POLICY_RULE_DISABLE_NOT_ALLOWED = 1,
POLICY_RULE_DELETE_NOT_ALLOWED = 1 << 1,
POLICY_RULE_DISABLE_AND_DELETE = 1 << 2,
};
/**
* @brief The bit map of resolvable errors.
*/
enum class ResolvableErrors {
RESOLVABLE_ERROR_CONFIRMATION_CODE = 1 << 0,
RESOLVABLE_ERROR_POLICY_RULES = 1 << 1,
enum class SolvableErrors {
SOLVABLE_ERROR_NEEED_CONFIRMATION_CODE = 1 << 0,
SOLVABLE_ERROR_NEEED_POLICY_RULE = 1 << 1,
};
/**
@ -162,23 +161,23 @@ struct EuiccRulesAuthTable {
* @brief ConfigInfo about prepareDownload.
*/
struct DownLoadConfigInfo {
int32_t portIndex = 0;
std::u16string hashCc = u"";
std::u16string smdpSigned2 = u"";
std::u16string smdpSignature2 = u"";
std::u16string smdpCertificate = u"";
int32_t portIndex_ = 0;
std::u16string hashCc_ = u"";
std::u16string smdpSigned2_ = u"";
std::u16string smdpSignature2_ = u"";
std::u16string smdpCertificate_ = u"";
};
/**
* @brief Config information about Authenticate.
*/
struct AuthenticateConfigInfo {
int32_t portIndex = 0;
std::u16string matchingId = u"";
std::u16string serverSigned1 = u"";
std::u16string serverSignature1 = u"";
std::u16string euiccCiPkIdToBeUsed = u"";
std::u16string serverCertificate = u"";
int32_t portIndex_ = 0;
std::u16string matchingId_ = u"";
std::u16string serverSigned1_ = u"";
std::u16string serverSignature1_ = u"";
std::u16string euiccCiPkIdToBeUsed_ = u"";
std::u16string serverCertificate_ = u"";
};
/**

View File

@ -19,7 +19,15 @@
#include "cell_information.h"
#include "dialling_numbers_info.h"
#ifdef CORE_SERVICE_SUPPORT_ESIM
#include "download_profile_config_info_parcel.h"
#include "download_profile_result_parcel.h"
#include "downloadable_profile_parcel.h"
#include "esim_state_type.h"
#include "euicc_info_parcel.h"
#include "get_downloadable_profiles_result_parcel.h"
#include "profile_info_list_parcel.h"
#include "profile_metadata_result_parcel.h"
#include "response_esim_result.h"
#endif
#include "i_network_search_callback.h"
#include "ims_reg_info_callback.h"
@ -188,7 +196,7 @@ public:
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;
const std::u16string &iccId, bool forceDisableProfile, ResultState &enumResult) = 0;
virtual int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) = 0;
virtual int32_t GetEuiccInfo2(int32_t slotId, int32_t portIndex, ResponseEsimResult &responseResult) = 0;

View File

@ -18,7 +18,15 @@
#include "dialling_numbers_info.h"
#ifdef CORE_SERVICE_SUPPORT_ESIM
#include "download_profile_config_info_parcel.h"
#include "download_profile_result_parcel.h"
#include "downloadable_profile_parcel.h"
#include "esim_state_type.h"
#include "euicc_info_parcel.h"
#include "get_downloadable_profiles_result_parcel.h"
#include "profile_info_list_parcel.h"
#include "profile_metadata_result_parcel.h"
#include "response_esim_result.h"
#endif
#include "event_handler.h"
#include "operator_config_types.h"
@ -180,7 +188,7 @@ public:
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;
const std::u16string &iccId, bool forceDisableProfile, ResultState &enumResult) = 0;
virtual int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) = 0;
virtual int32_t GetEuiccInfo2(int32_t slotId, int32_t portIndex, ResponseEsimResult &responseResult) = 0;

View File

@ -32,7 +32,7 @@ struct GetDownloadableProfileMetadataResult : public Parcelable {
DownloadableProfile downloadableProfiles_;
int32_t pprType_ = 0;
bool pprFlag_ = false;
ResolvableErrors resolvableErrors_;
SolvableErrors resolvableErrors_;
ResultState result_;
bool ReadFromParcel(Parcel &parcel);

View File

@ -318,7 +318,7 @@ public:
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;
bool forceDisableProfile, ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;

View File

@ -2011,7 +2011,7 @@ int32_t CoreService::DeleteProfile(int32_t slotId, const std::u16string &iccId,
}
int32_t CoreService::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile, ResultState &enumResult)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {
TELEPHONY_LOGE("Non-system applications use system APIs!");
@ -2025,7 +2025,7 @@ int32_t CoreService::SwitchToProfile(
TELEPHONY_LOGE("simManager_ is null");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return simManager_->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, enumResult);
return simManager_->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, enumResult);
}
int32_t CoreService::SetProfileNickname(

View File

@ -2022,31 +2022,31 @@ int32_t CoreServiceStub::OnGetEuiccProfileInfoList(MessageParcel &data, MessageP
int32_t result = GetEuiccProfileInfoList(slotId, euiccProfileInfoList);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
if (!reply.WriteUint32(euiccProfileInfoList.profiles.size())) {
if (!reply.WriteUint32(euiccProfileInfoList.profiles_.size())) {
TELEPHONY_LOGE("write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
for (const auto &profile : euiccProfileInfoList.profiles) {
ret = (ret && reply.WriteString16(profile.iccId));
ret = (ret && reply.WriteString16(profile.nickName));
ret = (ret && reply.WriteString16(profile.serviceProviderName));
ret = (ret && reply.WriteString16(profile.profileName));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.state)));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.profileClass)));
ret = (ret && reply.WriteString16(profile.carrierId.mcc));
ret = (ret && reply.WriteString16(profile.carrierId.mnc));
ret = (ret && reply.WriteString16(profile.carrierId.gid1));
ret = (ret && reply.WriteString16(profile.carrierId.gid2));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.policyRules)));
ret = (ret && reply.WriteUint32(profile.accessRules.size()));
for (const auto &rule : profile.accessRules) {
ret = (ret && reply.WriteString16(rule.certificateHashHexStr));
ret = (ret && reply.WriteString16(rule.packageName));
ret = (ret && reply.WriteInt32(rule.accessType));
for (const auto &profile : euiccProfileInfoList.profiles_) {
ret = (ret && reply.WriteString16(profile.iccId_));
ret = (ret && reply.WriteString16(profile.nickName_));
ret = (ret && reply.WriteString16(profile.serviceProviderName_));
ret = (ret && reply.WriteString16(profile.profileName_));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.state_)));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.profileClass_)));
ret = (ret && reply.WriteString16(profile.carrierId_.mcc_));
ret = (ret && reply.WriteString16(profile.carrierId_.mnc_));
ret = (ret && reply.WriteString16(profile.carrierId_.gid1_));
ret = (ret && reply.WriteString16(profile.carrierId_.gid2_));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(profile.policyRules_)));
ret = (ret && reply.WriteUint32(profile.accessRules_.size()));
for (const auto &rule : profile.accessRules_) {
ret = (ret && reply.WriteString16(rule.certificateHashHexStr_));
ret = (ret && reply.WriteString16(rule.packageName_));
ret = (ret && reply.WriteInt32(rule.accessType_));
}
}
ret = (ret && reply.WriteBool(euiccProfileInfoList.isRemovable));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(euiccProfileInfoList.result)));
ret = (ret && reply.WriteBool(euiccProfileInfoList.isRemovable_));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(euiccProfileInfoList.result_)));
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
@ -2062,7 +2062,7 @@ int32_t CoreServiceStub::OnGetEuiccInfo(MessageParcel &data, MessageParcel &repl
int32_t result = GetEuiccInfo(slotId, eUiccInfo);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteString16(eUiccInfo.osVersion) && reply.WriteString16(eUiccInfo.response));
ret = (ret && reply.WriteString16(eUiccInfo.osVersion_) && reply.WriteString16(eUiccInfo.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
@ -2115,26 +2115,26 @@ int32_t CoreServiceStub::OnGetRulesAuthTable(MessageParcel &data, MessageParcel
int32_t result = GetRulesAuthTable(slotId, portIndex, eUiccRulesAuthTable);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.policyRules.size()));
for (const auto &rules : eUiccRulesAuthTable.policyRules) {
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.policyRules_.size()));
for (const auto &rules : eUiccRulesAuthTable.policyRules_) {
ret = (ret && reply.WriteInt32(rules));
}
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.carrierIds.size()));
for (const auto &carrier : eUiccRulesAuthTable.carrierIds) {
ret = (ret && reply.WriteString16(carrier.mcc));
ret = (ret && reply.WriteString16(carrier.mnc));
ret = (ret && reply.WriteString16(carrier.spn));
ret = (ret && reply.WriteString16(carrier.imsi));
ret = (ret && reply.WriteString16(carrier.gid1));
ret = (ret && reply.WriteString16(carrier.gid2));
ret = (ret && reply.WriteInt32(carrier.carrierId));
ret = (ret && reply.WriteInt32(carrier.specificCarrierId));
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.carrierIds_.size()));
for (const auto &carrier : eUiccRulesAuthTable.carrierIds_) {
ret = (ret && reply.WriteString16(carrier.mcc_));
ret = (ret && reply.WriteString16(carrier.mnc_));
ret = (ret && reply.WriteString16(carrier.spn_));
ret = (ret && reply.WriteString16(carrier.imsi_));
ret = (ret && reply.WriteString16(carrier.gid1_));
ret = (ret && reply.WriteString16(carrier.gid2_));
ret = (ret && reply.WriteInt32(carrier.carrierId_));
ret = (ret && reply.WriteInt32(carrier.specificCarrierId_));
}
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.policyRuleFlags.size()));
for (const auto &ruleFlags : eUiccRulesAuthTable.policyRuleFlags) {
ret = (ret && reply.WriteUint32(eUiccRulesAuthTable.policyRuleFlags_.size()));
for (const auto &ruleFlags : eUiccRulesAuthTable.policyRuleFlags_) {
ret = (ret && reply.WriteInt32(ruleFlags));
}
ret = (ret && reply.WriteInt32(eUiccRulesAuthTable.position));
ret = (ret && reply.WriteInt32(eUiccRulesAuthTable.position_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
@ -2151,8 +2151,8 @@ int32_t CoreServiceStub::OnGetEuiccChallenge(MessageParcel &data, MessageParcel
int32_t result = GetEuiccChallenge(slotId, portIndex, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
@ -2186,8 +2186,8 @@ int32_t CoreServiceStub::OnCancelSession(MessageParcel &data, MessageParcel &rep
int32_t result = CancelSession(slotId, transactionId, cancelReason, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed");
@ -2205,22 +2205,22 @@ int32_t CoreServiceStub::OnGetProfile(MessageParcel &data, MessageParcel &reply)
int32_t result = GetProfile(slotId, portIndex, iccId, eUiccProfile);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteString16(eUiccProfile.iccId));
ret = (ret && reply.WriteString16(eUiccProfile.nickName));
ret = (ret && reply.WriteString16(eUiccProfile.serviceProviderName));
ret = (ret && reply.WriteString16(eUiccProfile.profileName));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.state)));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.profileClass)));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId.mcc));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId.mnc));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId.gid1));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId.gid2));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.policyRules)));
ret = (ret && reply.WriteInt32(eUiccProfile.accessRules.size()));
for (const auto &rule : eUiccProfile.accessRules) {
ret = (ret && reply.WriteString16(rule.certificateHashHexStr));
ret = (ret && reply.WriteString16(rule.packageName));
ret = (ret && reply.WriteInt32(rule.accessType));
ret = (ret && reply.WriteString16(eUiccProfile.iccId_));
ret = (ret && reply.WriteString16(eUiccProfile.nickName_));
ret = (ret && reply.WriteString16(eUiccProfile.serviceProviderName_));
ret = (ret && reply.WriteString16(eUiccProfile.profileName_));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.state_)));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.profileClass_)));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId_.mcc_));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId_.mnc_));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId_.gid1_));
ret = (ret && reply.WriteString16(eUiccProfile.carrierId_.gid2_));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(eUiccProfile.policyRules_)));
ret = (ret && reply.WriteInt32(eUiccProfile.accessRules_.size()));
for (const auto &rule : eUiccProfile.accessRules_) {
ret = (ret && reply.WriteString16(rule.certificateHashHexStr_));
ret = (ret && reply.WriteString16(rule.packageName_));
ret = (ret && reply.WriteInt32(rule.accessType_));
}
}
if (!ret) {
@ -2285,8 +2285,8 @@ int32_t CoreServiceStub::OnSendApduData(MessageParcel &data, MessageParcel &repl
int32_t result = SendApduData(slotId, aid, apduData, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
@ -2299,18 +2299,18 @@ int32_t CoreServiceStub::OnPrepareDownload(MessageParcel &data, MessageParcel &r
{
DownLoadConfigInfo downLoadConfigInfo;
int32_t slotId = data.ReadInt32();
downLoadConfigInfo.portIndex = data.ReadInt32();
downLoadConfigInfo.hashCc = data.ReadString16();
downLoadConfigInfo.smdpSigned2 = data.ReadString16();
downLoadConfigInfo.smdpSignature2 = data.ReadString16();
downLoadConfigInfo.smdpCertificate = data.ReadString16();
downLoadConfigInfo.portIndex_ = data.ReadInt32();
downLoadConfigInfo.hashCc_ = data.ReadString16();
downLoadConfigInfo.smdpSigned2_ = data.ReadString16();
downLoadConfigInfo.smdpSignature2_ = data.ReadString16();
downLoadConfigInfo.smdpCertificate_ = data.ReadString16();
ResponseEsimResult responseResult;
int32_t result = PrepareDownload(slotId, downLoadConfigInfo, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("OnPrepareDownload write reply failed.");
@ -2329,12 +2329,12 @@ int32_t CoreServiceStub::OnLoadBoundProfilePackage(MessageParcel &data, MessageP
int32_t result = LoadBoundProfilePackage(slotId, portIndex, boundProfilePackage, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(responseResult.resultCode));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(responseResult.seqNumber));
ret = (ret && reply.WriteInt32(responseResult.profileManagementOperation));
ret = (ret && reply.WriteString16(responseResult.notificationAddress));
ret = (ret && reply.WriteString16(responseResult.iccId));
ret = (ret && reply.WriteInt32(responseResult.resultCode_));
ret = (ret && reply.WriteString16(responseResult.response_));
ret = (ret && reply.WriteInt32(responseResult.seqNumber_));
ret = (ret && reply.WriteInt32(responseResult.profileManagementOperation_));
ret = (ret && reply.WriteString16(responseResult.notificationAddress_));
ret = (ret && reply.WriteString16(responseResult.iccId_));
}
if (!ret) {
TELEPHONY_LOGE("OnLoadBoundProfilePackage write reply failed.");
@ -2352,12 +2352,12 @@ int32_t CoreServiceStub::OnListNotifications(MessageParcel &data, MessageParcel
int32_t result = ListNotifications(slotId, portIndex, events, notificationList);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteUint32(notificationList.euiccNotification.size()));
for (const auto &notification : notificationList.euiccNotification) {
ret = (ret && reply.WriteInt32(notification.seq));
ret = (ret && reply.WriteString16(notification.targetAddr));
ret = (ret && reply.WriteInt32(notification.event));
ret = (ret && reply.WriteString16(notification.data));
ret = (ret && reply.WriteUint32(notificationList.euiccNotification_.size()));
for (const auto &notification : notificationList.euiccNotification_) {
ret = (ret && reply.WriteInt32(notification.seq_));
ret = (ret && reply.WriteString16(notification.targetAddr_));
ret = (ret && reply.WriteInt32(notification.event_));
ret = (ret && reply.WriteString16(notification.data_));
}
}
if (!ret) {
@ -2376,12 +2376,12 @@ int32_t CoreServiceStub::OnRetrieveNotificationList(MessageParcel &data, Message
int32_t result = RetrieveNotificationList(slotId, portIndex, events, notificationList);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteUint32(notificationList.euiccNotification.size()));
for (const auto &notification : notificationList.euiccNotification) {
ret = (ret && reply.WriteInt32(notification.seq));
ret = (ret && reply.WriteString16(notification.targetAddr));
ret = (ret && reply.WriteInt32(notification.event));
ret = (ret && reply.WriteString16(notification.data));
ret = (ret && reply.WriteUint32(notificationList.euiccNotification_.size()));
for (const auto &notification : notificationList.euiccNotification_) {
ret = (ret && reply.WriteInt32(notification.seq_));
ret = (ret && reply.WriteString16(notification.targetAddr_));
ret = (ret && reply.WriteInt32(notification.event_));
ret = (ret && reply.WriteString16(notification.data_));
}
}
if (!ret) {
@ -2401,10 +2401,10 @@ int32_t CoreServiceStub::OnRetrieveNotification(MessageParcel &data, MessageParc
int32_t result = RetrieveNotification(slotId, portIndex, seqNumber, notification);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(notification.seq));
ret = (ret && reply.WriteString16(notification.targetAddr));
ret = (ret && reply.WriteInt32(notification.event));
ret = (ret && reply.WriteString16(notification.data));
ret = (ret && reply.WriteInt32(notification.seq_));
ret = (ret && reply.WriteString16(notification.targetAddr_));
ret = (ret && reply.WriteInt32(notification.event_));
ret = (ret && reply.WriteString16(notification.data_));
}
if (!ret) {
TELEPHONY_LOGE("OnRetrieveNotification write reply failed.");
@ -2454,9 +2454,9 @@ int32_t CoreServiceStub::OnSwitchToProfile(MessageParcel &data, MessageParcel &r
int32_t slotId = data.ReadInt32();
int32_t portIndex = data.ReadInt32();
std::u16string iccId = data.ReadString16();
bool forceDeactivateSim = data.ReadBool();
bool forceDisableProfile = data.ReadBool();
ResultState enumResult;
int32_t result = SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, enumResult);
int32_t result = SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, enumResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(enumResult)));
@ -2494,8 +2494,8 @@ int32_t CoreServiceStub::OnGetEuiccInfo2(MessageParcel &data, MessageParcel &rep
int32_t result = GetEuiccInfo2(slotId, portIndex, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");
@ -2508,18 +2508,18 @@ int32_t CoreServiceStub::OnAuthenticateServer(MessageParcel &data, MessageParcel
{
int32_t slotId = data.ReadInt32();
AuthenticateConfigInfo authenticateConfigInfo;
authenticateConfigInfo.portIndex = data.ReadInt32();
authenticateConfigInfo.matchingId = data.ReadString16();
authenticateConfigInfo.serverSigned1 = data.ReadString16();
authenticateConfigInfo.serverSignature1 = data.ReadString16();
authenticateConfigInfo.euiccCiPkIdToBeUsed = data.ReadString16();
authenticateConfigInfo.serverCertificate = data.ReadString16();
authenticateConfigInfo.portIndex_ = data.ReadInt32();
authenticateConfigInfo.matchingId_ = data.ReadString16();
authenticateConfigInfo.serverSigned1_ = data.ReadString16();
authenticateConfigInfo.serverSignature1_ = data.ReadString16();
authenticateConfigInfo.euiccCiPkIdToBeUsed_ = data.ReadString16();
authenticateConfigInfo.serverCertificate_ = data.ReadString16();
ResponseEsimResult responseResult;
int32_t result = AuthenticateServer(slotId, authenticateConfigInfo, responseResult);
bool ret = reply.WriteInt32(result);
if (result == TELEPHONY_ERR_SUCCESS) {
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode)));
ret = (ret && reply.WriteString16(responseResult.response));
ret = (ret && reply.WriteInt32(static_cast<int32_t>(responseResult.resultCode_)));
ret = (ret && reply.WriteString16(responseResult.response_));
}
if (!ret) {
TELEPHONY_LOGE("write reply failed.");

View File

@ -21,11 +21,20 @@
#include "asn1_decoder.h"
#include "asn1_node.h"
#include "asn1_utils.h"
#include "esim_service.h"
#include "asn1_constants.h"
#include "download_profile_config_info_parcel.h"
#include "download_profile_result_parcel.h"
#include "downloadable_profile_parcel.h"
#include "esim_state_type.h"
#include "euicc_info_parcel.h"
#include "esim_service.h"
#include "get_downloadable_profiles_result_parcel.h"
#include "profile_info_list_parcel.h"
#include "profile_metadata_result_parcel.h"
#include "icc_file.h"
#include "request_apdu_build.h"
#include "reset_response.h"
#include "response_esim_result.h"
#include "tel_ril_sim_parcel.h"
namespace OHOS {
@ -46,6 +55,8 @@ constexpr static const int32_t SW1_VALUE_90 = 0x90;
constexpr static const int32_t SW2_VALUE_00 = 0x00;
static std::string ISDR_AID = "A0000005591010FFFFFFFF8900000100";
constexpr static const int32_t ATR_LENGTH = 47;
constexpr static const uint32_t OFFSET_FOUR_BIT = 4;
constexpr static const uint32_t VERSION_NUMBER = 11;
class EsimFile : public IccFile {
public:
explicit EsimFile(std::shared_ptr<SimStateManager> simStateManager);
@ -91,7 +102,7 @@ public:
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 SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile);
ResultState SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname);
ResponseEsimResult ObtainEuiccInfo2(int32_t portIndex);
ResponseEsimResult AuthenticateServer(const AuthenticateConfigInfo &authenticateConfigInfo);
@ -167,7 +178,6 @@ private:
void ConvertPreDownloadParaFromApiStru(PrepareDownloadResp& dst, EsimProfile& src);
bool CombineResponseDataFinish(IccFileData &fileData);
bool ProcessIfNeedMoreResponse(IccFileData &fileData, int32_t eventId);
void createNotification(std::shared_ptr<Asn1Node> &node, EuiccNotification& euicc);
bool ProcessRetrieveNotificationList(
int32_t slotId, Event events, const AppExecFwk::InnerEvent::Pointer &responseEvent);
bool ProcessRetrieveNotificationListDone(const AppExecFwk::InnerEvent::Pointer &event);
@ -208,7 +218,7 @@ private:
private:
std::map<int32_t, FileProcessFunc> memberFuncMap_;
int32_t nextSerialId_ = 0;
std::atomic_int nextSerialId_ = 0;
int32_t currentChannelId_ = -1;
int32_t slotId_ = 0;
EsimProfile esimProfile_;
@ -238,6 +248,7 @@ private:
EuiccNotificationList retrieveNotificationList_;
ResponseEsimResult transApduDataResponse_;
bool isSupported_ = false;
std::string recvCombineStr_ = "";
std::mutex closeChannelMutex_;
std::condition_variable closeChannelCv_;

View File

@ -113,12 +113,11 @@ public:
EuiccNotificationList RetrieveNotificationList(int32_t portIndex, Event events);
EuiccNotification RetrieveNotification(int32_t portIndex, int32_t seqNumber);
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 SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile);
ResultState SetProfileNickname(const std::u16string &iccId, const std::u16string &nickname);
ResponseEsimResult GetEuiccInfo2(int32_t portIndex);
ResponseEsimResult AuthenticateServer(const AuthenticateConfigInfo &authenticateConfigInfo);
#endif
protected:
@ -136,10 +135,6 @@ protected:
IccType iccType_ = IccType::ICC_TYPE_USIM;
std::map<IccType, std::shared_ptr<IccFile>> iccFileCache_;
std::map<IccType, std::shared_ptr<IccFileController>> iccFileControllerCache_;
#ifdef CORE_SERVICE_SUPPORT_ESIM
ResponseEsimResult GetEuiccInfo2(int32_t portIndex);
ResponseEsimResult AuthenticateServer(const AuthenticateConfigInfo &authenticateConfigInfo);
#endif
private:
bool InitDiallingNumberHandler();

View File

@ -190,12 +190,9 @@ public:
int32_t GetEuiccInfo2(int32_t slotId, int32_t portIndex, ResponseEsimResult &responseResult) override;
int32_t AuthenticateServer(int32_t slotId, const AuthenticateConfigInfo &authenticateConfigInfo,
ResponseEsimResult &responseResult) 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;
bool forceDisableProfile, ResultState &enumResult) override;
int32_t SetProfileNickname(
int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, ResultState &enumResult) override;
#endif

View File

@ -41,6 +41,7 @@
#define STK_BIP_CMD_RECEVIE_DATA "42"
#define STK_BIP_CMD_GET_CHANNEL_STATUS "44"
#define STK_BIP_CMD_CLOSE_CHANNEL "41"
#define STK_BIP_CMD_GET_INPUT "23"
namespace OHOS {
namespace Telephony {

View File

@ -401,7 +401,7 @@ bool EsimFile::ProcessObtainEuiccInfo1Done(const AppExecFwk::InnerEvent::Pointer
return false;
}
IccFileData *result = &(rcvMsg->fileData);
eUiccInfo_.response = Str8ToStr16(result->resultData);
eUiccInfo_.response_ = Str8ToStr16(result->resultData);
{
std::lock_guard<std::mutex> lock(euiccInfo1Mutex_);
isEuiccInfo1Ready_ = true;
@ -424,7 +424,7 @@ bool EsimFile::ObtainEuiccInfo1ParseTagCtx2(std::shared_ptr<Asn1Node> &root)
TELEPHONY_LOGE("invalid SVN data");
return false;
}
eUiccInfo_.osVersion = OHOS::Telephony::ToUtf16(MakeVersionString(svnRaw));
eUiccInfo_.osVersion_ = OHOS::Telephony::ToUtf16(MakeVersionString(svnRaw));
return true;
}
@ -469,9 +469,9 @@ bool EsimFile::RequestAllProfilesParseProfileInfo(std::shared_ptr<Asn1Node> &roo
BuildBasicProfileInfo(&euiccProfileInfo, curNode);
EuiccProfile euiccProfile;
ConvertProfileInfoToApiStruct(euiccProfile, euiccProfileInfo);
euiccProfileInfoList_.profiles.push_back(euiccProfile);
euiccProfileInfoList_.profiles_.push_back(euiccProfile);
}
euiccProfileInfoList_.result = ResultState::RESULT_OK;
euiccProfileInfoList_.result_ = ResultState::RESULT_OK;
return true;
}
@ -498,29 +498,29 @@ bool EsimFile::SplitMccAndMnc(const std::string mccMnc, std::string &mcc, std::s
void EsimFile::ConvertProfileInfoToApiStruct(EuiccProfile &dst, EuiccProfileInfo &src)
{
dst.iccId = OHOS::Telephony::ToUtf16(src.iccid);
dst.nickName = OHOS::Telephony::ToUtf16(src.nickname);
dst.serviceProviderName = OHOS::Telephony::ToUtf16(src.serviceProviderName);
dst.profileName = OHOS::Telephony::ToUtf16(src.profileName);
dst.state = static_cast<ProfileState>(src.profileState);
dst.profileClass = static_cast<ProfileClass>(src.profileClass);
dst.policyRules = static_cast<PolicyRules>(src.policyRules);
dst.iccId_ = OHOS::Telephony::ToUtf16(src.iccid);
dst.nickName_ = OHOS::Telephony::ToUtf16(src.nickname);
dst.serviceProviderName_ = OHOS::Telephony::ToUtf16(src.serviceProviderName);
dst.profileName_ = OHOS::Telephony::ToUtf16(src.profileName);
dst.state_ = static_cast<ProfileState>(src.profileState);
dst.profileClass_ = static_cast<ProfileClass>(src.profileClass);
dst.policyRules_ = static_cast<PolicyRules>(src.policyRules);
// split mccMnc to mcc and mnc
std::string mcc = "";
std::string mnc = "";
SplitMccAndMnc(src.operatorId.mccMnc, mcc, mnc);
dst.carrierId.mcc = OHOS::Telephony::ToUtf16(mcc);
dst.carrierId.mnc = OHOS::Telephony::ToUtf16(mnc);
dst.carrierId.gid1 = OHOS::Telephony::ToUtf16(src.operatorId.gid1);
dst.carrierId.gid2 = OHOS::Telephony::ToUtf16(src.operatorId.gid2);
dst.accessRules.clear();
dst.carrierId_.mcc_ = OHOS::Telephony::ToUtf16(mcc);
dst.carrierId_.mnc_ = OHOS::Telephony::ToUtf16(mnc);
dst.carrierId_.gid1_ = OHOS::Telephony::ToUtf16(src.operatorId.gid1);
dst.carrierId_.gid2_ = OHOS::Telephony::ToUtf16(src.operatorId.gid2);
dst.accessRules_.clear();
}
void EsimFile::BuildBasicProfileInfo(EuiccProfileInfo *eProfileInfo, std::shared_ptr<Asn1Node> &profileNode)
{
if (eProfileInfo == nullptr || profileNode == nullptr) {
TELEPHONY_LOGE("BuildProfile failed");
TELEPHONY_LOGE("BuildBasicProfileInfo failed");
return;
}
std::shared_ptr<Asn1Node> iccIdNode = profileNode->Asn1GetChild(TAG_ESIM_ICCID);
@ -566,7 +566,7 @@ void EsimFile::BuildBasicProfileInfo(EuiccProfileInfo *eProfileInfo, std::shared
void EsimFile::BuildAdvancedProfileInfo(EuiccProfileInfo *eProfileInfo, std::shared_ptr<Asn1Node> &profileNode)
{
if (eProfileInfo == nullptr || profileNode == nullptr) {
TELEPHONY_LOGE("BuildProfile failed");
TELEPHONY_LOGE("BuildAdvancedProfileInfo failed");
return;
}
if (profileNode->Asn1HasChild(TAG_ESIM_PROFILE_STATE)) {
@ -880,11 +880,11 @@ struct CarrierIdentifier CarrierIdentifiers(const std::vector<uint8_t> &mccMncDa
if (strResult[NUMBER_TWO] != 'F') {
mMnc[NUMBER_TWO] = strResult[NUMBER_TWO];
}
struct CarrierIdentifier carrierId;
carrierId.mcc = OHOS::Telephony::ToUtf16(mMcc);
carrierId.mnc = OHOS::Telephony::ToUtf16(mMnc);
carrierId.gid1 = gid1;
carrierId.gid2 = gid2;
CarrierIdentifier carrierId;
carrierId.mcc_ = OHOS::Telephony::ToUtf16(mMcc);
carrierId.mnc_ = OHOS::Telephony::ToUtf16(mMnc);
carrierId.gid1_ = gid1;
carrierId.gid2_ = gid2;
return carrierId;
}
@ -949,7 +949,7 @@ bool EsimFile::RequestRulesAuthTableParseTagCtxComp0(std::shared_ptr<Asn1Node> &
if (curNode == nullptr) {
return false;
}
eUiccRulesAuthTable_.carrierIds.push_back(buildCarrierIdentifiers(curNode));
eUiccRulesAuthTable_.carrierIds_.push_back(buildCarrierIdentifiers(curNode));
}
grandson = node->Asn1GetGrandson(TAG_ESIM_SEQUENCE, TAG_ESIM_CTX_0);
if (grandson == nullptr) {
@ -961,8 +961,8 @@ bool EsimFile::RequestRulesAuthTableParseTagCtxComp0(std::shared_ptr<Asn1Node> &
return false;
}
int32_t policyRuleFlags = grandson->Asn1AsInteger();
eUiccRulesAuthTable_.policyRules.push_back(policyRules);
eUiccRulesAuthTable_.policyRuleFlags.push_back(policyRuleFlags);
eUiccRulesAuthTable_.policyRules_.push_back(policyRules);
eUiccRulesAuthTable_.policyRuleFlags_.push_back(policyRuleFlags);
}
return true;
}
@ -1005,8 +1005,8 @@ bool EsimFile::ProcessObtainEuiccChallengeDone(const AppExecFwk::InnerEvent::Poi
return false;
}
std::string resultStr = Asn1Utils::BytesToHexStr(profileResponseByte);
responseChallengeResult_.resultCode = ResultState::RESULT_OK;
responseChallengeResult_.response = OHOS::Telephony::ToUtf16(resultStr);
responseChallengeResult_.resultCode_ = ResultState::RESULT_OK;
responseChallengeResult_.response_ = OHOS::Telephony::ToUtf16(resultStr);
{
std::lock_guard<std::mutex> lock(euiccChallengeMutex_);
isEuiccChallengeReady_ = true;
@ -1164,7 +1164,7 @@ bool EsimFile::ProcessCancelSession(int32_t slotId, const AppExecFwk::InnerEvent
std::string transactionIdStr = Str16ToStr8(esimProfile_.transactionId);
std::vector<uint8_t> transactionIdByte = Asn1Utils::HexStrToBytes(transactionIdStr);
builder->Asn1AddChildAsBytes(TAG_ESIM_CTX_0, transactionIdByte, transactionIdByte.size());
builder->Asn1AddChildAsInteger(TAG_ESIM_CTX_1, static_cast<uint32_t>(profile->cancelReason));
builder->Asn1AddChildAsInteger(TAG_ESIM_CTX_1, static_cast<uint32_t>(esimProfile_.cancelReason));
ApduSimIORequestInfo reqInfo;
CommBuildOneApduReqInfo(reqInfo, builder);
if (telRilManager_ == nullptr) {
@ -1218,8 +1218,8 @@ bool EsimFile::ProcessCancelSessionDone(const AppExecFwk::InnerEvent::Pointer &e
if (byteLen == 0) {
return false;
}
cancelSessionResult_.resultCode = ResultState::RESULT_OK;
cancelSessionResult_.response = OHOS::Telephony::ToUtf16(responseResult);
cancelSessionResult_.resultCode_ = ResultState::RESULT_OK;
cancelSessionResult_.response_ = OHOS::Telephony::ToUtf16(responseResult);
{
std::lock_guard<std::mutex> lock(cancelSessionMutex_);
isCancelSessionReady_ = true;
@ -1241,7 +1241,7 @@ bool EsimFile::GetProfileDoneParseProfileInfo(std::shared_ptr<Asn1Node> &root)
return false;
}
EuiccProfileInfo euiccProfileInfo = {{0}};
BuildProfile(&euiccProfileInfo, profileInfo);
BuildBasicProfileInfo(&euiccProfileInfo, profileInfo);
ConvertProfileInfoToApiStruct(eUiccProfile_, euiccProfileInfo);
return true;
}
@ -1519,8 +1519,8 @@ bool EsimFile::ProcessSendApduDataDone(const AppExecFwk::InnerEvent::Pointer &ev
if (result == nullptr) {
return false;
}
transApduDataResponse_.resultCode = ResultState::RESULT_OK;
transApduDataResponse_.response = OHOS::Telephony::ToUtf16(result->resultData);
transApduDataResponse_.resultCode_ = ResultState::RESULT_OK;
transApduDataResponse_.response_ = OHOS::Telephony::ToUtf16(result->resultData);
{
std::lock_guard<std::mutex> lock(sendApduDataMutex_);
@ -1532,11 +1532,11 @@ bool EsimFile::ProcessSendApduDataDone(const AppExecFwk::InnerEvent::Pointer &ev
ResponseEsimResult EsimFile::ObtainPrepareDownload(const DownLoadConfigInfo &downLoadConfigInfo)
{
esimProfile_.portIndex = downLoadConfigInfo.portIndex;
esimProfile_.hashCc = downLoadConfigInfo.hashCc;
esimProfile_.smdpSigned2 = downLoadConfigInfo.smdpSigned2;
esimProfile_.smdpSignature2 = downLoadConfigInfo.smdpSignature2;
esimProfile_.smdpCertificate = downLoadConfigInfo.smdpCertificate;
esimProfile_.portIndex = downLoadConfigInfo.portIndex_;
esimProfile_.hashCc = downLoadConfigInfo.hashCc_;
esimProfile_.smdpSigned2 = downLoadConfigInfo.smdpSigned2_;
esimProfile_.smdpSignature2 = downLoadConfigInfo.smdpSignature2_;
esimProfile_.smdpCertificate = downLoadConfigInfo.smdpCertificate_;
SyncOpenChannel();
if (!ProcessPrepareDownload(slotId_)) {
TELEPHONY_LOGE("ProcessPrepareDownload encode failed");
@ -1744,10 +1744,10 @@ bool EsimFile::ProcessPrepareDownloadDone(const AppExecFwk::InnerEvent::Pointer
}
}
}
preDownloadResult_.resultCode = ResultState::RESULT_OK;
preDownloadResult_.resultCode_ = ResultState::RESULT_OK;
std::string responseByteStr = Asn1Utils::BytesToString(responseByte);
std::string destString = VCardUtils::EncodeBase64(responseByteStr);
preDownloadResult_.response = OHOS::Telephony::ToUtf16(destString);
preDownloadResult_.response_ = OHOS::Telephony::ToUtf16(destString);
{
std::lock_guard<std::mutex> lock(prepareDownloadMutex_);
isPrepareDownloadReady_ = true;
@ -1911,7 +1911,7 @@ bool EsimFile::RealProcessLoadBoundProfilePackageDone(std::string combineHexStr)
{
std::vector<uint8_t> responseByte = Asn1Utils::HexStrToBytes(combineHexStr);
uint32_t byteLen = responseByte.size();
loadBPPResult_.response = OHOS::Telephony::ToUtf16(combineHexStr);
loadBPPResult_.response_ = OHOS::Telephony::ToUtf16(combineHexStr);
std::shared_ptr<Asn1Node> root = Asn1ParseResponse(responseByte, byteLen);
if (root == nullptr) {
TELEPHONY_LOGE("root is nullptr");
@ -1934,7 +1934,7 @@ bool EsimFile::RealProcessLoadBoundProfilePackageDone(std::string combineHexStr)
loadBppCv_.notify_one();
return false;
}
loadBPPResult_.resultCode = 0;
loadBPPResult_.resultCode_ = 0;
{
std::lock_guard<std::mutex> lock(loadBppMutex_);
isLoadBppReady_ = true;
@ -1951,14 +1951,14 @@ bool EsimFile::LoadBoundProfilePackageParseNotificationMetadata(std::shared_ptr<
}
std::shared_ptr<Asn1Node> sequenceNumberAsn = notificationMetadata->Asn1GetChild(TAG_ESIM_CTX_0);
if (sequenceNumberAsn != nullptr) {
loadBPPResult_.seqNumber = sequenceNumberAsn->Asn1AsInteger();
loadBPPResult_.seqNumber_ = sequenceNumberAsn->Asn1AsInteger();
} else {
TELEPHONY_LOGE("sequenceNumber tag missing");
return false;
}
std::shared_ptr<Asn1Node> profileManagementOpAsn = notificationMetadata->Asn1GetChild(TAG_ESIM_CTX_1);
if (profileManagementOpAsn != nullptr) {
loadBPPResult_.profileManagementOperation = EVENT_INSTALL;
loadBPPResult_.profileManagementOperation_ = EVENT_INSTALL;
} else {
TELEPHONY_LOGE("profileManagementOperation tag missing");
return false;
@ -1968,7 +1968,7 @@ bool EsimFile::LoadBoundProfilePackageParseNotificationMetadata(std::shared_ptr<
std::string hexString;
addressAsn->Asn1AsString(hexString);
std::string address = Asn1Utils::HexStrToString(hexString);
loadBPPResult_.notificationAddress = OHOS::Telephony::ToUtf16(address);
loadBPPResult_.notificationAddress_ = OHOS::Telephony::ToUtf16(address);
} else {
TELEPHONY_LOGE("notificationAddress tag missing");
return false;
@ -1982,7 +1982,7 @@ bool EsimFile::LoadBoundProfilePackageParseNotificationMetadata(std::shared_ptr<
std::string iccString;
uint32_t iccidLen = iccidAsn->Asn1AsBytes(iccid);
Asn1Utils::BchToString(iccid, iccString);
loadBPPResult_.iccId = OHOS::Telephony::ToUtf16(iccString);
loadBPPResult_.iccId_ = OHOS::Telephony::ToUtf16(iccString);
return true;
}
@ -2000,7 +2000,7 @@ std::shared_ptr<Asn1Node> EsimFile::LoadBoundProfilePackageParseProfileInstallRe
std::shared_ptr<Asn1Node> errNode = resultData->Asn1GetGreatGrandson(TAG_ESIM_CTX_COMP_2,
TAG_ESIM_CTX_COMP_1, TAG_ESIM_CTX_1);
if (errNode != nullptr) {
loadBPPResult_.resultCode = errNode->Asn1AsInteger();
loadBPPResult_.resultCode_ = errNode->Asn1AsInteger();
return nullptr;
}
std::shared_ptr<Asn1Node> notificationMetadataAsn = resultData->Asn1GetChild(TAG_ESIM_NOTIFICATION_METADATA);
@ -2063,7 +2063,7 @@ void EsimFile::createNotification(std::shared_ptr<Asn1Node> &node, EuiccNotifica
TELEPHONY_LOGE("nodeSeq is nullptr");
return;
}
euicc.seq = nodeSeq->Asn1AsInteger();
euicc.seq_ = nodeSeq->Asn1AsInteger();
std::shared_ptr<Asn1Node> nodeTargetAddr = metadataNode->Asn1GetChild(TAG_ESIM_TARGET_ADDR);
if (nodeTargetAddr == nullptr) {
@ -2072,18 +2072,18 @@ void EsimFile::createNotification(std::shared_ptr<Asn1Node> &node, EuiccNotifica
}
std::vector<uint8_t> resultStr;
nodeTargetAddr->Asn1AsBytes(resultStr);
euicc.targetAddr = OHOS::Telephony::ToUtf16(Asn1Utils::BytesToString(resultStr));
euicc.targetAddr_ = OHOS::Telephony::ToUtf16(Asn1Utils::BytesToString(resultStr));
std::shared_ptr<Asn1Node> nodeEvent = metadataNode->Asn1GetChild(TAG_ESIM_EVENT);
if (nodeEvent == nullptr) {
TELEPHONY_LOGE("nodeEvent is nullptr");
return;
}
euicc.event = nodeEvent->Asn1AsBits();
euicc.event_ = nodeEvent->Asn1AsBits();
std::string strmData;
node->Asn1NodeToHexStr(strmData);
euicc.data = node->GetNodeTag() == TAG_ESIM_NOTIFICATION_METADATA ? u"" : OHOS::Telephony::ToUtf16(strmData);
euicc.data_ = node->GetNodeTag() == TAG_ESIM_NOTIFICATION_METADATA ? u"" : OHOS::Telephony::ToUtf16(strmData);
}
bool EsimFile::ProcessListNotificationsAsn1Response(std::shared_ptr<Asn1Node> &root)
@ -2109,7 +2109,7 @@ bool EsimFile::ProcessListNotificationsAsn1Response(std::shared_ptr<Asn1Node> &r
curNode = *it;
EuiccNotification euicc;
createNotification(curNode, euicc);
euiccList.euiccNotification.push_back(euicc);
euiccList.euiccNotification_.push_back(euicc);
}
eUiccNotificationList_ = euiccList;
{
@ -2249,56 +2249,6 @@ bool EsimFile::ProcessRetrieveNotificationListDone(const AppExecFwk::InnerEvent:
return true;
}
void EsimFile::createNotification(std::shared_ptr<Asn1Node> &node, EuiccNotification& euicc)
{
if (node == nullptr) {
TELEPHONY_LOGE("createNotification node is nullptr");
return;
}
std::shared_ptr<Asn1Node> metadataNode;
if (node->GetNodeTag() == TAG_ESIM_NOTIFICATION_METADATA) {
metadataNode = node;
} else if (node->GetNodeTag() == TAG_ESIM_PROFILE_INSTALLATION_RESULT) {
std::shared_ptr<Asn1Node> findNode = node->Asn1GetGrandson(TAG_ESIM_PROFILE_INSTALLATION_RESULT_DATA,
TAG_ESIM_NOTIFICATION_METADATA);
metadataNode = findNode;
} else {
// Other signed notification
std::shared_ptr<Asn1Node> findNode = node->Asn1GetChild(TAG_ESIM_NOTIFICATION_METADATA);
metadataNode = findNode;
}
if (metadataNode == nullptr) {
TELEPHONY_LOGE("metadataNode is nullptr");
return;
}
std::shared_ptr<Asn1Node> nodeSeq = metadataNode->Asn1GetChild(TAG_ESIM_SEQ);
if (nodeSeq == nullptr) {
TELEPHONY_LOGE("nodeSeq is nullptr");
return;
}
euicc.seq = nodeSeq->Asn1AsInteger();
std::shared_ptr<Asn1Node> nodeTargetAddr = metadataNode->Asn1GetChild(TAG_ESIM_TARGET_ADDR);
if (nodeTargetAddr == nullptr) {
TELEPHONY_LOGE("nodeTargetAddr is nullptr");
return;
}
std::string strResult;
nodeTargetAddr->Asn1AsString(strResult);
euicc.targetAddr = OHOS::Telephony::ToUtf16(strResult);
std::shared_ptr<Asn1Node> nodeEvent = metadataNode->Asn1GetChild(TAG_ESIM_EVENT);
if (nodeEvent == nullptr) {
TELEPHONY_LOGE("nodeEvent is nullptr");
return;
}
euicc.event = nodeEvent->Asn1AsBits();
std::string strmData;
node->Asn1NodeToHexStr(strmData);
euicc.data = node->GetNodeTag() == TAG_ESIM_NOTIFICATION_METADATA ? u"" : OHOS::Telephony::ToUtf16(strmData);
}
bool EsimFile::RetrieveNotificationParseCompTag(std::shared_ptr<Asn1Node> &root)
{
std::list<std::shared_ptr<Asn1Node>> ls;
@ -2318,7 +2268,7 @@ bool EsimFile::RetrieveNotificationParseCompTag(std::shared_ptr<Asn1Node> &root)
curNode = *it;
EuiccNotification euicc;
createNotification(curNode, euicc);
euiccList.euiccNotification.push_back(euicc);
euiccList.euiccNotification_.push_back(euicc);
}
eUiccNotificationList_ = euiccList;
return true;
@ -2462,11 +2412,11 @@ ResultState EsimFile::DeleteProfile(const std::u16string &iccId)
return delProfile_;
}
ResultState EsimFile::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim)
ResultState EsimFile::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile)
{
esimProfile_.portIndex = portIndex;
esimProfile_.iccId = iccId;
esimProfile_.forceDeactivateSim = forceDeactivateSim;
esimProfile_.forceDisableProfile = forceDisableProfile;
SyncOpenChannel();
AppExecFwk::InnerEvent::Pointer eventSwitchToProfile = BuildCallerInfo(MSG_ESIM_SWITCH_PROFILE);
if (!ProcessSwitchToProfile(slotId_, eventSwitchToProfile)) {
@ -2649,7 +2599,7 @@ bool EsimFile::ProcessSetNicknameDone(const AppExecFwk::InnerEvent::Pointer &eve
TELEPHONY_LOGE("asn1NodeData is nullptr");
return false;
}
updateNicknameResult_ = static_cast<ResultState>(asn1NodeData->Asn1AsInteger());
setNicknameResult_ = static_cast<ResultState>(asn1NodeData->Asn1AsInteger());
{
std::lock_guard<std::mutex> lock(setNicknameMutex_);
isSetNicknameReady_ = true;
@ -2680,12 +2630,12 @@ ResponseEsimResult EsimFile::ObtainEuiccInfo2(int32_t portIndex)
ResponseEsimResult EsimFile::AuthenticateServer(const AuthenticateConfigInfo &authenticateConfigInfo)
{
esimProfile_.portIndex = authenticateConfigInfo.portIndex;
esimProfile_.matchingId = authenticateConfigInfo.matchingId;
esimProfile_.serverSigned1 = authenticateConfigInfo.serverSigned1;
esimProfile_.serverSignature1 = authenticateConfigInfo.serverSignature1;
esimProfile_.euiccCiPkIdToBeUsed = authenticateConfigInfo.euiccCiPkIdToBeUsed;
esimProfile_.serverCertificate = authenticateConfigInfo.serverCertificate;
esimProfile_.portIndex = authenticateConfigInfo.portIndex_;
esimProfile_.matchingId = authenticateConfigInfo.matchingId_;
esimProfile_.serverSigned1 = authenticateConfigInfo.serverSigned1_;
esimProfile_.serverSignature1 = authenticateConfigInfo.serverSignature1_;
esimProfile_.euiccCiPkIdToBeUsed = authenticateConfigInfo.euiccCiPkIdToBeUsed_;
esimProfile_.serverCertificate = authenticateConfigInfo.serverCertificate_;
std::u16string imei = u"";
CoreManagerInner::GetInstance().GetImei(slotId_, imei);
@ -2757,7 +2707,7 @@ bool EsimFile::ProcessAuthenticateServer(int32_t slotId)
Asn1AddChildAsBase64(builder, bytes.euiccCiPKIdToBeUsed);
Asn1AddChildAsBase64(builder, bytes.serverCertificate);
std::shared_ptr<Asn1Builder> ctxParams1Builder = std::make_shared<Asn1Builder>(TAG_ESIM_CTX_COMP_0);
AddCtxParams1(ctxParams1Builder, &bytes);
AddCtxParams1(ctxParams1Builder, bytes);
if (ctxParams1Builder == nullptr) {
TELEPHONY_LOGE("AddCtxParams1 failed");
return false;
@ -2858,18 +2808,18 @@ bool EsimFile::ProcessObtainEuiccInfo2Done(const AppExecFwk::InnerEvent::Pointer
return false;
}
EuiccInfo2 euiccInfo2 = {};
this->EuiccInfo2ParseProfileVersion(&euiccInfo2, root);
this->EuiccInfo2ParseSvn(&euiccInfo2, root);
this->EuiccInfo2ParseEuiccFirmwareVer(&euiccInfo2, root);
this->EuiccInfo2ParseExtCardResource(&euiccInfo2, root);
this->EuiccInfo2ParseUiccCapability(&euiccInfo2, root);
this->EuiccInfo2ParseTs102241Version(&euiccInfo2, root);
this->EuiccInfo2ParseGlobalPlatformVersion(&euiccInfo2, root);
this->EuiccInfo2ParseRspCapability(&euiccInfo2, root);
this->EuiccInfo2ParseEuiccCiPKIdListForVerification(&euiccInfo2, root);
this->EuiccInfo2ParseEuiccCiPKIdListForSigning(&euiccInfo2, root);
this->EuiccInfo2ParseEuiccCategory(&euiccInfo2, root);
this->EuiccInfo2ParsePpVersion(&euiccInfo2, root);
this->EuiccInfo2ParseProfileVersion(euiccInfo2, root);
this->EuiccInfo2ParseSvn(euiccInfo2, root);
this->EuiccInfo2ParseEuiccFirmwareVer(euiccInfo2, root);
this->EuiccInfo2ParseExtCardResource(euiccInfo2, root);
this->EuiccInfo2ParseUiccCapability(euiccInfo2, root);
this->EuiccInfo2ParseTs102241Version(euiccInfo2, root);
this->EuiccInfo2ParseGlobalPlatformVersion(euiccInfo2, root);
this->EuiccInfo2ParseRspCapability(euiccInfo2, root);
this->EuiccInfo2ParseEuiccCiPKIdListForVerification(euiccInfo2, root);
this->EuiccInfo2ParseEuiccCiPKIdListForSigning(euiccInfo2, root);
this->EuiccInfo2ParseEuiccCategory(euiccInfo2, root);
this->EuiccInfo2ParsePpVersion(euiccInfo2, root);
{
std::lock_guard<std::mutex> lock(euiccInfo2Mutex_);
isEuiccInfo2Ready_ = true;
@ -3100,9 +3050,9 @@ bool EsimFile::ProcessAuthenticateServerDone(const AppExecFwk::InnerEvent::Point
void EsimFile::CovertAuthToApiStruct(ResponseEsimResult &dst, AuthServerResponse &src)
{
dst.resultCode = static_cast<ResultState>(src.errCode);
dst.resultCode_ = static_cast<ResultState>(src.errCode);
std::string hexStr = Asn1Utils::BytesToHexStr(src.respStr);
dst.response = OHOS::Telephony::ToUtf16(hexStr);
dst.response_ = OHOS::Telephony::ToUtf16(hexStr);
}
void EsimFile::InitMemberFunc()

View File

@ -1202,13 +1202,13 @@ ResultState SimFileManager::DeleteProfile(const std::u16string &iccId)
return result;
}
ResultState SimFileManager::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim)
ResultState SimFileManager::SwitchToProfile(int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile)
{
if (eSimFile_ == nullptr) {
TELEPHONY_LOGE("esimFile is nullptr");
return ResultState::RESULT_UNDEFINED_ERROR;
}
ResultState result = eSimFile_->SwitchToProfile(portIndex, iccId, forceDeactivateSim);
ResultState result = eSimFile_->SwitchToProfile(portIndex, iccId, forceDisableProfile);
return result;
}

View File

@ -1351,7 +1351,7 @@ int32_t SimManager::CancelSession(
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
responseResult = simFileManager_[slotId]->CancelSession(transactionId, cancelReason);
if (responseResult.resultCode != ResultState::RESULT_OK) {
if (responseResult.resultCode_ != ResultState::RESULT_OK) {
return TELEPHONY_ERR_FAIL;
}
return TELEPHONY_ERR_SUCCESS;
@ -1365,7 +1365,7 @@ int32_t SimManager::GetProfile(
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
eUiccProfile = simFileManager_[slotId]->GetProfile(portIndex, iccId);
if (eUiccProfile.state != ProfileState::PROFILE_STATE_DISABLED) {
if (eUiccProfile.state_ != ProfileState::PROFILE_STATE_DISABLED) {
return TELEPHONY_ERR_FAIL;
}
return TELEPHONY_ERR_SUCCESS;
@ -1489,13 +1489,13 @@ int32_t SimManager::DeleteProfile(int32_t slotId, const std::u16string &iccId, R
}
int32_t SimManager::SwitchToProfile(
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult)
int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool forceDisableProfile, 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);
enumResult = simFileManager_[slotId]->SwitchToProfile(portIndex, iccId, forceDisableProfile);
return TELEPHONY_ERR_SUCCESS;
}

View File

@ -349,7 +349,7 @@ bool StkController::CheckIsBipCmd(const std::string &cmdData)
std::string commandType = cmdData.substr(typeOffset, STK_CMD_TYPE_LEN);
if (commandType == STK_BIP_CMD_OPEN_CHANNEL || commandType == STK_BIP_CMD_SEND_DATA ||
commandType == STK_BIP_CMD_RECEVIE_DATA || commandType == STK_BIP_CMD_GET_CHANNEL_STATUS ||
commandType == STK_BIP_CMD_CLOSE_CHANNEL) {
commandType == STK_BIP_CMD_CLOSE_CHANNEL || commandType == STK_BIP_CMD_GET_INPUT) {
if (TELEPHONY_EXT_WRAPPER.sendEvent_ &&
TELEPHONY_EXT_WRAPPER.sendEvent_(std::make_shared<std::string>(cmdData), slotId_)) {
TELEPHONY_LOGE("StkController slotId_ [%{public}d] ", slotId_);

View File

@ -289,11 +289,11 @@ HWTEST_F(EsimCoreServiceClientBranchTest, SwitchToProfile_0100, Function | Mediu
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = true;
ResultState SwitchProfileResult;
EXPECT_CALL(*samgr, CheckSystemAbility(testing::_)).WillOnce(testing::Return(nullptr));
int32_t result = CoreServiceClient::GetInstance().SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
slotId, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}

View File

@ -255,10 +255,10 @@ HWTEST_F(EsimCoreServiceClientTest, SwitchToProfile_0001, Function | MediumTest
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = true;
ResultState SwitchProfileResult;
int32_t result = CoreServiceClient::GetInstance().SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
slotId, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_NE(result, TELEPHONY_SUCCESS);
}

View File

@ -816,9 +816,9 @@ HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_001, Function | MediumTest |
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = true;
ResultState SwitchProfileResult;
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
@ -829,10 +829,10 @@ HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_002, Function | MediumTest |
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = 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);
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
@ -843,10 +843,10 @@ HWTEST_F(EsimCoreServiceProxyTest, SwitchToProfile_003, Function | MediumTest |
int32_t portIndex = 0;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = 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);
int32_t ret = proxy.SwitchToProfile(SLOT_ID, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(ret, 0);
}

View File

@ -366,14 +366,14 @@ HWTEST_F(EsimCoreServiceTest, SwitchToProfile_0001, Function | MediumTest | Leve
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = true;
ResultState switchProfileResult;
EXPECT_NE(mCoreService->SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, switchProfileResult), TELEPHONY_ERR_SUCCESS);
slotId, portIndex, iccId, forceDisableProfile, switchProfileResult), TELEPHONY_ERR_SUCCESS);
mCoreService->simManager_ = nullptr;
EXPECT_EQ(mCoreService->SwitchToProfile(
slotId, portIndex, iccId, forceDeactivateSim, switchProfileResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
slotId, portIndex, iccId, forceDisableProfile, switchProfileResult), TELEPHONY_ERR_LOCAL_PTR_NULL);
}
HWTEST_F(EsimCoreServiceTest, SetProfileNickname_0001, Function | MediumTest | Level1)

View File

@ -203,7 +203,7 @@ HWTEST_F(EsimFileManagerTest, CancelSession_001, Function | MediumTest | Level2)
std::weak_ptr<SimStateManager>(simStateManager) };
simFileManager.eSimFile_ = std::make_shared<EsimFile>(simStateManager);
std::u16string transactionId = u"";
CancelReason cancelReason = CancelReason::CANCEL_REASON_END_USER_REJECTED;
CancelReason cancelReason = CancelReason::CANCEL_REASON_END_USER_REJECTION;
ResponseEsimResult res = simFileManager.CancelSession(transactionId, cancelReason);
EXPECT_EQ(res.resultCode, ResultState::RESULT_OK);
simFileManager.eSimFile_ = nullptr;
@ -461,11 +461,11 @@ HWTEST_F(EsimFileManagerTest, SwitchToProfile_001, Function | MediumTest | Level
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);
bool forceDisableProfile = false;
ResultState res = simFileManager.SwitchToProfile(portIndex, iccId, forceDisableProfile);
EXPECT_NE(res, ResultState::RESULT_UNDEFINED_ERROR);
simFileManager.eSimFile_ = nullptr;
res = simFileManager.SwitchToProfile(portIndex, iccId, forceDeactivateSim);
res = simFileManager.SwitchToProfile(portIndex, iccId, forceDisableProfile);
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}

View File

@ -612,18 +612,18 @@ HWTEST_F(EsimManagerTest, SwitchToProfile, Function | MediumTest | Level1)
int32_t slotId = 0;
int32_t portIndex = 1;
std::u16string iccId = Str8ToStr16("98760000000000543210");
bool forceDeactivateSim = true;
bool forceDisableProfile = 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);
int32_t ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, 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);
ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
EventFwk::CommonEventSubscribeInfo sp;
@ -633,7 +633,7 @@ HWTEST_F(EsimManagerTest, SwitchToProfile, Function | MediumTest | Level1)
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);
ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, SwitchProfileResult);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
}

View File

@ -89,26 +89,26 @@ HWTEST_F(EsimServiceClientBranchTest, GetDownloadableProfileMetadata_0001, Funct
{
int32_t portIndex = 0;
DownloadableProfile profile;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
GetDownloadableProfileMetadataResult profileMetadataResult;
EXPECT_CALL(*samgr, LoadSystemAbility(testing::_,
testing::A<const sptr<ISystemAbilityLoadCallback>&>())).WillOnce(testing::Return(-1));
int32_t result = EsimServiceClient::GetInstance().GetDownloadableProfileMetadata(
SLOT_ID, portIndex, profile, forceDeactivateSim, profileMetadataResult);
SLOT_ID, portIndex, profile, forceDisableProfile, profileMetadataResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
HWTEST_F(EsimServiceClientBranchTest, GetDownloadableProfiles_0001, Function | MediumTest | Level1)
{
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
int32_t portIndex = 0;
GetDownloadableProfilesResult profileListResult;
EXPECT_CALL(*samgr, LoadSystemAbility(testing::_,
testing::A<const sptr<ISystemAbilityLoadCallback>&>())).WillOnce(testing::Return(-1));
int32_t result = EsimServiceClient::GetInstance().GetDownloadableProfiles(
SLOT_ID, portIndex, forceDeactivateSim, profileListResult);
SLOT_ID, portIndex, forceDisableProfile, profileListResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}
@ -160,13 +160,13 @@ HWTEST_F(EsimServiceClientBranchTest, SwitchToProfile_0001, Function | MediumTes
{
int32_t portIndex = 0;
std::string iccId = "98760000000000543210";
bool forceDeactivateSim = true;
bool forceDisableProfile = true;
int32_t switchToProfileResult;
EXPECT_CALL(*samgr, LoadSystemAbility(testing::_,
testing::A<const sptr<ISystemAbilityLoadCallback>&>())).WillOnce(testing::Return(-1));
int32_t result = EsimServiceClient::GetInstance().SwitchToProfile(
SLOT_ID, portIndex, iccId, forceDeactivateSim, switchToProfileResult);
SLOT_ID, portIndex, iccId, forceDisableProfile, switchToProfileResult);
EXPECT_EQ(result, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
}

View File

@ -1637,17 +1637,17 @@ HWTEST_F(EsimTest, SwitchToProfile_001, Function | MediumTest | Level2)
int32_t portIndex = 0;
std::u16string iccId;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
ResultState switchResult_ = ResultState::RESULT_UNDEFINED_ERROR;
esimFile->currentChannelId_ = 0;
EXPECT_NE(switchResult_, esimFile->SwitchToProfile(portIndex, iccId, forceDeactivateSim));
EXPECT_NE(switchResult_, esimFile->SwitchToProfile(portIndex, iccId, forceDisableProfile));
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));
EXPECT_NE(switchResult_, esimFile->SwitchToProfile(portIndex, iccId, forceDisableProfile));
}
HWTEST_F(EsimTest, SetProfileNickname_001, Function | MediumTest | Level2)
@ -1882,6 +1882,8 @@ HWTEST_F(EsimTest, ConvertAuthInputParaFromApiStru_001, Function | MediumTest |
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);
Es9PlusInitAuthResp bytes;
esimFile->ConvertAuthInputParaFromApiStru(bytes, esimFile->esimProfile_);
bool bRet = bytes.imei.empty() ? false : true;
EXPECT_TRUE(bRet);
}
HWTEST_F(EsimTest, ObtainEuiccInfo2_001, Function | MediumTest | Level2)
@ -1931,6 +1933,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseProfileVersion_001, Function | MediumTest | Le
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseProfileVersion(euiccInfo2, root);
bool bRet = euiccInfo2->profileVersion.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -1946,6 +1950,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseEuiccFirmwareVer_001, Function | MediumTest |
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseEuiccFirmwareVer(euiccInfo2, root);
bool bRet = euiccInfo2->globalPlatformVersion.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -1961,6 +1967,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseExtCardResource_001, Function | MediumTest | L
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseExtCardResource(euiccInfo2, root);
bool bRet = euiccInfo2->extCardResource.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -1976,6 +1984,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseUiccCapability_001, Function | MediumTest | Le
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseUiccCapability(euiccInfo2, root);
bool bRet = euiccInfo2->uiccCapability.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -1991,6 +2001,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseTs102241Version_001, Function | MediumTest | L
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseTs102241Version(euiccInfo2, root);
bool bRet = euiccInfo2->ts102241Version.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2006,6 +2018,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseGlobalPlatformVersion_001, Function | MediumTe
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseGlobalPlatformVersion(euiccInfo2, root);
bool bRet = euiccInfo2->globalPlatformVersion.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2021,6 +2035,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseRspCapability_001, Function | MediumTest | Lev
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseRspCapability(euiccInfo2, root);
bool bRet = euiccInfo2->rspCapability.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2036,6 +2052,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseEuiccCiPKIdListForVerification_001, Function |
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseEuiccCiPKIdListForVerification(euiccInfo2, root);
bool bRet = euiccInfo2->euiccCiPKIdListForVerification.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2051,6 +2069,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseEuiccCiPKIdListForSigning_001, Function | Medi
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseEuiccCiPKIdListForSigning(euiccInfo2, root);
bool bRet = euiccInfo2->euiccCiPKIdListForSigning.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2066,6 +2086,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParseEuiccCategory_001, Function | MediumTest | Lev
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParseEuiccCategory(euiccInfo2, root);
bool bRet = euiccInfo2->euiccCategory == 0 ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}
@ -2081,6 +2103,8 @@ HWTEST_F(EsimTest, EuiccInfo2ParsePpVersion_001, Function | MediumTest | Level2)
int32_t byteLen = responseByte.length();
std::shared_ptr<Asn1Node> root = esimFile->Asn1ParseResponse(responseByte, byteLen);
esimFile->EuiccInfo2ParsePpVersion(euiccInfo2, root);
bool bRet = euiccInfo2->ppVersion.empty() ? false : true;
EXPECT_TRUE(bRet);
delete (euiccInfo2);
}

View File

@ -559,7 +559,7 @@ public:
}
int32_t SwitchToProfile(int32_t slotId, int32_t portIndex,
const std::u16string &iccId, bool forceDeactivateSim, ResultState &enumResult) override
const std::u16string &iccId, bool forceDisableProfile, ResultState &enumResult) override
{
return 0;
}

View File

@ -302,8 +302,8 @@ uint32_t Asn1Node::Asn1AsString(std::string &output)
return hexStrLen;
}
std::string hexStr = Asn1Utils::BytesToHexStr(dataBytes_);
output = hexStr;
return static_cast<uint32_t>(hexStr.length());
output = Asn1Utils::HexStrToString(hexStr);
return static_cast<uint32_t>(Asn1Utils::HexStrToString(hexStr).length());
}
int32_t Asn1Node::Asn1AsBits()

View File

@ -122,7 +122,7 @@ typedef struct TagEsimProfile {
std::u16string smdpCertificate = u"";
int32_t seqNumber = 0;
bool activeAfterDown = false;
bool forceDeactivateSim = false;
bool forceDisableProfile = false;
OHOS::Telephony::ResetOption option = OHOS::Telephony::ResetOption::DELETE_OPERATIONAL_PROFILES;
std::u16string transactionId = u"";
OHOS::Telephony::CancelReason cancelReason = OHOS::Telephony::CancelReason::CANCEL_REASON_POSTPONED;
@ -152,7 +152,7 @@ typedef struct TagEs9PlusInitAuthResp {
typedef struct TagAuthServerResponse {
int32_t errCode = 0;
std::string transactionId;
std::string respStr;
std::vector<uint8_t> respStr;
int32_t respLength = 0;
} AuthServerResponse;