Reorganize drm hal modules
Previously the drm and crypto plugins were separate hals. This implied a separation of implementation libraries which causes problems for some drm schemes. The reorganization combines the hals into a single interface under drm. Tests: basic gtests passing Change-Id: I5cde6ff9f60625a0219731c4dbfcaefbd9f27f88 related-to-bug: 32815560
This commit is contained in:
parent
f21cdafdaf
commit
da002fe641
27 changed files with 295 additions and 615 deletions
88
drm/1.0/Android.bp
Normal file
88
drm/1.0/Android.bp
Normal file
|
@ -0,0 +1,88 @@
|
|||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm@1.0_genc++",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"ICryptoFactory.hal",
|
||||
"ICryptoPlugin.hal",
|
||||
"IDrmFactory.hal",
|
||||
"IDrmPlugin.hal",
|
||||
"IDrmPluginListener.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/1.0/types.cpp",
|
||||
"android/hardware/drm/1.0/CryptoFactoryAll.cpp",
|
||||
"android/hardware/drm/1.0/CryptoPluginAll.cpp",
|
||||
"android/hardware/drm/1.0/DrmFactoryAll.cpp",
|
||||
"android/hardware/drm/1.0/DrmPluginAll.cpp",
|
||||
"android/hardware/drm/1.0/DrmPluginListenerAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm@1.0_genc++_headers",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"ICryptoFactory.hal",
|
||||
"ICryptoPlugin.hal",
|
||||
"IDrmFactory.hal",
|
||||
"IDrmPlugin.hal",
|
||||
"IDrmPluginListener.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/1.0/types.h",
|
||||
"android/hardware/drm/1.0/ICryptoFactory.h",
|
||||
"android/hardware/drm/1.0/IHwCryptoFactory.h",
|
||||
"android/hardware/drm/1.0/BnHwCryptoFactory.h",
|
||||
"android/hardware/drm/1.0/BpHwCryptoFactory.h",
|
||||
"android/hardware/drm/1.0/BsCryptoFactory.h",
|
||||
"android/hardware/drm/1.0/ICryptoPlugin.h",
|
||||
"android/hardware/drm/1.0/IHwCryptoPlugin.h",
|
||||
"android/hardware/drm/1.0/BnHwCryptoPlugin.h",
|
||||
"android/hardware/drm/1.0/BpHwCryptoPlugin.h",
|
||||
"android/hardware/drm/1.0/BsCryptoPlugin.h",
|
||||
"android/hardware/drm/1.0/IDrmFactory.h",
|
||||
"android/hardware/drm/1.0/IHwDrmFactory.h",
|
||||
"android/hardware/drm/1.0/BnHwDrmFactory.h",
|
||||
"android/hardware/drm/1.0/BpHwDrmFactory.h",
|
||||
"android/hardware/drm/1.0/BsDrmFactory.h",
|
||||
"android/hardware/drm/1.0/IDrmPlugin.h",
|
||||
"android/hardware/drm/1.0/IHwDrmPlugin.h",
|
||||
"android/hardware/drm/1.0/BnHwDrmPlugin.h",
|
||||
"android/hardware/drm/1.0/BpHwDrmPlugin.h",
|
||||
"android/hardware/drm/1.0/BsDrmPlugin.h",
|
||||
"android/hardware/drm/1.0/IDrmPluginListener.h",
|
||||
"android/hardware/drm/1.0/IHwDrmPluginListener.h",
|
||||
"android/hardware/drm/1.0/BnHwDrmPluginListener.h",
|
||||
"android/hardware/drm/1.0/BpHwDrmPluginListener.h",
|
||||
"android/hardware/drm/1.0/BsDrmPluginListener.h",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.drm@1.0",
|
||||
generated_sources: ["android.hardware.drm@1.0_genc++"],
|
||||
generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
|
||||
export_generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.hardware.drm.crypto@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
import ICryptoPlugin;
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.hardware.drm.crypto@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
import android.hardware.drm.crypto@1.0::types;
|
||||
import android.hardware.drm@1.0::types;
|
||||
|
||||
/**
|
||||
* Ref: frameworks/native/include/media/hardware/CryptoAPI.h:CryptoPlugin
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.hardware.drm.drm@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
import IDrmPlugin;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.hardware.drm.drm@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
import IDrmPluginListener;
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.drm.drm@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
import android.hardware.drm.drm@1.0::types;
|
||||
import android.hardware.drm@1.0::types;
|
||||
|
||||
/**
|
||||
* Ref: frameworks/native/include/media/drm/DrmAPI.h:DrmPluginListener
|
|
@ -14,6 +14,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
############# Build legacy drm service ############
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -24,16 +26,14 @@ LOCAL_SRC_FILES := \
|
|||
service.cpp \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.drm@1.0 \
|
||||
android.hidl.memory@1.0 \
|
||||
libhidlbase \
|
||||
libhidltransport \
|
||||
liblog \
|
||||
libhwbinder \
|
||||
libutils \
|
||||
libhardware \
|
||||
android.hardware.drm.drm@1.0 \
|
||||
android.hardware.drm.crypto@1.0 \
|
||||
android.hidl.memory@1.0 \
|
||||
|
||||
libhwbinder \
|
||||
liblog \
|
||||
libutils \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
hardware/interfaces/drm
|
||||
|
@ -43,3 +43,37 @@ LOCAL_C_INCLUDES := \
|
|||
LOCAL_32_BIT_ONLY := true
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
############# Build legacy drm impl library ############
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.drm@1.0-impl
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_SRC_FILES := \
|
||||
DrmFactory.cpp \
|
||||
DrmPlugin.cpp \
|
||||
CryptoFactory.cpp \
|
||||
CryptoPlugin.cpp \
|
||||
TypeConvert.cpp \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.drm@1.0 \
|
||||
android.hidl.memory@1.0 \
|
||||
libhidlbase \
|
||||
libhidlmemory \
|
||||
libhidltransport \
|
||||
libhwbinder \
|
||||
liblog \
|
||||
libmediadrm \
|
||||
libstagefright_foundation \
|
||||
libutils \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
frameworks/native/include \
|
||||
frameworks/av/include
|
||||
|
||||
# TODO: The legacy DRM plugins only support 32-bit. They need
|
||||
# to be migrated to 64-bit (b/18948909)
|
||||
LOCAL_32_BIT_ONLY := true
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -30,7 +29,7 @@ namespace implementation {
|
|||
loader("/vendor/lib/mediadrm", "createCryptoFactory") {
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::ICryptoFactory follow.
|
||||
Return<bool> CryptoFactory::isCryptoSchemeSupported(
|
||||
const hidl_array<uint8_t, 16>& uuid) {
|
||||
for (size_t i = 0; i < loader.factoryCount(); i++) {
|
||||
|
@ -68,7 +67,6 @@ namespace implementation {
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
|
||||
#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
|
||||
#ifndef ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
|
||||
#define ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
|
||||
|
||||
#include <android/hardware/drm/crypto/1.0/ICryptoFactory.h>
|
||||
#include <android/hardware/drm/1.0/ICryptoFactory.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <media/hardware/CryptoAPI.h>
|
||||
#include <media/PluginLoader.h>
|
||||
|
@ -25,12 +25,11 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::drm::crypto::V1_0::ICryptoFactory;
|
||||
using ::android::hardware::drm::crypto::V1_0::ICryptoPlugin;
|
||||
using ::android::hardware::drm::V1_0::ICryptoFactory;
|
||||
using ::android::hardware::drm::V1_0::ICryptoPlugin;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
@ -42,7 +41,7 @@ struct CryptoFactory : public ICryptoFactory {
|
|||
CryptoFactory();
|
||||
virtual ~CryptoFactory() {}
|
||||
|
||||
// Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::ICryptoFactory follow.
|
||||
|
||||
Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
|
||||
override;
|
||||
|
@ -62,9 +61,8 @@ extern "C" ICryptoFactory* HIDL_FETCH_ICryptoFactory(const char* name);
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
|
||||
#endif // ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
|
|
@ -28,11 +28,10 @@ using android::hidl::memory::V1_0::IMemory;
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::drm::crypto::V1_0::ICryptoPlugin follow
|
||||
// Methods from ::android::hardware::drm::V1_0::ICryptoPlugin follow
|
||||
Return<bool> CryptoPlugin::requiresSecureDecoderComponent(
|
||||
const hidl_string& mime) {
|
||||
return mLegacyPlugin->requiresSecureDecoderComponent(mime);
|
||||
|
@ -58,7 +57,7 @@ namespace implementation {
|
|||
const hidl_array<uint8_t, 16>& keyId,
|
||||
const hidl_array<uint8_t, 16>& iv, Mode mode,
|
||||
const Pattern& pattern, const hidl_vec<SubSample>& subSamples,
|
||||
const SharedBuffer& source, uint32_t offset,
|
||||
const SharedBuffer& source, uint64_t offset,
|
||||
const DestinationBuffer& destination,
|
||||
decrypt_cb _hidl_cb) {
|
||||
|
||||
|
@ -138,7 +137,6 @@ namespace implementation {
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -14,26 +14,25 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
|
||||
#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
|
||||
#ifndef ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
|
||||
#define ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
|
||||
|
||||
#include <media/hardware/CryptoAPI.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <android/hardware/drm/crypto/1.0/ICryptoPlugin.h>
|
||||
#include <android/hardware/drm/1.0/ICryptoPlugin.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <media/hardware/CryptoAPI.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::drm::crypto::V1_0::DestinationBuffer;
|
||||
using ::android::hardware::drm::crypto::V1_0::ICryptoPlugin;
|
||||
using ::android::hardware::drm::crypto::V1_0::Mode;
|
||||
using ::android::hardware::drm::crypto::V1_0::Pattern;
|
||||
using ::android::hardware::drm::crypto::V1_0::SubSample;
|
||||
using ::android::hardware::drm::V1_0::DestinationBuffer;
|
||||
using ::android::hardware::drm::V1_0::ICryptoPlugin;
|
||||
using ::android::hardware::drm::V1_0::Mode;
|
||||
using ::android::hardware::drm::V1_0::Pattern;
|
||||
using ::android::hardware::drm::V1_0::SubSample;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
@ -47,7 +46,7 @@ struct CryptoPlugin : public ICryptoPlugin {
|
|||
|
||||
~CryptoPlugin() {delete mLegacyPlugin;}
|
||||
|
||||
// Methods from ::android::hardware::drm::crypto::V1_0::ICryptoPlugin
|
||||
// Methods from ::android::hardware::drm::V1_0::ICryptoPlugin
|
||||
// follow.
|
||||
|
||||
Return<bool> requiresSecureDecoderComponent(const hidl_string& mime)
|
||||
|
@ -64,7 +63,7 @@ struct CryptoPlugin : public ICryptoPlugin {
|
|||
Return<void> decrypt(bool secure, const hidl_array<uint8_t, 16>& keyId,
|
||||
const hidl_array<uint8_t, 16>& iv, Mode mode, const Pattern& pattern,
|
||||
const hidl_vec<SubSample>& subSamples, const SharedBuffer& source,
|
||||
uint32_t offset, const DestinationBuffer& destination,
|
||||
uint64_t offset, const DestinationBuffer& destination,
|
||||
decrypt_cb _hidl_cb) override;
|
||||
|
||||
private:
|
||||
|
@ -78,9 +77,8 @@ private:
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
|
||||
#endif // ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
|
|
@ -22,7 +22,6 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -30,7 +29,7 @@ namespace implementation {
|
|||
loader("/vendor/lib/mediadrm", "createDrmFactory") {
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::drm::drm::V1_0::IDrmFactory follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::IDrmFactory follow.
|
||||
Return<bool> DrmFactory::isCryptoSchemeSupported (
|
||||
const hidl_array<uint8_t, 16>& uuid) {
|
||||
for (size_t i = 0; i < loader.factoryCount(); i++) {
|
||||
|
@ -80,6 +79,5 @@ namespace implementation {
|
|||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
|
||||
#define ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
|
||||
#ifndef ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
|
||||
#define ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
|
||||
|
||||
#include <android/hardware/drm/drm/1.0/IDrmFactory.h>
|
||||
#include <android/hardware/drm/1.0/IDrmFactory.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <media/drm/DrmAPI.h>
|
||||
#include <media/PluginLoader.h>
|
||||
|
@ -25,12 +25,11 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::drm::drm::V1_0::IDrmFactory;
|
||||
using ::android::hardware::drm::drm::V1_0::IDrmPlugin;
|
||||
using ::android::hardware::drm::V1_0::IDrmFactory;
|
||||
using ::android::hardware::drm::V1_0::IDrmPlugin;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
@ -42,7 +41,7 @@ struct DrmFactory : public IDrmFactory {
|
|||
DrmFactory();
|
||||
virtual ~DrmFactory() {}
|
||||
|
||||
// Methods from ::android::hardware::drm::drm::V1_0::IDrmFactory follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::IDrmFactory follow.
|
||||
|
||||
Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
|
||||
override;
|
||||
|
@ -65,8 +64,7 @@ extern "C" IDrmFactory* HIDL_FETCH_IDrmFactory(const char* name);
|
|||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
|
||||
#endif // ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
|
|
@ -23,11 +23,10 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::drm::drm::V1_0::IDrmPlugin follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::IDrmPlugin follow.
|
||||
|
||||
Return<void> DrmPlugin::openSession(openSession_cb _hidl_cb) {
|
||||
Vector<uint8_t> legacySessionId;
|
||||
|
@ -422,6 +421,5 @@ namespace implementation {
|
|||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -14,30 +14,28 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
|
||||
#define ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
|
||||
#ifndef ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
|
||||
#define ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
|
||||
|
||||
#include <media/drm/DrmAPI.h>
|
||||
#include <android/hardware/drm/drm/1.0/IDrmPlugin.h>
|
||||
#include <android/hardware/drm/drm/1.0/IDrmPluginListener.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <android/hardware/drm/1.0/IDrmPlugin.h>
|
||||
#include <android/hardware/drm/1.0/IDrmPluginListener.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <media/drm/DrmAPI.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::drm::drm::V1_0::EventType;
|
||||
using ::android::hardware::drm::drm::V1_0::IDrmPlugin;
|
||||
using ::android::hardware::drm::drm::V1_0::IDrmPluginListener;
|
||||
using ::android::hardware::drm::drm::V1_0::KeyRequestType;
|
||||
using ::android::hardware::drm::drm::V1_0::KeyStatus;
|
||||
using ::android::hardware::drm::drm::V1_0::KeyType;
|
||||
using ::android::hardware::drm::drm::V1_0::KeyValue;
|
||||
using ::android::hardware::drm::drm::V1_0::SecureStop;
|
||||
using ::android::hardware::drm::V1_0::EventType;
|
||||
using ::android::hardware::drm::V1_0::IDrmPlugin;
|
||||
using ::android::hardware::drm::V1_0::IDrmPluginListener;
|
||||
using ::android::hardware::drm::V1_0::KeyRequestType;
|
||||
using ::android::hardware::drm::V1_0::KeyStatus;
|
||||
using ::android::hardware::drm::V1_0::KeyType;
|
||||
using ::android::hardware::drm::V1_0::KeyValue;
|
||||
using ::android::hardware::drm::V1_0::SecureStop;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
@ -50,7 +48,7 @@ struct DrmPlugin : public IDrmPlugin, android::DrmPluginListener {
|
|||
DrmPlugin(android::DrmPlugin *plugin) : mLegacyPlugin(plugin) {}
|
||||
~DrmPlugin() {delete mLegacyPlugin;}
|
||||
|
||||
// Methods from ::android::hardware::drm::drm::V1_0::IDrmPlugin follow.
|
||||
// Methods from ::android::hardware::drm::V1_0::IDrmPlugin follow.
|
||||
|
||||
Return<void> openSession(openSession_cb _hidl_cb) override;
|
||||
|
||||
|
@ -165,8 +163,7 @@ private:
|
|||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
|
||||
#endif // ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
|
|
@ -19,7 +19,6 @@
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -53,6 +52,9 @@ Status toStatus(status_t legacyStatus) {
|
|||
case android::ERROR_DRM_RESOURCE_BUSY:
|
||||
status = Status::ERROR_DRM_RESOURCE_BUSY;
|
||||
break;
|
||||
case android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
|
||||
status = Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
|
||||
break;
|
||||
case android::ERROR_DRM_DEVICE_REVOKED:
|
||||
status = Status::ERROR_DRM_DEVICE_REVOKED;
|
||||
break;
|
||||
|
@ -68,6 +70,5 @@ Status toStatus(status_t legacyStatus) {
|
|||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -14,20 +14,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
|
||||
#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
|
||||
#ifndef ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
|
||||
#define ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
|
||||
|
||||
#include <utils/Vector.h>
|
||||
#include <android/hardware/drm/1.0/types.h>
|
||||
#include <media/stagefright/MediaErrors.h>
|
||||
#include <media/hardware/CryptoAPI.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <android/hardware/drm/crypto/1.0/types.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -75,9 +71,8 @@ Status toStatus(status_t legacyStatus);
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
|
||||
#endif // ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
#define LOG_TAG "android.hardware.drm@1.0-service"
|
||||
|
||||
#include <crypto/1.0/default/CryptoFactory.h>
|
||||
#include <drm/1.0/default/DrmFactory.h>
|
||||
#include <1.0/default/CryptoFactory.h>
|
||||
#include <1.0/default/DrmFactory.h>
|
||||
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
|
@ -26,8 +26,8 @@ using android::hardware::configureRpcThreadpool;
|
|||
using android::hardware::joinRpcThreadpool;
|
||||
using android::hardware::registerPassthroughServiceImplementation;
|
||||
|
||||
using android::hardware::drm::crypto::V1_0::ICryptoFactory;
|
||||
using android::hardware::drm::drm::V1_0::IDrmFactory;
|
||||
using android::hardware::drm::V1_0::ICryptoFactory;
|
||||
using android::hardware::drm::V1_0::IDrmFactory;
|
||||
|
||||
int main() {
|
||||
ALOGD("android.hardware.drm@1.0-service starting...");
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.drm.drm@1.0;
|
||||
package android.hardware.drm@1.0;
|
||||
|
||||
enum Status : uint32_t {
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ enum Status : uint32_t {
|
|||
ERROR_DRM_INVALID_STATE,
|
||||
|
||||
/**
|
||||
* The Drm plugin must return BAD_VALUE whenever an illegal parameter is
|
||||
* The DRM plugin must return BAD_VALUE whenever an illegal parameter is
|
||||
* passed to one of the interface functions.
|
||||
*/
|
||||
BAD_VALUE,
|
||||
|
@ -74,7 +74,15 @@ enum Status : uint32_t {
|
|||
ERROR_DRM_RESOURCE_BUSY,
|
||||
|
||||
/**
|
||||
* The Drm Plugin must return ERROR_DRM_DEVICE_REVOKED from
|
||||
* The DRM Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION
|
||||
* when the output protection level enabled on the device is not
|
||||
* sufficient to meet the requirements in the license policy. HDCP is an
|
||||
* example of a form of output protection.
|
||||
*/
|
||||
ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION,
|
||||
|
||||
/**
|
||||
* The DRM Plugin must return ERROR_DRM_DEVICE_REVOKED from
|
||||
* provideProvisionResponse and provideKeyResponse if the response indicates
|
||||
* that the device has been revoked. Device revocation means that the device
|
||||
* is no longer permitted to play content.
|
||||
|
@ -237,3 +245,92 @@ struct SecureStop {
|
|||
};
|
||||
|
||||
typedef vec<uint8_t> SecureStopId;
|
||||
|
||||
|
||||
/**
|
||||
* Enumerate the supported crypto modes
|
||||
*/
|
||||
enum Mode : uint32_t {
|
||||
UNENCRYPTED = 0, // Samples are unencrypted
|
||||
AES_CTR = 1, // Samples are encrypted with AES CTR mode
|
||||
AES_CBC_CTS = 2, // Samples are encrypted with AES CBC CTS mode
|
||||
AES_CBC = 3, // Samples are encrypted with AES CBC mode
|
||||
};
|
||||
|
||||
/**
|
||||
* A subsample consists of some number of bytes of clear (unencrypted)
|
||||
* data followed by a number of bytes of encrypted data.
|
||||
*/
|
||||
struct SubSample {
|
||||
uint32_t numBytesOfClearData;
|
||||
uint32_t numBytesOfEncryptedData;
|
||||
};
|
||||
|
||||
/**
|
||||
* A crypto Pattern is a repeating sequence of encrypted and clear blocks
|
||||
* occuring within the bytes indicated by mNumBytesOfEncryptedDatad bytes
|
||||
* of a subsample. Patterns are used to reduce the CPU overhead of
|
||||
* decrypting samples. As an example, HLS uses 1:9 patterns where every
|
||||
* 10th block is encrypted.
|
||||
*/
|
||||
struct Pattern {
|
||||
/**
|
||||
* The number of blocks to be encrypted in the pattern. If zero,
|
||||
* pattern encryption is inoperative.
|
||||
*/
|
||||
uint32_t encryptBlocks;
|
||||
|
||||
/**
|
||||
* The number of blocks to be skipped (left clear) in the pattern. If
|
||||
* zero, pattern encryption is inoperative.
|
||||
*/
|
||||
uint32_t skipBlocks;
|
||||
};
|
||||
|
||||
enum BufferType : uint32_t {
|
||||
SHARED_MEMORY = 0,
|
||||
NATIVE_HANDLE = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* A SharedBuffer describes a decrypt buffer which is defined by an offset and
|
||||
* a size. The offset is relative to the shared memory base which is established
|
||||
* using setSharedMemoryBase().
|
||||
*/
|
||||
struct SharedBuffer {
|
||||
/**
|
||||
* The offset from the shared memory base
|
||||
*/
|
||||
uint64_t offset;
|
||||
|
||||
/**
|
||||
* The size of the shared buffer in bytes
|
||||
*/
|
||||
uint64_t size;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A decrypt destination buffer can be either normal user-space shared
|
||||
* memory for the non-secure decrypt case, or it can be a secure buffer
|
||||
* which is referenced by a native-handle. The native handle is allocated
|
||||
* by the vendor's buffer allocator.
|
||||
*/
|
||||
struct DestinationBuffer {
|
||||
/**
|
||||
* The type of the buffer
|
||||
*/
|
||||
BufferType type;
|
||||
|
||||
/**
|
||||
* If type == SHARED_MEMORY, the decrypted data must be written
|
||||
* to user-space non-secure shared memory.
|
||||
*/
|
||||
SharedBuffer nonsecureMemory;
|
||||
|
||||
/**
|
||||
* If type == NATIVE_HANDLE, the decrypted data must be written
|
||||
* to secure memory referenced by the vendor's buffer allocator.
|
||||
*/
|
||||
handle secureMemory;
|
||||
};
|
|
@ -1,5 +1,4 @@
|
|||
// This is an autogenerated file, do not edit.
|
||||
subdirs = [
|
||||
"crypto/1.0",
|
||||
"drm/1.0",
|
||||
"1.0",
|
||||
]
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm.crypto@1.0_genc++",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.crypto@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"ICryptoFactory.hal",
|
||||
"ICryptoPlugin.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/crypto/1.0/types.cpp",
|
||||
"android/hardware/drm/crypto/1.0/CryptoFactoryAll.cpp",
|
||||
"android/hardware/drm/crypto/1.0/CryptoPluginAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm.crypto@1.0_genc++_headers",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.crypto@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"ICryptoFactory.hal",
|
||||
"ICryptoPlugin.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/crypto/1.0/types.h",
|
||||
"android/hardware/drm/crypto/1.0/ICryptoFactory.h",
|
||||
"android/hardware/drm/crypto/1.0/IHwCryptoFactory.h",
|
||||
"android/hardware/drm/crypto/1.0/BnHwCryptoFactory.h",
|
||||
"android/hardware/drm/crypto/1.0/BpHwCryptoFactory.h",
|
||||
"android/hardware/drm/crypto/1.0/BsCryptoFactory.h",
|
||||
"android/hardware/drm/crypto/1.0/ICryptoPlugin.h",
|
||||
"android/hardware/drm/crypto/1.0/IHwCryptoPlugin.h",
|
||||
"android/hardware/drm/crypto/1.0/BnHwCryptoPlugin.h",
|
||||
"android/hardware/drm/crypto/1.0/BpHwCryptoPlugin.h",
|
||||
"android/hardware/drm/crypto/1.0/BsCryptoPlugin.h",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.drm.crypto@1.0",
|
||||
generated_sources: ["android.hardware.drm.crypto@1.0_genc++"],
|
||||
generated_headers: ["android.hardware.drm.crypto@1.0_genc++_headers"],
|
||||
export_generated_headers: ["android.hardware.drm.crypto@1.0_genc++_headers"],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
# Copyright (C) 2016, The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.drm.crypto@1.0-impl
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_SRC_FILES := \
|
||||
CryptoFactory.cpp \
|
||||
CryptoPlugin.cpp \
|
||||
TypeConvert.cpp \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libhidlbase \
|
||||
libhidltransport \
|
||||
libhwbinder \
|
||||
libhidlmemory \
|
||||
libutils \
|
||||
liblog \
|
||||
libmediadrm \
|
||||
libstagefright_foundation \
|
||||
android.hardware.drm.crypto@1.0 \
|
||||
android.hidl.memory@1.0 \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
frameworks/native/include \
|
||||
frameworks/av/include
|
||||
|
||||
# TODO: The legacy DRM plugins only support 32-bit. They need
|
||||
# to be migrated to 64-bit (b/18948909)
|
||||
LOCAL_32_BIT_ONLY := true
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "TypeConvert.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace crypto {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
Status toStatus(status_t legacyStatus) {
|
||||
Status status;
|
||||
switch(legacyStatus) {
|
||||
case android::OK:
|
||||
status = Status::OK;
|
||||
break;
|
||||
case android::ERROR_DRM_NO_LICENSE:
|
||||
status = Status::ERROR_DRM_NO_LICENSE;
|
||||
break;
|
||||
case android::ERROR_DRM_LICENSE_EXPIRED:
|
||||
status = Status::ERROR_DRM_LICENSE_EXPIRED;
|
||||
break;
|
||||
case android::ERROR_DRM_RESOURCE_BUSY:
|
||||
status = Status::ERROR_DRM_RESOURCE_BUSY;
|
||||
break;
|
||||
case android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
|
||||
status = Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
|
||||
break;
|
||||
case android::ERROR_DRM_SESSION_NOT_OPENED:
|
||||
status = Status::ERROR_DRM_SESSION_NOT_OPENED;
|
||||
break;
|
||||
case android::ERROR_DRM_CANNOT_HANDLE:
|
||||
case android::BAD_VALUE:
|
||||
status = Status::ERROR_DRM_CANNOT_HANDLE;
|
||||
break;
|
||||
default:
|
||||
ALOGW("Unable to convert legacy status: %d, defaulting to UNKNOWN",
|
||||
legacyStatus);
|
||||
status = Status::ERROR_UNKNOWN_CRYPTO_EXCEPTION;
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace crypto
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -1,158 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.drm.crypto@1.0;
|
||||
|
||||
enum Status : uint32_t {
|
||||
/**
|
||||
* The Crypto plugin must return OK when an operation completes without any
|
||||
* errors.
|
||||
*/
|
||||
OK,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_NO_LICENSE if decryption is
|
||||
* attempted when the license keys have not been loaded into the crypto
|
||||
* session.
|
||||
*/
|
||||
ERROR_DRM_NO_LICENSE,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_LICENSE_EXPIRED if decryption
|
||||
* is attempted when the license keys have expired and are no longer usable.
|
||||
*/
|
||||
ERROR_DRM_LICENSE_EXPIRED,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_RESOURCE_BUSY when a required
|
||||
* crypto resource cannot be allocated while attempting decryption.
|
||||
*/
|
||||
ERROR_DRM_RESOURCE_BUSY,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION
|
||||
* when the output protection level enabled on the device is not
|
||||
* sufficient to meet the requirements in the license policy. HDCP is an
|
||||
* example of a form of output protection.
|
||||
*/
|
||||
ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_SESSION_NOT_OPENED when
|
||||
* decryption is attempted on a session that is not opened.
|
||||
*/
|
||||
ERROR_DRM_SESSION_NOT_OPENED,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_DRM_CANNOT_HANDLE when an operation
|
||||
* is attempted that cannot be supported by the crypto system of the device.
|
||||
*/
|
||||
ERROR_DRM_CANNOT_HANDLE,
|
||||
|
||||
/**
|
||||
* The Crypto Plugin must return ERROR_UNKNOWN_CRYPTO_EXCEPTION in any
|
||||
* fatal condition that is not covered by the other error messages.
|
||||
*/
|
||||
ERROR_UNKNOWN_CRYPTO_EXCEPTION,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumerate the supported crypto modes
|
||||
*/
|
||||
enum Mode : uint32_t {
|
||||
UNENCRYPTED = 0, // Samples are unencrypted
|
||||
AES_CTR = 1, // Samples are encrypted with AES CTR mode
|
||||
AES_CBC_CTS = 2, // Samples are encrypted with AES CBC CTS mode
|
||||
AES_CBC = 3, // Samples are encrypted with AES CBC mode
|
||||
};
|
||||
|
||||
/**
|
||||
* A subsample consists of some number of bytes of clear (unencrypted)
|
||||
* data followed by a number of bytes of encrypted data.
|
||||
*/
|
||||
struct SubSample {
|
||||
uint32_t numBytesOfClearData;
|
||||
uint32_t numBytesOfEncryptedData;
|
||||
};
|
||||
|
||||
/**
|
||||
* A crypto Pattern is a repeating sequence of encrypted and clear blocks
|
||||
* occuring within the bytes indicated by mNumBytesOfEncryptedDatad bytes
|
||||
* of a subsample. Patterns are used to reduce the CPU overhead of
|
||||
* decrypting samples. As an example, HLS uses 1:9 patterns where every
|
||||
* 10th block is encrypted.
|
||||
*/
|
||||
struct Pattern {
|
||||
/**
|
||||
* The number of blocks to be encrypted in the pattern. If zero,
|
||||
* pattern encryption is inoperative.
|
||||
*/
|
||||
uint32_t encryptBlocks;
|
||||
|
||||
/**
|
||||
* The number of blocks to be skipped (left clear) in the pattern. If
|
||||
* zero, pattern encryption is inoperative.
|
||||
*/
|
||||
uint32_t skipBlocks;
|
||||
};
|
||||
|
||||
enum BufferType : uint32_t {
|
||||
SHARED_MEMORY = 0,
|
||||
NATIVE_HANDLE = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* A SharedBuffer describes a decrypt buffer which is defined by an offset and
|
||||
* a size. The offset is relative to the shared memory base which is established
|
||||
* using setSharedMemoryBase().
|
||||
*/
|
||||
struct SharedBuffer {
|
||||
/**
|
||||
* The offset from the shared memory base
|
||||
*/
|
||||
uint64_t offset;
|
||||
|
||||
/**
|
||||
* The size of the shared buffer in bytes
|
||||
*/
|
||||
uint64_t size;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A decrypt destination buffer can be either normal user-space shared
|
||||
* memory for the non-secure decrypt case, or it can be a secure buffer
|
||||
* which is referenced by a native-handle. The native handle is allocated
|
||||
* by the vendor's buffer allocator.
|
||||
*/
|
||||
struct DestinationBuffer {
|
||||
/**
|
||||
* The type of the buffer
|
||||
*/
|
||||
BufferType type;
|
||||
|
||||
/**
|
||||
* If type == SHARED_MEMORY, the decrypted data must be written
|
||||
* to user-space non-secure shared memory.
|
||||
*/
|
||||
SharedBuffer nonsecureMemory;
|
||||
|
||||
/**
|
||||
* If type == NATIVE_HANDLE, the decrypted data must be written
|
||||
* to secure memory referenced by the vendor's buffer allocator.
|
||||
*/
|
||||
handle secureMemory;
|
||||
};
|
|
@ -1,72 +0,0 @@
|
|||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm.drm@1.0_genc++",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.drm@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IDrmFactory.hal",
|
||||
"IDrmPlugin.hal",
|
||||
"IDrmPluginListener.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/drm/1.0/types.cpp",
|
||||
"android/hardware/drm/drm/1.0/DrmFactoryAll.cpp",
|
||||
"android/hardware/drm/drm/1.0/DrmPluginAll.cpp",
|
||||
"android/hardware/drm/drm/1.0/DrmPluginListenerAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.drm.drm@1.0_genc++_headers",
|
||||
tools: ["hidl-gen"],
|
||||
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.drm@1.0",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IDrmFactory.hal",
|
||||
"IDrmPlugin.hal",
|
||||
"IDrmPluginListener.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/drm/drm/1.0/types.h",
|
||||
"android/hardware/drm/drm/1.0/IDrmFactory.h",
|
||||
"android/hardware/drm/drm/1.0/IHwDrmFactory.h",
|
||||
"android/hardware/drm/drm/1.0/BnHwDrmFactory.h",
|
||||
"android/hardware/drm/drm/1.0/BpHwDrmFactory.h",
|
||||
"android/hardware/drm/drm/1.0/BsDrmFactory.h",
|
||||
"android/hardware/drm/drm/1.0/IDrmPlugin.h",
|
||||
"android/hardware/drm/drm/1.0/IHwDrmPlugin.h",
|
||||
"android/hardware/drm/drm/1.0/BnHwDrmPlugin.h",
|
||||
"android/hardware/drm/drm/1.0/BpHwDrmPlugin.h",
|
||||
"android/hardware/drm/drm/1.0/BsDrmPlugin.h",
|
||||
"android/hardware/drm/drm/1.0/IDrmPluginListener.h",
|
||||
"android/hardware/drm/drm/1.0/IHwDrmPluginListener.h",
|
||||
"android/hardware/drm/drm/1.0/BnHwDrmPluginListener.h",
|
||||
"android/hardware/drm/drm/1.0/BpHwDrmPluginListener.h",
|
||||
"android/hardware/drm/drm/1.0/BsDrmPluginListener.h",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.drm.drm@1.0",
|
||||
generated_sources: ["android.hardware.drm.drm@1.0_genc++"],
|
||||
generated_headers: ["android.hardware.drm.drm@1.0_genc++_headers"],
|
||||
export_generated_headers: ["android.hardware.drm.drm@1.0_genc++_headers"],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
# Copyright (C) 2016, The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.drm.drm@1.0-impl
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_SRC_FILES := \
|
||||
DrmFactory.cpp \
|
||||
DrmPlugin.cpp \
|
||||
TypeConvert.cpp \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libhidlbase \
|
||||
libhidltransport \
|
||||
libhwbinder \
|
||||
libutils \
|
||||
liblog \
|
||||
libmediadrm \
|
||||
libstagefright_foundation \
|
||||
android.hardware.drm.drm@1.0 \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
frameworks/native/include \
|
||||
frameworks/av/include
|
||||
|
||||
# TODO: The legacy DRM plugins only support 32-bit. They need
|
||||
# to be migrated to 64-bit (b/18948909)
|
||||
LOCAL_32_BIT_ONLY := true
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_DRM_DRM_V1_0_TYPECONVERT
|
||||
#define ANDROID_HARDWARE_DRM_DRM_V1_0_TYPECONVERT
|
||||
|
||||
#include <utils/Vector.h>
|
||||
#include <media/stagefright/MediaErrors.h>
|
||||
#include <media/drm/DrmAPI.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <android/hardware/drm/drm/1.0/types.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace drm {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
||||
template<typename T> const hidl_vec<T> toHidlVec(const Vector<T> &Vector) {
|
||||
hidl_vec<T> vec;
|
||||
vec.setToExternal(const_cast<T *>(Vector.array()), Vector.size());
|
||||
return vec;
|
||||
}
|
||||
|
||||
template<typename T> hidl_vec<T> toHidlVec(Vector<T> &Vector) {
|
||||
hidl_vec<T> vec;
|
||||
vec.setToExternal(Vector.editArray(), Vector.size());
|
||||
return vec;
|
||||
}
|
||||
|
||||
template<typename T> const Vector<T> toVector(const hidl_vec<T> & vec) {
|
||||
Vector<T> vector;
|
||||
vector.appendArray(vec.data(), vec.size());
|
||||
return *const_cast<const Vector<T> *>(&vector);
|
||||
}
|
||||
|
||||
template<typename T> Vector<T> toVector(hidl_vec<T> &vec) {
|
||||
Vector<T> vector;
|
||||
vector.appendArray(vec.data(), vec.size());
|
||||
return vector;
|
||||
}
|
||||
|
||||
Status toStatus(status_t legacyStatus);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace drm
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_DRM_DRM_V1_0_TYPECONVERT
|
Loading…
Reference in a new issue