diff --git a/frameworks/inner_api/security_component/include/sec_comp_client.h b/frameworks/inner_api/security_component/include/sec_comp_client.h index 134c2dd5b2792f2b3297fed101dd158be3f427f7..e4c91c4ac5d47255eeb8c4525a1970bbb0e88265 100644 --- a/frameworks/inner_api/security_component/include/sec_comp_client.h +++ b/frameworks/inner_api/security_component/include/sec_comp_client.h @@ -63,9 +63,6 @@ private: bool readyFlag_ = false; std::condition_variable secComCon_; std::mutex proxyMutex_; - bool secCompSAFlag_ = false; - std::condition_variable secCompSACon_; - std::mutex secCompSAMutex_; sptr proxy_ = nullptr; sptr serviceDeathObserver_ = nullptr; }; diff --git a/frameworks/inner_api/security_component/src/sec_comp_client.cpp b/frameworks/inner_api/security_component/src/sec_comp_client.cpp index 2f5ae804eca85382b912815c479b7c0a5af7cbac..b7815d69d653ee05e876ad12be77e61be8e4f140 100644 --- a/frameworks/inner_api/security_component/src/sec_comp_client.cpp +++ b/frameworks/inner_api/security_component/src/sec_comp_client.cpp @@ -19,10 +19,7 @@ #include "sec_comp_load_callback.h" #include "sec_comp_log.h" #include "sec_comp_proxy.h" -#include "sys_binder.h" #include "tokenid_kit.h" -#include -#include namespace OHOS { namespace Security { @@ -30,10 +27,6 @@ namespace SecurityComponent { namespace { static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN_SECURITY_COMPONENT, "SecCompClient"}; static std::mutex g_instanceMutex; -static constexpr int32_t SENDREQ_FAIL_ERR = 32; -static const std::vector RETRY_CODE_LIST = { - SC_SERVICE_ERROR_SERVICE_NOT_EXIST, BR_DEAD_REPLY, BR_FAILED_REPLY, SENDREQ_FAIL_ERR }; -static const int32_t SA_DIED_TIME_OUT = 500; } // namespace SecCompClient& SecCompClient::GetInstance() @@ -71,17 +64,7 @@ int32_t SecCompClient::RegisterSecurityComponent(SecCompType type, return SC_SERVICE_ERROR_VALUE_INVALID; } - auto res = proxy->RegisterSecurityComponent(type, componentInfo, scId); - if (std::find(RETRY_CODE_LIST.begin(), RETRY_CODE_LIST.end(), res) != RETRY_CODE_LIST.end()) { - std::unique_lock lock(secCompSAMutex_); - auto waitStatus = secCompSACon_.wait_for(lock, std::chrono::milliseconds(SA_DIED_TIME_OUT), - [this]() { return secCompSAFlag_; }); - if (waitStatus) { - proxy = GetProxy(true); - return proxy->RegisterSecurityComponent(type, componentInfo, scId); - } - } - return res; + return proxy->RegisterSecurityComponent(type, componentInfo, scId); } int32_t SecCompClient::UpdateSecurityComponent(int32_t scId, const std::string& componentInfo) @@ -254,21 +237,12 @@ void SecCompClient::OnRemoteDiedHandle() { SC_LOG_ERROR(LABEL, "Remote service died"); std::unique_lock lock(proxyMutex_); - auto remoteObj = proxy_->AsObject(); - if ((remoteObj != nullptr) && (serviceDeathObserver_ != nullptr)) { - remoteObj->RemoveDeathRecipient(serviceDeathObserver_); - } proxy_ = nullptr; serviceDeathObserver_ = nullptr; { std::unique_lock lock1(cvLock_); readyFlag_ = false; } - { - std::unique_lock lock1(secCompSAMutex_); - secCompSAFlag_ = true; - secCompSACon_.notify_one(); - } } void SecCompClient::GetProxyFromRemoteObject(const sptr& remoteObject) diff --git a/frameworks/inner_api/security_component/src/sec_comp_proxy.cpp b/frameworks/inner_api/security_component/src/sec_comp_proxy.cpp index f8a897c5b37ab079506f89296e4bb295af54c484..7cd7798fd80ca77e66ee4a6d3886614d41a6e008 100644 --- a/frameworks/inner_api/security_component/src/sec_comp_proxy.cpp +++ b/frameworks/inner_api/security_component/src/sec_comp_proxy.cpp @@ -70,16 +70,17 @@ int32_t SecCompProxy::RegisterSecurityComponent(SecCompType type, int32_t requestResult = remote->SendRequest( static_cast(SecurityComponentServiceInterfaceCode::REGISTER_SECURITY_COMPONENT), data, reply, option); - if (requestResult != SC_OK) { - SC_LOG_ERROR(LABEL, "Register request failed, result: %{public}d.", requestResult); - return requestResult; - } if (!SecCompEnhanceAdapter::EnhanceClientDeserialize(reply, deserializedReply)) { SC_LOG_ERROR(LABEL, "Register deserialize session info failed."); return SC_SERVICE_ERROR_PARCEL_OPERATE_FAIL; } + if (requestResult != SC_OK) { + SC_LOG_ERROR(LABEL, "Register request failed, result: %{public}d.", requestResult); + return requestResult; + } + int32_t res; if (!deserializedReply.ReadInt32(res)) { SC_LOG_ERROR(LABEL, "Register read res failed."); diff --git a/services/security_component_service/sa/sa_main/sec_comp_stub.cpp b/services/security_component_service/sa/sa_main/sec_comp_stub.cpp index c3111f1834fadd84433b86f5c307d7dd1fd85bbe..198b0876d395562fc118c2a9764d5f4760cef696 100644 --- a/services/security_component_service/sa/sa_main/sec_comp_stub.cpp +++ b/services/security_component_service/sa/sa_main/sec_comp_stub.cpp @@ -15,7 +15,6 @@ #include "sec_comp_stub.h" #include "accesstoken_kit.h" -#include "delay_exit_task.h" #include "ipc_skeleton.h" #include "sec_comp_click_event_parcel.h" #include "sec_comp_enhance_adapter.h" @@ -53,7 +52,6 @@ int32_t SecCompStub::OnRemoteRequest( int32_t SecCompStub::RegisterSecurityComponentInner(MessageParcel& data, MessageParcel& reply) { - SecurityComponent::DelayExitTask::GetInstance().Stop(); MessageParcel deserializedData; if (!SecCompEnhanceAdapter::EnhanceSrvDeserialize(data, deserializedData, reply)) { SC_LOG_ERROR(LABEL, "Register deserialize session info failed");