Move SPOID Enable/Disable Logic Out of WVDrmPlugin

(This is a merge of http://go/wvgerrit/25580)

While writing fixes for b/36660726, b/34716264, and b/36065223, it
became clear that having the logic that checks whether the device
supports SPOIDs embedded inside WVDrmPlugin was complicating its code
and inhibiting testing of the class. By moving this check into the code
that instantiates WVDrmPlugin, the result of the calculation can be
independently tested while the tests for WVDrmPlugin can put it in
whatever state they need for the sake of unit testing.

As a consequence of this, the check on retrieving the "deviceUniqueId"
byte array property, which was removed when SPOIDs were implemented, can
be reinstated.

Bug: 36660726
Bug: 34716264
Bug: 36065223
Test: libwvdrmdrmplugin_hidl_test & libwvdrmengine_hidl_test
Change-Id: I961d2ee42bbdc42f0c324e36d9a74ac92205a437
This commit is contained in:
John W. Bruce
2017-04-11 11:55:37 -07:00
parent 6116fdb97a
commit 19947dfe6f
7 changed files with 115 additions and 96 deletions

View File

@@ -55,7 +55,8 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
WVDrmPlugin(const sp<WvContentDecryptionModule>& cdm,
const std::string& appPackageName,
WVGenericCryptoInterface* crypto);
WVGenericCryptoInterface* crypto,
bool useSpoid);
virtual ~WVDrmPlugin();
@@ -307,16 +308,13 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
class CdmIdentifierBuilder {
public:
CdmIdentifierBuilder();
CdmIdentifierBuilder(bool useSpoid, const std::string& appPackageName);
const CdmIdentifier& get_identifier();
const std::string& get_device_unique_id();
bool set_device_id(const std::string& id);
const std::string& app_package_name() { return mAppPackageName; }
bool set_app_package_name(const std::string& id);
const std::string& origin() const { return mCdmIdentifier.origin; }
bool set_origin(const std::string& id);