From ea7062b6af9a24790be6b98092632f49e58b370a Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:19:27 +0000 Subject: [PATCH 01/15] update services/drm_service/server/src/drm_host_manager.cpp. Signed-off-by: baoxy92 --- services/drm_service/server/src/drm_host_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/drm_service/server/src/drm_host_manager.cpp b/services/drm_service/server/src/drm_host_manager.cpp index bdd0aa26..e3ae4855 100644 --- a/services/drm_service/server/src/drm_host_manager.cpp +++ b/services/drm_service/server/src/drm_host_manager.cpp @@ -462,6 +462,7 @@ void DrmHostManager::ReleaseSevices(sptr drmHostServiePr remote->RemoveDeathRecipient(drmHostDeathRecipientMap[drmHostServieProxy]); drmHostDeathRecipientMap[drmHostServieProxy] = nullptr; } + drmHostDeathRecipientMap.erase(drmHostServieProxy); std::string name = hdiMediaKeySystemFactoryAndPluginNameMap[drmHostServieProxy]; /* No need to release non lazy loading */ if (lazyLoadPluginInfoMap.count(name) <= 0) { From 620a35c571cd4cf36693b9612d2a9fd5f4723c69 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:37:35 +0000 Subject: [PATCH 02/15] update frameworks/native/drm/key_session_impl.cpp. Signed-off-by: baoxy92 --- frameworks/native/drm/key_session_impl.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/frameworks/native/drm/key_session_impl.cpp b/frameworks/native/drm/key_session_impl.cpp index 83fb8a35..b4ac38ad 100644 --- a/frameworks/native/drm/key_session_impl.cpp +++ b/frameworks/native/drm/key_session_impl.cpp @@ -39,24 +39,6 @@ MediaKeySessionImpl::MediaKeySessionImpl(sptr &keySessi DRM_ERR_LOG("failed to add deathRecipient"); return; } - - CreateListenerObject(); -} - -int32_t MediaKeySessionImpl::CreateListenerObject() -{ - DRM_INFO_LOG("CreateListenerObject"); - std::lock_guard lock(mutex_); - listenerStub_ = new(std::nothrow) DrmListenerStub(); - DRM_CHECK_AND_RETURN_RET_LOG(listenerStub_ != nullptr, DRM_MEMORY_ERROR, - "failed to new DrmListenerStub object"); - DRM_CHECK_AND_RETURN_RET_LOG(keySessionServiceProxy_ != nullptr, DRM_MEMORY_ERROR, - "Drm service does not exist."); - - sptr object = listenerStub_->AsObject(); - DRM_CHECK_AND_RETURN_RET_LOG(object != nullptr, DRM_MEMORY_ERROR, "listener object is nullptr."); - - return keySessionServiceProxy_->SetListenerObject(object); } MediaKeySessionImpl::~MediaKeySessionImpl() From 7a3876f5a339efe3649bfa6af94354591b0303a2 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:38:19 +0000 Subject: [PATCH 03/15] update frameworks/native/drm/media_key_system_impl.cpp. Signed-off-by: baoxy92 --- .../native/drm/media_key_system_impl.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/frameworks/native/drm/media_key_system_impl.cpp b/frameworks/native/drm/media_key_system_impl.cpp index 490c494b..d4bfe694 100644 --- a/frameworks/native/drm/media_key_system_impl.cpp +++ b/frameworks/native/drm/media_key_system_impl.cpp @@ -39,8 +39,6 @@ MediaKeySystemImpl::MediaKeySystemImpl(sptr &mediaKeysys DRM_ERR_LOG("failed to add deathRecipient"); return; } - - CreateListenerObject(); } MediaKeySystemImpl::~MediaKeySystemImpl() @@ -61,22 +59,6 @@ void MediaKeySystemImpl::MediaKeySystemServerDied(pid_t pid) listenerStub_ = nullptr; } -int32_t MediaKeySystemImpl::CreateListenerObject() -{ - DRM_INFO_LOG("CreateListenerObject"); - std::lock_guard lock(mutex_); - listenerStub_ = new(std::nothrow) DrmListenerStub(); - DRM_CHECK_AND_RETURN_RET_LOG(listenerStub_ != nullptr, DRM_MEMORY_ERROR, - "failed to new DrmListenerStub object"); - DRM_CHECK_AND_RETURN_RET_LOG(serviceProxy_ != nullptr, DRM_MEMORY_ERROR, - "Drm service does not exist."); - - sptr object = listenerStub_->AsObject(); - DRM_CHECK_AND_RETURN_RET_LOG(object != nullptr, DRM_MEMORY_ERROR, "listener object is nullptr."); - - return serviceProxy_->SetListenerObject(object); -} - int32_t MediaKeySystemImpl::Release() { DRM_INFO_LOG("Release enter."); From e3b5f9cfade2a2907467f5e0a84c1b35306deaf6 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:38:47 +0000 Subject: [PATCH 04/15] update interfaces/inner_api/native/drm/key_session_impl.h. Signed-off-by: baoxy92 --- interfaces/inner_api/native/drm/key_session_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/native/drm/key_session_impl.h b/interfaces/inner_api/native/drm/key_session_impl.h index ed5b3258..e6d9434e 100644 --- a/interfaces/inner_api/native/drm/key_session_impl.h +++ b/interfaces/inner_api/native/drm/key_session_impl.h @@ -72,7 +72,6 @@ public: int32_t RequireSecureDecoderModule(std::string &mimeType, bool *status); private: - int32_t CreateListenerObject(); void MediaKeySessionServerDied(pid_t pid); sptr keySessionApplicationCallback_; sptr keySessionServiceCallback_; From 7114f98875bc9a96b81132ad2d208b9b489238f8 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:38:53 +0000 Subject: [PATCH 05/15] update interfaces/inner_api/native/drm/media_key_system_impl.h. Signed-off-by: baoxy92 --- interfaces/inner_api/native/drm/media_key_system_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/native/drm/media_key_system_impl.h b/interfaces/inner_api/native/drm/media_key_system_impl.h index 926e5b62..f15977b0 100644 --- a/interfaces/inner_api/native/drm/media_key_system_impl.h +++ b/interfaces/inner_api/native/drm/media_key_system_impl.h @@ -68,7 +68,6 @@ public: private: void MediaKeySystemServerDied(pid_t pid); - int32_t CreateListenerObject(); std::recursive_mutex mutex_; sptr serviceProxy_; sptr mediaKeySystemApplicationCallback_; From c29312a2810822009bc27837548451079846c591 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:41:37 +0000 Subject: [PATCH 06/15] update frameworks/native/drm/key_session_impl.cpp. Signed-off-by: baoxy92 --- frameworks/native/drm/key_session_impl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/native/drm/key_session_impl.cpp b/frameworks/native/drm/key_session_impl.cpp index b4ac38ad..b8e3a5ac 100644 --- a/frameworks/native/drm/key_session_impl.cpp +++ b/frameworks/native/drm/key_session_impl.cpp @@ -60,7 +60,6 @@ void MediaKeySessionImpl::MediaKeySessionServerDied(pid_t pid) (void)keySessionServiceProxy_->AsObject()->RemoveDeathRecipient(deathRecipient_); keySessionServiceProxy_ = nullptr; } - listenerStub_ = nullptr; deathRecipient_ = nullptr; } From 0903d4a5ebe83e1cd5b4d71d3e397f3d13128c0d Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:42:20 +0000 Subject: [PATCH 07/15] update frameworks/native/drm/media_key_system_impl.cpp. Signed-off-by: baoxy92 --- frameworks/native/drm/media_key_system_impl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/native/drm/media_key_system_impl.cpp b/frameworks/native/drm/media_key_system_impl.cpp index d4bfe694..b66df794 100644 --- a/frameworks/native/drm/media_key_system_impl.cpp +++ b/frameworks/native/drm/media_key_system_impl.cpp @@ -56,7 +56,6 @@ void MediaKeySystemImpl::MediaKeySystemServerDied(pid_t pid) serviceProxy_ = nullptr; deathRecipient_ = nullptr; } - listenerStub_ = nullptr; } int32_t MediaKeySystemImpl::Release() From 83aad31426e8e5c7a24e9a1078038b17b680da72 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:42:27 +0000 Subject: [PATCH 08/15] update interfaces/inner_api/native/drm/key_session_impl.h. Signed-off-by: baoxy92 --- interfaces/inner_api/native/drm/key_session_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/native/drm/key_session_impl.h b/interfaces/inner_api/native/drm/key_session_impl.h index e6d9434e..b131e57b 100644 --- a/interfaces/inner_api/native/drm/key_session_impl.h +++ b/interfaces/inner_api/native/drm/key_session_impl.h @@ -78,7 +78,6 @@ private: sptr keySessionServiceProxy_; std::recursive_mutex mutex_; sptr deathRecipient_ = nullptr; - sptr listenerStub_ = nullptr; }; class MediaKeySessionServiceCallback : public MediaKeySessionServiceCallbackStub { From a5d8436d46237c4917b404c13d11b1ae74f74d51 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:42:35 +0000 Subject: [PATCH 09/15] update interfaces/inner_api/native/drm/media_key_system_impl.h. Signed-off-by: baoxy92 --- interfaces/inner_api/native/drm/media_key_system_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/native/drm/media_key_system_impl.h b/interfaces/inner_api/native/drm/media_key_system_impl.h index f15977b0..8cb4731b 100644 --- a/interfaces/inner_api/native/drm/media_key_system_impl.h +++ b/interfaces/inner_api/native/drm/media_key_system_impl.h @@ -73,7 +73,6 @@ private: sptr mediaKeySystemApplicationCallback_; sptr serviceCallback_; sptr deathRecipient_ = nullptr; - sptr listenerStub_ = nullptr; }; class MediaKeySystemCallback : public MediaKeySystemServiceCallbackStub { From 3fbd817711b314ae3af6413fd7d174e399d9a7cf Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:54:33 +0000 Subject: [PATCH 10/15] update services/drm_service/client/include/media_decrypt_module_service_proxy.h. Signed-off-by: baoxy92 --- .../client/include/media_decrypt_module_service_proxy.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/drm_service/client/include/media_decrypt_module_service_proxy.h b/services/drm_service/client/include/media_decrypt_module_service_proxy.h index 65d63b24..9cd3b400 100644 --- a/services/drm_service/client/include/media_decrypt_module_service_proxy.h +++ b/services/drm_service/client/include/media_decrypt_module_service_proxy.h @@ -28,7 +28,6 @@ public: explicit MediaDecryptModuleServiceProxy(const sptr &impl); virtual ~MediaDecryptModuleServiceProxy() = default; int32_t Release() override; - int32_t SetListenerObject(const sptr &object) override; int32_t DecryptMediaData(bool secureDecodrtState, IMediaDecryptModuleService::CryptInfo &cryptInfo, IMediaDecryptModuleService::DrmBuffer &srcBuffer, IMediaDecryptModuleService::DrmBuffer &dstBuffer) override; From 764a580ec4209de44d2c6facdb1b9af28a9463a5 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:55:01 +0000 Subject: [PATCH 11/15] update services/drm_service/client/src/media_decrypt_module_service_proxy.cpp. Signed-off-by: baoxy92 --- .../src/media_decrypt_module_service_proxy.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/services/drm_service/client/src/media_decrypt_module_service_proxy.cpp b/services/drm_service/client/src/media_decrypt_module_service_proxy.cpp index e065558c..66701ceb 100644 --- a/services/drm_service/client/src/media_decrypt_module_service_proxy.cpp +++ b/services/drm_service/client/src/media_decrypt_module_service_proxy.cpp @@ -44,23 +44,6 @@ int32_t MediaDecryptModuleServiceProxy::Release() return ret; } -int32_t MediaDecryptModuleServiceProxy::SetListenerObject(const sptr &object) -{ - DRM_INFO_LOG("SetListenerObject enter."); - MessageParcel data; - MessageParcel reply; - MessageOption option; - - data.WriteInterfaceToken(GetDescriptor()); - (void)data.WriteRemoteObject(object); - int ret = Remote()->SendRequest(DECRYPT_MODULE_SET_LISTENER_OBJ, data, reply, option); - if (ret != DRM_OK) { - DRM_ERR_LOG("Set listener obj failed, errcode: %{public}d", ret); - return IPC_PROXY_ERR; - } - return reply.ReadInt32(); -} - int32_t MediaDecryptModuleServiceProxy::ProcessDrmBuffer(MessageParcel &data, IMediaDecryptModuleService::DrmBuffer &srcBuffer, IMediaDecryptModuleService::DrmBuffer &dstBuffer) { From 186b5b80c3954f0d17ca963852ac2706d41d6002 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:55:47 +0000 Subject: [PATCH 12/15] update services/drm_service/server/src/media_decrypt_module_service_stub.cpp. Signed-off-by: baoxy92 --- .../src/media_decrypt_module_service_stub.cpp | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/services/drm_service/server/src/media_decrypt_module_service_stub.cpp b/services/drm_service/server/src/media_decrypt_module_service_stub.cpp index 143edcb1..4f5d7109 100644 --- a/services/drm_service/server/src/media_decrypt_module_service_stub.cpp +++ b/services/drm_service/server/src/media_decrypt_module_service_stub.cpp @@ -44,33 +44,6 @@ void MediaDecryptModuleServiceStub::MediaDecryptModuleClientDied(pid_t pid) } } -int32_t MediaDecryptModuleServiceStub::SetListenerObject(const sptr &object) -{ - pid_t pid = IPCSkeleton::GetCallingPid(); - std::lock_guard lock(decryptModuleStubMutex_); - if (clientListener_ != nullptr && clientListener_->AsObject() != nullptr && deathRecipient_ != nullptr) { - DRM_DEBUG_LOG("This MediaDecryptModuleServiceStub has already set listener!"); - (void)clientListener_->AsObject()->RemoveDeathRecipient(deathRecipient_); - deathRecipient_ = nullptr; - clientListener_ = nullptr; - } - - DRM_CHECK_AND_RETURN_RET_LOG(object != nullptr, DRM_MEMORY_ERROR, "set listener object is nullptr"); - sptr clientListener_ = iface_cast(object); - DRM_CHECK_AND_RETURN_RET_LOG( - clientListener_ != nullptr, DRM_MEMORY_ERROR, "failed to convert IDrmListener"); - deathRecipient_ = new (std::nothrow) DrmDeathRecipient(pid); - DRM_CHECK_AND_RETURN_RET_LOG(deathRecipient_ != nullptr, DRM_MEMORY_ERROR, "failed to new DrmDeathRecipient"); - deathRecipient_->SetNotifyCb([this] (pid_t pid) { - this->MediaDecryptModuleClientDied(pid); - }); - if (clientListener_->AsObject() != nullptr) { - (void)clientListener_->AsObject()->AddDeathRecipient(deathRecipient_); - } - DRM_DEBUG_LOG("MediaDecryptModule client pid:%{public}d", pid); - return DRM_OK; -} - int32_t MediaDecryptModuleServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -139,12 +112,6 @@ int32_t MediaDecryptModuleServiceStub::OnRemoteRequest(uint32_t code, MessagePar } return ret; } - case DECRYPT_MODULE_SET_LISTENER_OBJ: { - DRM_INFO_LOG("DECRYPT_MODULE_SET_LISTENER_OBJ enter."); - sptr object = data.ReadRemoteObject(); - int32_t ret = SetListenerObject(object); - return ret; - } case DECRYPT_MODULE_RELEASE: { DRM_INFO_LOG("MediaDecryptModuleServiceStub DECRYPT_MODULE_RELEASE enter."); int32_t ret = Release(); From f585d315226bc9b33ec88f039eb6f241a76c435a Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 14:56:46 +0000 Subject: [PATCH 13/15] update services/drm_service/server/include/media_decrypt_module_service_stub.h. Signed-off-by: baoxy92 --- .../server/include/media_decrypt_module_service_stub.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/drm_service/server/include/media_decrypt_module_service_stub.h b/services/drm_service/server/include/media_decrypt_module_service_stub.h index 2c998bf0..ff52bc47 100644 --- a/services/drm_service/server/include/media_decrypt_module_service_stub.h +++ b/services/drm_service/server/include/media_decrypt_module_service_stub.h @@ -35,8 +35,6 @@ public: virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - int32_t SetListenerObject(const sptr &object) override; - private: void MediaDecryptModuleClientDied(pid_t pid); std::recursive_mutex decryptModuleStubMutex_; From 1bf0621df357e28f45458a9e1e8a69a37c2081ea Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 15:00:04 +0000 Subject: [PATCH 14/15] update services/drm_service/ipc/i_mediadecryptmodule_service.h. Signed-off-by: baoxy92 --- services/drm_service/ipc/i_mediadecryptmodule_service.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/drm_service/ipc/i_mediadecryptmodule_service.h b/services/drm_service/ipc/i_mediadecryptmodule_service.h index 40a5e194..ab9aad03 100644 --- a/services/drm_service/ipc/i_mediadecryptmodule_service.h +++ b/services/drm_service/ipc/i_mediadecryptmodule_service.h @@ -64,7 +64,6 @@ public: virtual ~IMediaDecryptModuleService() = default; virtual int32_t Release() = 0; - virtual int32_t SetListenerObject(const sptr &object) = 0; virtual int32_t DecryptMediaData(bool secureDecodrtState, IMediaDecryptModuleService::CryptInfo &cryptInfo, DrmBuffer &srcBuffer, DrmBuffer &dstBuffer) = 0; DECLARE_INTERFACE_DESCRIPTOR(u"IMediaDecryptModuleService"); From 166b91b112f37d923cb97b31c2064f770778e055 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Thu, 24 Oct 2024 15:00:28 +0000 Subject: [PATCH 15/15] update services/drm_service/ipc/remote_request_code.h. Signed-off-by: baoxy92 --- services/drm_service/ipc/remote_request_code.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/drm_service/ipc/remote_request_code.h b/services/drm_service/ipc/remote_request_code.h index d8c360df..48533438 100644 --- a/services/drm_service/ipc/remote_request_code.h +++ b/services/drm_service/ipc/remote_request_code.h @@ -63,8 +63,7 @@ enum MediaKeySessionServiceRequestCode { enum MediaDecryptModuleServiceRequestCode { DECRYPT_MODULE_DECRYPT_DATA = 0, - DECRYPT_MODULE_SET_LISTENER_OBJ = 1, - DECRYPT_MODULE_RELEASE = 2, + DECRYPT_MODULE_RELEASE = 1, }; enum MediaKeySessionServiceCallbackRequestCode {