Remove dependencies from frameworks C++ containers.

Replace AString, KeyedVector, List, String8 and Vector
with stl containers. Remove corresponding frameworks
libraries.

Test: Play Movies & TV (streaming and pinning)
Test: Netflix
Test: unit tests

bug: 34677927
Change-Id: I125f45054987d69bbca59c1ffdcbe8add38c3c13
This commit is contained in:
Edwin Wong
2017-03-31 18:34:01 -07:00
parent 82a0ed59fe
commit d9e7070de7
13 changed files with 452 additions and 336 deletions

View File

@@ -7,7 +7,6 @@
#include <android/hardware/drm/1.0/ICryptoPlugin.h>
#include <android/hidl/memory/1.0/IMemory.h>
#include <media/stagefright/foundation/AString.h>
#include "wv_content_decryption_module.h"
#include "WVTypes.h"
@@ -71,7 +70,7 @@ struct WVCryptoPlugin : public ICryptoPlugin {
android::status_t attemptDecrypt(
const wvcdm::CdmDecryptionParameters& params,
bool haveEncryptedSubsamples, android::AString* errorDetailMsg);
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
static wvcdm::CdmResponseType countEncryptedBlocksInPatternedRange(
size_t range, const Pattern& pattern, uint64_t* result);
static void incrementIV(uint64_t increaseBy, std::vector<uint8_t>* ivPtr);

View File

@@ -5,7 +5,6 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "WVCdm"
#include <utils/Log.h>
#include <utils/String8.h>
#include "WVCryptoPlugin.h"
#include "TypeConvert.h"
@@ -35,7 +34,6 @@ using ::android::hardware::drm::V1_0::widevine::toStatus;
using ::android::hardware::drm::V1_0::widevine::toVector;
using ::android::hardware::Void;
using android::AString;
using android::status_t;
using wvcdm::CdmDecryptionParameters;
@@ -85,7 +83,7 @@ Return<void> WVCryptoPlugin::notifyResolution(
Return<Status> WVCryptoPlugin::setMediaDrmSession(
const hidl_vec<uint8_t>& sessionId) {
const android::Vector<uint8_t> sId = toVector(sessionId);
const std::vector<uint8_t> sId = toVector(sessionId);
CdmSessionId cdmSessionId(sId.begin(), sId.end());
if (!mCDM->IsOpenSession(cdmSessionId)) {
return Status::ERROR_DRM_SESSION_NOT_OPENED;
@@ -141,7 +139,7 @@ Return<void> WVCryptoPlugin::decrypt(
reinterpret_cast<const char*>(keyId.data()), wvcdm::KEY_ID_SIZE);
std::vector<uint8_t> ivVector(iv.data(), iv.data() + wvcdm::KEY_IV_SIZE);
AString errorDetailMsg;
std::string errorDetailMsg;
sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId];
if (source.offset + offset + source.size > sourceBase->getSize()) {
@@ -319,7 +317,7 @@ Return<void> WVCryptoPlugin::decrypt(
status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
bool haveEncryptedSubsamples,
AString* errorDetailMsg) {
std::string* errorDetailMsg) {
CdmResponseType res = mCDM->Decrypt(mSessionId, haveEncryptedSubsamples,
params);
@@ -331,27 +329,27 @@ status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
params.is_encrypted ? "encrypted" : "unencrypted",
res);
if (res == wvcdm::INSUFFICIENT_CRYPTO_RESOURCES) {
errorDetailMsg->setTo(
errorDetailMsg->assign(
"Error decrypting data: insufficient crypto resources");
// This error is actionable by the app and should be passed up.
return mapCdmResponseType(res);
} else if (res == wvcdm::NEED_KEY) {
errorDetailMsg->setTo(
errorDetailMsg->assign(
"Error decrypting data: requested key has not been loaded");
// This error is actionable by the app and should be passed up.
return mapCdmResponseType(res);
} else if (res == wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT) {
errorDetailMsg->setTo(
errorDetailMsg->assign(
"Error decrypting data: session not found, possibly reclaimed");
// This error is actionable by the app and should be passed up.
return mapCdmResponseType(res);
} else if (res == wvcdm::DECRYPT_ERROR) {
errorDetailMsg->setTo(
errorDetailMsg->assign(
"Error decrypting data: unspecified error");
// This error is actionable by the app and should be passed up.
return mapCdmResponseType(res);
} else if (res == wvcdm::INSUFFICIENT_OUTPUT_PROTECTION) {
errorDetailMsg->setTo(
errorDetailMsg->assign(
"Error decrypting data: insufficient output protection");
// This error is actionable by the app and should be passed up.
return mapCdmResponseType(res);

View File

@@ -33,7 +33,6 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libdl \
liblog \
libmedia \
libprotobuf-cpp-lite \
libstagefright_foundation \
libutils \
@@ -100,9 +99,7 @@ LOCAL_SHARED_LIBRARIES := \
libhidlbase \
libhidlmemory \
liblog \
libmedia \
libprotobuf-cpp-lite \
libstagefright_foundation \
libutils \
LOCAL_C_INCLUDES += \