mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 21:37:44 +00:00
Merge "Fix resource leaks in drm hal" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
14b91049a7
@@ -44,7 +44,7 @@ using ::android::sp;
|
||||
struct CryptoPlugin : public ICryptoPlugin {
|
||||
CryptoPlugin(android::CryptoPlugin *plugin) : mLegacyPlugin(plugin) {}
|
||||
|
||||
~CryptoPlugin() {delete mLegacyPlugin;}
|
||||
virtual ~CryptoPlugin() {delete mLegacyPlugin;}
|
||||
|
||||
// Methods from ::android::hardware::drm::V1_0::ICryptoPlugin
|
||||
// follow.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
` *
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -327,24 +327,27 @@ namespace implementation {
|
||||
|
||||
Return<void> DrmPlugin::sendEvent(EventType eventType,
|
||||
const hidl_vec<uint8_t>& sessionId, const hidl_vec<uint8_t>& data) {
|
||||
if (mListener != nullptr) {
|
||||
mListener->sendEvent(eventType, sessionId, data);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendEvent(eventType, sessionId, data);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> DrmPlugin::sendExpirationUpdate(
|
||||
const hidl_vec<uint8_t>& sessionId, int64_t expiryTimeInMS) {
|
||||
if (mListener != nullptr) {
|
||||
mListener->sendExpirationUpdate(sessionId, expiryTimeInMS);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendExpirationUpdate(sessionId, expiryTimeInMS);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> DrmPlugin::sendKeysChange(const hidl_vec<uint8_t>& sessionId,
|
||||
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey) {
|
||||
if (mListener != nullptr) {
|
||||
mListener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
@@ -380,15 +383,21 @@ namespace implementation {
|
||||
}
|
||||
if (sendEvent) {
|
||||
Vector<uint8_t> emptyVector;
|
||||
mListener->sendEvent(eventType,
|
||||
toHidlVec(sessionId == NULL ? emptyVector: *sessionId),
|
||||
toHidlVec(data == NULL ? emptyVector: *data));
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendEvent(eventType,
|
||||
toHidlVec(sessionId == NULL ? emptyVector: *sessionId),
|
||||
toHidlVec(data == NULL ? emptyVector: *data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrmPlugin::sendExpirationUpdate(Vector<uint8_t> const *sessionId,
|
||||
int64_t expiryTimeInMS) {
|
||||
mListener->sendExpirationUpdate(toHidlVec(*sessionId), expiryTimeInMS);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendExpirationUpdate(toHidlVec(*sessionId), expiryTimeInMS);
|
||||
}
|
||||
}
|
||||
|
||||
void DrmPlugin::sendKeysChange(Vector<uint8_t> const *sessionId,
|
||||
@@ -424,8 +433,11 @@ namespace implementation {
|
||||
keyStatus.keyId = toHidlVec(legacyKeyStatus.mKeyId);
|
||||
keyStatusVec.push_back(keyStatus);
|
||||
}
|
||||
mListener->sendKeysChange(toHidlVec(*sessionId),
|
||||
toHidlVec(keyStatusVec), hasNewUsableKey);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != nullptr) {
|
||||
listener->sendKeysChange(toHidlVec(*sessionId),
|
||||
toHidlVec(keyStatusVec), hasNewUsableKey);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -46,7 +46,7 @@ using ::android::sp;
|
||||
struct DrmPlugin : public IDrmPlugin, android::DrmPluginListener {
|
||||
|
||||
DrmPlugin(android::DrmPlugin *plugin) : mLegacyPlugin(plugin) {}
|
||||
~DrmPlugin() {delete mLegacyPlugin;}
|
||||
virtual ~DrmPlugin() {delete mLegacyPlugin;}
|
||||
|
||||
// Methods from ::android::hardware::drm::V1_0::IDrmPlugin follow.
|
||||
|
||||
@@ -153,7 +153,7 @@ struct DrmPlugin : public IDrmPlugin, android::DrmPluginListener {
|
||||
|
||||
private:
|
||||
android::DrmPlugin *mLegacyPlugin;
|
||||
sp<IDrmPluginListener> mListener;
|
||||
wp<IDrmPluginListener> mListener;
|
||||
|
||||
DrmPlugin() = delete;
|
||||
DrmPlugin(const DrmPlugin &) = delete;
|
||||
|
||||
Reference in New Issue
Block a user