Replace toStatus indirection.

CdmResponseType are mapped to android::status_t, then map to hidl
android::hardware::drm::V1_0::Status. This CL removes the indirection
by mapping cdm errors to hidl Status.

Test: Play Movies (pin and streaming)
Test: Netflix (download and streaming)
Test: libwvdrmmediacrypto_hidl_test and libwvdrmdrmplugin_hidl_test
Test: GtsMediaTestCases module
Test: Vts - VtsHalDrmV1_0Target

bug: 34682447
Change-Id: I0b04f47871f5e4898e7297831d5fceab52e0f7f9
This commit is contained in:
Edwin Wong
2017-05-18 09:01:42 -07:00
parent 496b184ddd
commit 485f11483c
12 changed files with 491 additions and 271 deletions

View File

@@ -39,7 +39,6 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::sp;
using android::status_t;
using std::map;
using wvcdm::CdmIdentifier;
using wvcdm::CdmKeyStatusMap;
@@ -180,7 +179,7 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
bool hasNewUsableKey) override;
// The following methods do not use hidl interface, it is used internally.
virtual status_t unprovisionDevice();
virtual Status unprovisionDevice();
virtual void OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId);
@@ -316,14 +315,14 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
// calls into the CDM in order to identify which CDM instance should receive
// the call. Calling this will seal the CDM Identifier Builder, thus making
// it an error to change the origin.
status_t getCdmIdentifier(CdmIdentifier* identifier);
Status getCdmIdentifier(CdmIdentifier* identifier);
// Gets the application-safe device-unique ID. On non-SPOID devices, this is
// the device-unique ID from OEMCrypto. On SPOID devices, this is the SPOID.
// On SPOID devices, calling this will seal the CDM Identifier Builder, thus
// making it an error to change the origin.
status_t getDeviceUniqueId(std::string* id);
status_t getProvisioningUniqueId(std::string* id);
Status getDeviceUniqueId(std::string* id);
Status getProvisioningUniqueId(std::string* id);
const std::string& origin() const { return mCdmIdentifier.origin; }
bool set_origin(const std::string& id);
@@ -338,13 +337,13 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
std::string mAppPackageName;
const WVDrmPlugin& mParent;
status_t calculateSpoid();
Status calculateSpoid();
// Gets the device-unique ID from OEMCrypto. This must be private, since
// this value must not be exposed to applications on SPOID devices. Code
// outside this class should use getDeviceUniqueId() to get the
// application-safe device-unique ID.
status_t getOemcryptoDeviceId(std::string* id);
Status getOemcryptoDeviceId(std::string* id);
} mCdmIdentifierBuilder;
sp<wvcdm::WvContentDecryptionModule> const mCDM;
@@ -352,27 +351,27 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
map<CdmSessionId, CryptoSession> mCryptoSessions;
sp<IDrmPluginListener> mListener;
status_t queryProperty(const std::string& property,
Status queryProperty(const std::string& property,
std::string& stringValue) const;
status_t queryProperty(wvcdm::SecurityLevel securityLevel,
Status queryProperty(wvcdm::SecurityLevel securityLevel,
const std::string& property,
std::string& stringValue) const;
status_t queryProperty(const std::string& property,
Status queryProperty(const std::string& property,
std::vector<uint8_t>& vector_value) const;
status_t mapAndNotifyOfCdmResponseType(const std::vector<uint8_t>& sessionId,
Status mapAndNotifyOfCdmResponseType(const std::vector<uint8_t>& sessionId,
CdmResponseType res);
status_t mapAndNotifyOfOEMCryptoResult(const std::vector<uint8_t>& sessionId,
Status mapAndNotifyOfOEMCryptoResult(const std::vector<uint8_t>& sessionId,
OEMCryptoResult res);
status_t mapOEMCryptoResult(OEMCryptoResult res);
Status mapOEMCryptoResult(OEMCryptoResult res);
bool initDataResemblesPSSH(const std::vector<uint8_t>& initData);
status_t unprovision(const CdmIdentifier& identifier);
Status unprovision(const CdmIdentifier& identifier);
};
} // namespace widevine