Update Widevine HIDL service to 1.2.

Widevine HIDL service added new v1.2 media APIs,
update the service to support new APIs.

Merged from http://go/wvgerrit/67083

Test: Netflix and Play Movies & TV (streaming and offline playback)

Test: GTS WidevineH264PlaybackTests test
  e.g. ANDROID_BUILD_TOP= ./android-gts/toolsefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30

Test: Widevine unit tests

bug: 117570686
Change-Id: I3a2091e7c62a0d2697ef97f983fd898aedfb4519
This commit is contained in:
Edwin Wong
2018-11-27 10:20:32 -08:00
parent 5d360abd4b
commit 20adb9438d
24 changed files with 104 additions and 60 deletions

View File

@@ -69,6 +69,7 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
android.hidl.memory@1.0 \
liblog

View File

@@ -9,9 +9,9 @@
#include <map>
#include <android/hardware/drm/1.1/IDrmPlugin.h>
#include <android/hardware/drm/1.0/IDrmPluginListener.h>
#include <android/hardware/drm/1.1/types.h>
#include <android/hardware/drm/1.2/IDrmPlugin.h>
#include "cdm_client_property_set.h"
#include "cdm_identifier.h"
@@ -24,7 +24,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::EventType;
@@ -38,9 +38,11 @@ using ::android::hardware::drm::V1_0::SecureStopId;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::hardware::drm::V1_1::HdcpLevel;
using ::android::hardware::drm::V1_1::IDrmPlugin;
using ::android::hardware::drm::V1_1::SecureStopRelease;
using ::android::hardware::drm::V1_1::SecurityLevel;
using ::android::hardware::drm::V1_2::IDrmPlugin;
using ::android::hardware::drm::V1_2::KeySetId;
using ::android::hardware::drm::V1_2::OfflineLicenseState;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -140,7 +142,15 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
Return<void> getNumberOfSessions(getNumberOfSessions_cb _hidl_cb) override;
Return<void> getSecurityLevel(const hidl_vec<uint8_t>& sessionId,
getSecurityLevel_cb _hidl_cb) override;
getSecurityLevel_cb _hidl_cb) override;
Return<void> getOfflineLicenseKeySetIds(
getOfflineLicenseKeySetIds_cb _hidl_cb) override;
Return<Status> removeOfflineLicense(const KeySetId &keySetId) override;
Return<void> getOfflineLicenseState(const KeySetId &keySetId,
getOfflineLicenseState_cb _hidl_cb) override;
Return<void> getPropertyString(
const hidl_string& propertyName,
@@ -402,20 +412,20 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
std::string mProvisioningServiceCertificate;
Status queryProperty(const std::string& property,
std::string& stringValue) const;
std::string& stringValue) const;
Status queryProperty(wvcdm::SecurityLevel securityLevel,
const std::string& property,
std::string& stringValue) const;
const std::string& property,
std::string& stringValue) const;
Status queryProperty(const std::string& property,
std::vector<uint8_t>& vector_value) const;
std::vector<uint8_t>& vector_value) const;
Status mapAndNotifyOfCdmResponseType(const std::vector<uint8_t>& sessionId,
CdmResponseType res);
CdmResponseType res);
Status mapAndNotifyOfOEMCryptoResult(const std::vector<uint8_t>& sessionId,
OEMCryptoResult res);
OEMCryptoResult res);
Status mapOEMCryptoResult(OEMCryptoResult res);
@@ -429,7 +439,7 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
};
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -35,7 +35,7 @@ static const char* const kSpecialUnprovisionResponse = "unprovision";
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::EventType;
@@ -45,8 +45,8 @@ using ::android::hardware::drm::V1_0::KeyType;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::hardware::drm::V1_1::SecurityLevel;
using ::android::hardware::drm::V1_1::widevine::toHidlVec;
using ::android::hardware::drm::V1_1::widevine::toVector;
using ::android::hardware::drm::V1_2::widevine::toHidlVec;
using ::android::hardware::drm::V1_2::widevine::toVector;
using ::android::hardware::Void;
using wvcdm::kDefaultCdmIdentifier;
@@ -937,6 +937,33 @@ Return<void> WVDrmPlugin::getSecurityLevel(
return Void();
}
Return<void> WVDrmPlugin::getOfflineLicenseKeySetIds(
getOfflineLicenseKeySetIds_cb _hidl_cb) {
std::vector<KeySetId> keySetIds;
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, keySetIds);
return Void();
}
Return<void> WVDrmPlugin::getOfflineLicenseState(const KeySetId &keySetId,
getOfflineLicenseState_cb _hidl_cb) {
if (!keySetId.size()) {
_hidl_cb(Status::BAD_VALUE, OfflineLicenseState::UNKNOWN);
return Void();
}
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, OfflineLicenseState::UNKNOWN);
return Void();
}
Return<Status> WVDrmPlugin::removeOfflineLicense(const KeySetId &keySetId) {
if (!keySetId.size()) {
return Status::BAD_VALUE;
}
return Status::ERROR_DRM_CANNOT_HANDLE;
}
Return<void> WVDrmPlugin::getPropertyString(const hidl_string& propertyName,
getPropertyString_cb _hidl_cb) {
Status status = Status::OK;
@@ -1793,7 +1820,7 @@ uint32_t WVDrmPlugin::CdmIdentifierBuilder::getNextUniqueId() {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -93,6 +93,7 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
android.hidl.memory@1.0 \
libbinder \
libcutils \
@@ -157,6 +158,7 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
android.hidl.memory@1.0 \
libhidlbase \
libhidlmemory \

View File

@@ -8,8 +8,8 @@
#include <utils/Log.h>
#include <android/hardware/drm/1.0/IDrmPluginListener.h>
#include <android/hardware/drm/1.1/IDrmPlugin.h>
#include <android/hardware/drm/1.1/types.h>
#include <android/hardware/drm/1.2/IDrmPlugin.h>
#include <stdio.h>
#include <ostream>
@@ -33,14 +33,14 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::EventType;
using ::android::hardware::drm::V1_0::KeyStatus;
using ::android::hardware::drm::V1_0::KeyStatusType;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_1::widevine::toHidlVec;
using ::android::hardware::drm::V1_2::widevine::toHidlVec;
using ::android::hardware::hidl_vec;
using ::testing::_;
@@ -2545,7 +2545,7 @@ TEST_F(WVDrmPluginTest, AllowsStoringOfSessionSharingId) {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm