Fix widevine drm hal resource leaks
A strong pointer cycle was preventing the drm plugin from being released. This change converts the listener to a weak pointer to break the cycle. bug:36408047 test: manual testing to verify leaks are fixed Change-Id: I2e2af392c2b263b7b0943d61dcaee5e94089ce27
This commit is contained in:
@@ -1122,8 +1122,9 @@ Return<void> WVDrmPlugin::setListener(const sp<IDrmPluginListener>& listener) {
|
||||
Return<void> WVDrmPlugin::sendEvent(
|
||||
EventType eventType,
|
||||
const hidl_vec<uint8_t>& sessionId, const hidl_vec<uint8_t>& data) {
|
||||
if (mListener != NULL) {
|
||||
mListener->sendEvent(eventType, sessionId, data);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != NULL) {
|
||||
listener->sendEvent(eventType, sessionId, data);
|
||||
} else {
|
||||
ALOGE("Null event listener, event not sent");
|
||||
}
|
||||
@@ -1133,8 +1134,9 @@ Return<void> WVDrmPlugin::sendEvent(
|
||||
Return<void> WVDrmPlugin::sendExpirationUpdate(
|
||||
const hidl_vec<uint8_t>& sessionId,
|
||||
int64_t expiryTimeInMS) {
|
||||
if (mListener != NULL) {
|
||||
mListener->sendExpirationUpdate(sessionId, expiryTimeInMS);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != NULL) {
|
||||
listener->sendExpirationUpdate(sessionId, expiryTimeInMS);
|
||||
} else {
|
||||
ALOGE("Null event listener, event not sent");
|
||||
}
|
||||
@@ -1144,8 +1146,9 @@ Return<void> WVDrmPlugin::sendExpirationUpdate(
|
||||
Return<void> WVDrmPlugin::sendKeysChange(
|
||||
const hidl_vec<uint8_t>& sessionId,
|
||||
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey) {
|
||||
if (mListener != NULL) {
|
||||
mListener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
|
||||
auto listener = mListener.promote();
|
||||
if (listener != NULL) {
|
||||
listener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
|
||||
} else {
|
||||
ALOGE("Null event listener, event not sent");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user