From 05407702807514f920b20433057e24fb20ee4728 Mon Sep 17 00:00:00 2001 From: "John \"Juce\" Bruce" Date: Fri, 10 Apr 2015 15:58:29 -0700 Subject: [PATCH] Remove Backwards-Compatibility for Classic MediaCodec Mode (This is a merge of http://go/wvgerrit/14082) Previously, the CryptoFactory had special behavior to defer creation to Widevine Classic if no session ID was provided. This functionality has been deprecated, as MediaCodec Mode is no longer supported. This is necessary as part of supporting the new API for session ID changes because the expectation is that it is now legal to initialize a modular CryptoPlugin without a session ID. Bug: 19570317 Change-Id: Iad0cd01b6a8d2e66c94c5f53a8a60f5787bc02f8 --- libwvdrmengine/include/WVCryptoFactory.h | 7 +-- libwvdrmengine/include/WVDrmFactory.h | 4 +- libwvdrmengine/src/WVCryptoFactory.cpp | 55 ------------------------ 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/libwvdrmengine/include/WVCryptoFactory.h b/libwvdrmengine/include/WVCryptoFactory.h index aaba5516..7410f1cf 100644 --- a/libwvdrmengine/include/WVCryptoFactory.h +++ b/libwvdrmengine/include/WVCryptoFactory.h @@ -13,8 +13,8 @@ namespace wvdrm { class WVCryptoFactory : public android::CryptoFactory { public: - WVCryptoFactory(); - virtual ~WVCryptoFactory(); + WVCryptoFactory() {} + virtual ~WVCryptoFactory() {} virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const; @@ -24,9 +24,6 @@ class WVCryptoFactory : public android::CryptoFactory { private: DISALLOW_EVIL_CONSTRUCTORS(WVCryptoFactory); - - void* mLegacyLibraryHandle; - android::CryptoFactory* mLegacyFactory; }; } // namespace wvdrm diff --git a/libwvdrmengine/include/WVDrmFactory.h b/libwvdrmengine/include/WVDrmFactory.h index b284b94f..37c17d2c 100644 --- a/libwvdrmengine/include/WVDrmFactory.h +++ b/libwvdrmengine/include/WVDrmFactory.h @@ -14,8 +14,8 @@ namespace wvdrm { class WVDrmFactory : public android::DrmFactory { public: - WVDrmFactory() {}; - virtual ~WVDrmFactory() {}; + WVDrmFactory() {} + virtual ~WVDrmFactory() {} virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]); diff --git a/libwvdrmengine/src/WVCryptoFactory.cpp b/libwvdrmengine/src/WVCryptoFactory.cpp index d2834986..e17a1b78 100644 --- a/libwvdrmengine/src/WVCryptoFactory.cpp +++ b/libwvdrmengine/src/WVCryptoFactory.cpp @@ -19,47 +19,6 @@ namespace wvdrm { using namespace android; -WVCryptoFactory::WVCryptoFactory() - : mLegacyLibraryHandle(NULL), - mLegacyFactory(NULL) { - mLegacyLibraryHandle = dlopen("libdrmdecrypt.so", RTLD_NOW); - - if (mLegacyLibraryHandle == NULL) { - ALOGW("Unable to locate libdrmdecrypt.so"); - } else { - typedef CryptoFactory* (*CreateCryptoFactoryFunc)(); - - CreateCryptoFactoryFunc legacyCreateCryptoFactory = - (CreateCryptoFactoryFunc)dlsym(mLegacyLibraryHandle, - "createCryptoFactory"); - - if (legacyCreateCryptoFactory == NULL) { - ALOGW("Unable to find legacy symbol 'createCryptoFactory'."); - dlclose(mLegacyLibraryHandle); - mLegacyLibraryHandle = NULL; - } else { - mLegacyFactory = legacyCreateCryptoFactory(); - if (mLegacyFactory == NULL) { - ALOGW("Legacy createCryptoFactory() failed."); - dlclose(mLegacyLibraryHandle); - mLegacyLibraryHandle = NULL; - } - } - } -} - -WVCryptoFactory::~WVCryptoFactory() { - if (mLegacyFactory != NULL) { - delete mLegacyFactory; - mLegacyFactory = NULL; - } - - if (mLegacyLibraryHandle != NULL) { - dlclose(mLegacyLibraryHandle); - mLegacyLibraryHandle = NULL; - } -} - bool WVCryptoFactory::isCryptoSchemeSupported(const uint8_t uuid[16]) const { return isWidevineUUID(uuid); } @@ -71,21 +30,7 @@ status_t WVCryptoFactory::createPlugin(const uint8_t uuid[16], const void* data, return BAD_VALUE; } - // 0 size means they want an old-style Widevine plugin - if (size == 0) { - if (mLegacyFactory == NULL) { - ALOGE("Legacy crypto factory loading failed. Cannot create legacy " - "plugin. Look for warnings about this that were logged earlier, " - "during CryptoFactory instantiation."); - return -EINVAL; - } - - return mLegacyFactory->createPlugin(uuid, data, size, plugin); - } - - // We received a session ID, so create a CENC plugin. *plugin = new WVCryptoPlugin(data, size, getCDM()); - return OK; }