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

@@ -40,7 +40,7 @@ LOCAL_MODULE_OWNER := widevine
include $(BUILD_PREBUILT)
# -----------------------------------------------------------------------------
# Builds android.hardware.drm@1.1-service.widevine
# Builds android.hardware.drm@1.2-service.widevine
#
include $(CLEAR_VARS)
@@ -54,6 +54,7 @@ LOCAL_C_INCLUDES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
libbase \
libhidltransport \
libhwbinder \
@@ -65,8 +66,8 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_HEADER_LIBRARIES := \
libstagefright_foundation_headers
LOCAL_MODULE := android.hardware.drm@1.1-service.widevine
LOCAL_INIT_RC := src_hidl/android.hardware.drm@1.1-service.widevine.rc
LOCAL_MODULE := android.hardware.drm@1.2-service.widevine
LOCAL_INIT_RC := src_hidl/android.hardware.drm@1.2-service.widevine.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/bin/hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_OWNER := widevine
@@ -243,6 +244,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 \
libcutils \
libdl \

View File

@@ -26,7 +26,7 @@
namespace android {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::hidl_array;
@@ -71,7 +71,7 @@ template<typename T, size_t SIZE> std::vector<T> toVector(
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace android

View File

@@ -13,7 +13,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_1::ICryptoFactory;
@@ -25,7 +25,7 @@ extern "C" {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -14,7 +14,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_1::ICryptoFactory;
@@ -41,7 +41,7 @@ struct WVCryptoFactory : public ICryptoFactory {
};
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -8,7 +8,7 @@
#define WV_DRM_FACTORY_H_
#include <android/hardware/drm/1.1/IDrmFactory.h>
#include <android/hardware/drm/1.1/IDrmPlugin.h>
#include <android/hardware/drm/1.2/IDrmPlugin.h>
#include "WVGenericCryptoInterface.h"
#include "WVTypes.h"
@@ -16,11 +16,11 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_1::IDrmFactory;
using ::android::hardware::drm::V1_1::IDrmPlugin;
using ::android::hardware::drm::V1_2::IDrmPlugin;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::Return;
@@ -53,7 +53,7 @@ struct WVDrmFactory : public IDrmFactory {
extern "C" IDrmFactory* HIDL_FETCH_IDrmFactory(const char* name);
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -67,6 +67,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 \
libhidlmemory \
liblog

View File

@@ -16,7 +16,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::DestinationBuffer;
@@ -79,7 +79,7 @@ struct WVCryptoPlugin : public ICryptoPlugin {
};
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -28,11 +28,11 @@ static const size_t kAESBlockSize = 16;
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::BufferType;
using ::android::hardware::drm::V1_1::widevine::toVector;
using ::android::hardware::drm::V1_2::widevine::toVector;
using ::android::hardware::Void;
using wvcdm::CdmDecryptionParameters;
@@ -418,7 +418,7 @@ void WVCryptoPlugin::incrementIV(uint64_t increaseBy,
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -92,6 +92,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 \

View File

@@ -29,7 +29,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::BufferType;
@@ -39,7 +39,7 @@ using ::android::hardware::drm::V1_0::Pattern;
using ::android::hardware::drm::V1_0::SharedBuffer;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_0::SubSample;
using ::android::hardware::drm::V1_1::widevine::toHidlVec;
using ::android::hardware::drm::V1_2::widevine::toHidlVec;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_memory;
@@ -775,7 +775,7 @@ TEST_F(WVCryptoPluginTest, DisallowsUnopenedSessionIdChanges) {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

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

View File

@@ -12,7 +12,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
extern "C" {
@@ -27,7 +27,7 @@ ICryptoFactory* createCryptoFactory() {
} // extern "C"
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -16,7 +16,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::Status;
@@ -46,7 +46,7 @@ Return<void> WVCryptoFactory::createPlugin(
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -20,7 +20,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::drm::V1_0::Status;
@@ -70,7 +70,7 @@ bool WVDrmFactory::areSpoidsEnabled() {
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -9,7 +9,7 @@ service vendor.move_data_sh /system/bin/move_widevine_data.sh
disabled
oneshot
service vendor.drm-widevine-hal-1-1 /vendor/bin/hw/android.hardware.drm@1.1-service.widevine
service vendor.drm-widevine-hal-1-2 /vendor/bin/hw/android.hardware.drm@1.2-service.widevine
class hal
user media
group media mediadrm drmrpc

View File

@@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.drm@1.0-service.widevine"
#define LOG_TAG "WidevineHidlService"
#include <WVCryptoFactory.h>
#include <WVDrmFactory.h>
@@ -29,11 +28,11 @@ using ::android::sp;
using android::hardware::drm::V1_1::ICryptoFactory;
using android::hardware::drm::V1_1::IDrmFactory;
using wvdrm::hardware::drm::V1_1::widevine::WVCryptoFactory;
using wvdrm::hardware::drm::V1_1::widevine::WVDrmFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVCryptoFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVDrmFactory;
int main(int /* argc */, char** /* argv */) {
ALOGD("android.hardware.drm@1.1-service.widevine starting...");
ALOGD("android.hardware.drm@1.2-service.widevine starting...");
// The DRM HAL may communicate to other vendor components via
// /dev/vndbinder

View File

@@ -71,6 +71,7 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
libcutils \
libdl \
libhidlbase \

View File

@@ -10,7 +10,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::sp;
@@ -32,7 +32,7 @@ TEST(CreatePluginFactoriesTest, CreatesCryptoFactory) {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -10,10 +10,10 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using wvdrm::hardware::drm::V1_1::widevine::WVCryptoFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVCryptoFactory;
using ::android::sp;
const uint8_t kWidevineUUID[16] = {
@@ -49,7 +49,7 @@ TEST(WVCryptoFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -12,11 +12,11 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_1 {
namespace V1_2 {
namespace widevine {
using ::android::hardware::hidl_string;
using wvdrm::hardware::drm::V1_1::widevine::WVDrmFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVDrmFactory;
using namespace android;
@@ -113,7 +113,7 @@ TEST(WVDrmFactoryTest, CalculatesSpoidUseCorrectly) {
}
} // namespace widevine
} // namespace V1_1
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm