openDecryptSession() should consistently return sp<DecryptHandle>
Test:run cts-dev --module CtsDrmTestCases -t android.drm.cts.DRMTest
bug:79378662
Change-Id: Id46e63e3e0faf76ec98a77d7d439e5ccbc85e20f
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index c047eb1..b0a441b 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -183,7 +183,7 @@
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->consumeRights(
- uniqueId, decryptHandle.get(), action, reserve);
+ uniqueId, decryptHandle, action, reserve);
}
return status;
}
@@ -194,7 +194,7 @@
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->setPlaybackStatus(
- uniqueId, decryptHandle.get(), playbackStatus, position);
+ uniqueId, decryptHandle, playbackStatus, position);
}
return status;
}
@@ -267,7 +267,7 @@
sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession(
int uniqueId, const char* uri, const char* mime) {
- DecryptHandle* handle = NULL;
+ sp<DecryptHandle> handle;
if (NULL != uri) {
handle = getDrmManagerService()->openDecryptSession(uniqueId, uri, mime);
}
@@ -284,7 +284,7 @@
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->closeDecryptSession(
- uniqueId, decryptHandle.get());
+ uniqueId, decryptHandle);
}
return status;
}
@@ -295,7 +295,7 @@
status_t status = DRM_ERROR_UNKNOWN;
if ((NULL != decryptHandle.get()) && (NULL != headerInfo)) {
status = getDrmManagerService()->initializeDecryptUnit(
- uniqueId, decryptHandle.get(), decryptUnitId, headerInfo);
+ uniqueId, decryptHandle, decryptUnitId, headerInfo);
}
return status;
}
@@ -308,7 +308,7 @@
if ((NULL != decryptHandle.get()) && (NULL != encBuffer)
&& (NULL != decBuffer) && (NULL != *decBuffer)) {
status = getDrmManagerService()->decrypt(
- uniqueId, decryptHandle.get(), decryptUnitId,
+ uniqueId, decryptHandle, decryptUnitId,
encBuffer, decBuffer, IV);
}
return status;
@@ -319,7 +319,7 @@
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->finalizeDecryptUnit(
- uniqueId, decryptHandle.get(), decryptUnitId);
+ uniqueId, decryptHandle, decryptUnitId);
}
return status;
}
@@ -329,7 +329,7 @@
ssize_t retCode = INVALID_VALUE;
if ((NULL != decryptHandle.get()) && (NULL != buffer) && (0 < numBytes)) {
retCode = getDrmManagerService()->pread(
- uniqueId, decryptHandle.get(), buffer, numBytes, offset);
+ uniqueId, decryptHandle, buffer, numBytes, offset);
}
return retCode;
}