Implement Widevine drm HIDL HAL service.
Modify Android mediadrm and mediacrypto glue layer to use HIDL interface. Test: Play Movies (streaming and offline playback) Test: ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts -m GtsMediaTestCases Test: adb shell /system/bin/libwvdrmengine_hidl_test Test: adb shell /system/bin/libwvdrmmediacrypto_hidl_test Test: adb shell /system/bin/libwvdrmdrmplugin_hidl_test bug: 34628973 Change-Id: Icd5f2dd556acb9874697963b4d7d62cb7c943e74
This commit is contained in:
committed by
John W. Bruce
parent
a4506542df
commit
2dc53442e7
@@ -1,10 +1,14 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Builds libwvdrmengine_test
|
||||
#
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
WVCreatePluginFactories_test.cpp \
|
||||
WVCryptoFactory_test.cpp \
|
||||
WVDrmFactory_test.cpp \
|
||||
legacy_src/WVCreatePluginFactories_test.cpp \
|
||||
legacy_src/WVCryptoFactory_test.cpp \
|
||||
legacy_src/WVDrmFactory_test.cpp \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
frameworks/av/include \
|
||||
@@ -31,3 +35,44 @@ LOCAL_MODULE := libwvdrmengine_test
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Builds libwvdrmengine_hidl_test
|
||||
#
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
WVCreatePluginFactories_test.cpp \
|
||||
WVCryptoFactory_test.cpp \
|
||||
WVDrmFactory_test.cpp \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
frameworks/av/include \
|
||||
frameworks/native/include \
|
||||
vendor/widevine/libwvdrmengine/include_hidl \
|
||||
vendor/widevine/libwvdrmengine/include \
|
||||
vendor/widevine/libwvdrmengine/mediadrm/include_hidl \
|
||||
vendor/widevine/libwvdrmengine/mediadrm/include \
|
||||
vendor/widevine/libwvdrmengine/oemcrypto/include \
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libcrypto_static \
|
||||
libgtest \
|
||||
libgtest_main \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.drm@1.0 \
|
||||
libdl \
|
||||
libhidlbase \
|
||||
libhidlmemory \
|
||||
liblog \
|
||||
libmedia \
|
||||
libstagefright_foundation \
|
||||
libutils \
|
||||
libwvhidl \
|
||||
|
||||
LOCAL_MODULE := libwvdrmengine_hidl_test
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
@@ -3,21 +3,34 @@
|
||||
//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <UniquePtr.h>
|
||||
#include "WVCreatePluginFactories.h"
|
||||
|
||||
namespace wvdrm {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace widevine {
|
||||
|
||||
using ::android::sp;
|
||||
|
||||
using namespace android;
|
||||
|
||||
TEST(CreatePluginFactoriesTest, CreatesDrmFactory) {
|
||||
UniquePtr<DrmFactory> factory(createDrmFactory());
|
||||
sp<IDrmFactory> factory(createDrmFactory());
|
||||
|
||||
EXPECT_NE((DrmFactory*)NULL, factory.get()) <<
|
||||
EXPECT_NE((IDrmFactory*)NULL, factory.get()) <<
|
||||
"createDrmFactory() returned null";
|
||||
}
|
||||
|
||||
TEST(CreatePluginFactoriesTest, CreatesCryptoFactory) {
|
||||
UniquePtr<CryptoFactory> factory(createCryptoFactory());
|
||||
sp<ICryptoFactory> factory(createCryptoFactory());
|
||||
|
||||
EXPECT_NE((CryptoFactory*)NULL, factory.get()) <<
|
||||
EXPECT_NE((ICryptoFactory*)NULL, factory.get()) <<
|
||||
"createCryptoFactory() returned null";
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace wvdrm
|
||||
|
||||
@@ -2,12 +2,17 @@
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <UniquePtr.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "WVCryptoFactory.h"
|
||||
|
||||
using namespace wvdrm;
|
||||
namespace wvdrm {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace widevine {
|
||||
|
||||
using wvdrm::hardware::drm::V1_0::widevine::WVCryptoFactory;
|
||||
using ::android::sp;
|
||||
|
||||
const uint8_t kWidevineUUID[16] = {
|
||||
0xED,0xEF,0x8B,0xA9,0x79,0xD6,0x4A,0xCE,
|
||||
@@ -25,7 +30,7 @@ const uint8_t kUnknownUUID[16] = {
|
||||
};
|
||||
|
||||
TEST(WVCryptoFactoryTest, SupportsSupportedCryptoSchemes) {
|
||||
UniquePtr<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
sp<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
|
||||
EXPECT_TRUE(factory->isCryptoSchemeSupported(kWidevineUUID)) <<
|
||||
"WVPluginFactory does not support Widevine's UUID";
|
||||
@@ -35,8 +40,14 @@ TEST(WVCryptoFactoryTest, SupportsSupportedCryptoSchemes) {
|
||||
}
|
||||
|
||||
TEST(WVCryptoFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
|
||||
UniquePtr<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
sp<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
|
||||
EXPECT_FALSE(factory->isCryptoSchemeSupported(kUnknownUUID)) <<
|
||||
"WVPluginFactory incorrectly claims to support an unknown UUID";
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace wvdrm
|
||||
|
||||
@@ -3,10 +3,17 @@
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <UniquePtr.h>
|
||||
#include "WVDrmFactory.h"
|
||||
|
||||
using namespace wvdrm;
|
||||
namespace wvdrm {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace widevine {
|
||||
|
||||
using ::android::hardware::hidl_string;
|
||||
using wvdrm::hardware::drm::V1_0::widevine::WVDrmFactory;
|
||||
|
||||
using namespace android;
|
||||
|
||||
const uint8_t kWidevineUUID[16] = {
|
||||
@@ -44,16 +51,16 @@ TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
|
||||
TEST(WVDrmFactoryTest, SupportsSupportedContainerFormats) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/mp4"))) <<
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(hidl_string("video/mp4"))) <<
|
||||
"WVPluginFactory does not support ISO-BMFF video";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/mp4"))) <<
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(hidl_string("audio/mp4"))) <<
|
||||
"WVPluginFactory does not support ISO-BMFF audio";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/webm"))) <<
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(hidl_string("video/webm"))) <<
|
||||
"WVPluginFactory does not support WebM video";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/webm"))) <<
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(hidl_string("audio/webm"))) <<
|
||||
"WVPluginFactory does not support WebM audio";
|
||||
}
|
||||
|
||||
@@ -61,27 +68,33 @@ TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedContainerFormats) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
// Taken from Encoding.com's list of the most common internet video MIME-types
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-matroska"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/x-matroska"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Matroska";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-flv"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/x-flv"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Flash Video";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("application/x-mpegURL"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("application/x-mpegURL"))) <<
|
||||
"WVPluginFactory incorrectly claims to support m3u8 Indexes";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/MP2T"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/MP2T"))) <<
|
||||
"WVPluginFactory incorrectly claims to support MPEG-2 TS";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/3gpp"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/3gpp"))) <<
|
||||
"WVPluginFactory incorrectly claims to support 3GP Mobile";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/quicktime"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/quicktime"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Quicktime";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-msvideo"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/x-msvideo"))) <<
|
||||
"WVPluginFactory incorrectly claims to support AVI";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-ms-wmv"))) <<
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(hidl_string("video/x-ms-wmv"))) <<
|
||||
"WVPluginFactory incorrectly claims to support WMV";
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace wvdrm
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <UniquePtr.h>
|
||||
#include "WVCreatePluginFactories.h"
|
||||
|
||||
using namespace android;
|
||||
|
||||
TEST(CreatePluginFactoriesTest, CreatesDrmFactory) {
|
||||
UniquePtr<DrmFactory> factory(createDrmFactory());
|
||||
|
||||
EXPECT_NE((DrmFactory*)NULL, factory.get()) <<
|
||||
"createDrmFactory() returned null";
|
||||
}
|
||||
|
||||
TEST(CreatePluginFactoriesTest, CreatesCryptoFactory) {
|
||||
UniquePtr<CryptoFactory> factory(createCryptoFactory());
|
||||
|
||||
EXPECT_NE((CryptoFactory*)NULL, factory.get()) <<
|
||||
"createCryptoFactory() returned null";
|
||||
}
|
||||
42
libwvdrmengine/test/unit/legacy_src/WVCryptoFactory_test.cpp
Normal file
42
libwvdrmengine/test/unit/legacy_src/WVCryptoFactory_test.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <UniquePtr.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "WVCryptoFactory.h"
|
||||
|
||||
using namespace wvdrm;
|
||||
|
||||
const uint8_t kWidevineUUID[16] = {
|
||||
0xED,0xEF,0x8B,0xA9,0x79,0xD6,0x4A,0xCE,
|
||||
0xA3,0xC8,0x27,0xDC,0xD5,0x1D,0x21,0xED
|
||||
};
|
||||
|
||||
const uint8_t kOldNetflixWidevineUUID[16] = {
|
||||
0x29,0x70,0x1F,0xE4,0x3C,0xC7,0x4A,0x34,
|
||||
0x8C,0x5B,0xAE,0x90,0xC7,0x43,0x9A,0x47
|
||||
};
|
||||
|
||||
const uint8_t kUnknownUUID[16] = {
|
||||
0x6A,0x7F,0xAA,0xB0,0x83,0xC7,0x9E,0x20,
|
||||
0x08,0xBC,0xEF,0x32,0x34,0x1A,0x9A,0x26
|
||||
};
|
||||
|
||||
TEST(WVCryptoFactoryTest, SupportsSupportedCryptoSchemes) {
|
||||
UniquePtr<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
|
||||
EXPECT_TRUE(factory->isCryptoSchemeSupported(kWidevineUUID)) <<
|
||||
"WVPluginFactory does not support Widevine's UUID";
|
||||
|
||||
EXPECT_TRUE(factory->isCryptoSchemeSupported(kOldNetflixWidevineUUID)) <<
|
||||
"WVPluginFactory does not support the old Netflix Widevine UUID";
|
||||
}
|
||||
|
||||
TEST(WVCryptoFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
|
||||
UniquePtr<WVCryptoFactory> factory(new WVCryptoFactory());
|
||||
|
||||
EXPECT_FALSE(factory->isCryptoSchemeSupported(kUnknownUUID)) <<
|
||||
"WVPluginFactory incorrectly claims to support an unknown UUID";
|
||||
}
|
||||
87
libwvdrmengine/test/unit/legacy_src/WVDrmFactory_test.cpp
Normal file
87
libwvdrmengine/test/unit/legacy_src/WVDrmFactory_test.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <UniquePtr.h>
|
||||
#include "WVDrmFactory.h"
|
||||
|
||||
using namespace wvdrm;
|
||||
using namespace android;
|
||||
|
||||
const uint8_t kWidevineUUID[16] = {
|
||||
0xED,0xEF,0x8B,0xA9,0x79,0xD6,0x4A,0xCE,
|
||||
0xA3,0xC8,0x27,0xDC,0xD5,0x1D,0x21,0xED
|
||||
};
|
||||
|
||||
const uint8_t kOldNetflixWidevineUUID[16] = {
|
||||
0x29,0x70,0x1F,0xE4,0x3C,0xC7,0x4A,0x34,
|
||||
0x8C,0x5B,0xAE,0x90,0xC7,0x43,0x9A,0x47
|
||||
};
|
||||
|
||||
const uint8_t kUnknownUUID[16] = {
|
||||
0x6A,0x7F,0xAA,0xB0,0x83,0xC7,0x9E,0x20,
|
||||
0x08,0xBC,0xEF,0x32,0x34,0x1A,0x9A,0x26
|
||||
};
|
||||
|
||||
TEST(WVDrmFactoryTest, SupportsSupportedCryptoSchemes) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
EXPECT_TRUE(factory.isCryptoSchemeSupported(kWidevineUUID)) <<
|
||||
"WVPluginFactory does not support Widevine's UUID";
|
||||
|
||||
EXPECT_TRUE(factory.isCryptoSchemeSupported(kOldNetflixWidevineUUID)) <<
|
||||
"WVPluginFactory does not support the old Netflix Widevine UUID";
|
||||
}
|
||||
|
||||
TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
EXPECT_FALSE(factory.isCryptoSchemeSupported(kUnknownUUID)) <<
|
||||
"WVPluginFactory incorrectly claims to support an unknown UUID";
|
||||
}
|
||||
|
||||
TEST(WVDrmFactoryTest, SupportsSupportedContainerFormats) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/mp4"))) <<
|
||||
"WVPluginFactory does not support ISO-BMFF video";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/mp4"))) <<
|
||||
"WVPluginFactory does not support ISO-BMFF audio";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/webm"))) <<
|
||||
"WVPluginFactory does not support WebM video";
|
||||
|
||||
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/webm"))) <<
|
||||
"WVPluginFactory does not support WebM audio";
|
||||
}
|
||||
|
||||
TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedContainerFormats) {
|
||||
WVDrmFactory factory;
|
||||
|
||||
// Taken from Encoding.com's list of the most common internet video MIME-types
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-matroska"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Matroska";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-flv"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Flash Video";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("application/x-mpegURL"))) <<
|
||||
"WVPluginFactory incorrectly claims to support m3u8 Indexes";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/MP2T"))) <<
|
||||
"WVPluginFactory incorrectly claims to support MPEG-2 TS";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/3gpp"))) <<
|
||||
"WVPluginFactory incorrectly claims to support 3GP Mobile";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/quicktime"))) <<
|
||||
"WVPluginFactory incorrectly claims to support Quicktime";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-msvideo"))) <<
|
||||
"WVPluginFactory incorrectly claims to support AVI";
|
||||
|
||||
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-ms-wmv"))) <<
|
||||
"WVPluginFactory incorrectly claims to support WMV";
|
||||
}
|
||||
Reference in New Issue
Block a user