Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Widevine Apex feature. #182

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 215 additions & 7 deletions widevine/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,234 @@ sh_binary {
owner: "widevine",
}

prebuilt_apex {
name: "com.google.android.widevine",
src: "com.google.android.widevine.apex",
installable:true,
vendor:true,
apex_name:"com.google.android.widevine",
}

soong_config_module_type {
name: "widevine_apex_defaults",
module_type: "apex_defaults",
config_namespace: "ANDROID",
bool_variables: ["TARGET_ENABLE_MEDIADRM_64"],
properties: ["compile_multilib"],
}

widevine_apex_defaults {
name: "com.google.android.widevine-defaults",
compile_multilib: "prefer32",
soong_config_variables: {
TARGET_ENABLE_MEDIADRM_64: {
compile_multilib: "first",
},
},
prebuilts: [
"com.google.android.widevine.xml", // etc/vintf
],
// TODO(b/274041915) remove updatable:false
updatable: false,
// TODO(b/268439003) We need an API to get apex version. Until then
// we'll read apex_manifest.pb to get the version. To label apex_manifest.pb
// as vendor_configs_file (which the apex can access), turn off force-label.
use_file_contexts_as_is: true,
// min_sdk_version: "34",
min_sdk_version: "UpsideDownCake",
vendor: true,
}

soong_config_module_type {
name: "widevine_key_apex_defaults",
module_type: "apex_defaults",
config_namespace: "widevine",
bool_variables: ["use_devkey"],
properties: ["key", "certificate"],
}

widevine_key_apex_defaults {
name: "com.google.android.widevine-key-defaults",
key: "com.google.android.widevine.key",
certificate: ":com.google.android.widevine.certificate",
soong_config_variables: {
use_devkey: {
key: "com_google_android_widevine-image.key",
certificate: ":com_google_android_widevine-container",
},
},
}

cc_prebuilt_binary {
name: "android.hardware.drm-service.widevine",
owner: "widevine",
proprietary: true,
min_sdk_version: "UpsideDownCake",
relative_install_path: "hw",
srcs: ["android.hardware.drm-service.widevine"],
vendor: true,
relative_install_path: "hw",
init_rc: ["android.hardware.drm-service.widevine.rc"],
vintf_fragments: ["manifest_android.hardware.drm-service.widevine.xml"],
required: [
"libwvaidl",
],
check_elf_files: false,
shared_libs:[
"liblog",
"libbinder_ndk",
],
}

cc_prebuilt_library_shared {
name: "libwvaidl",
srcs: ["libwvaidl.so"],
name: "libcrypto",
srcs: ["libcrypto.so"],
vendor:true,
}

// cc_prebuilt_library_shared {
// name: "liblog",
// srcs: ["liblog.so"],
// vendor:true,
// }

apex {
name: "com.google.android.widevine",
manifest: "apex_manifest.json",
prebuilts: [
"com.google.android.widevine.rc",
"com.google.android.widevine.xml", // etc/vintf
],
defaults: [
"com.google.android.widevine-defaults",
"com.google.android.widevine-key-defaults",
],
binaries: ["android.hardware.drm-service.widevine"],
file_contexts: "file_contexts",
native_shared_libs: [
"libcrypto",
// "liblog",
],

// min_sdk_version: "34",
// install sysconfig to allow the apex to be updatable
required: [
"allowlist_com.google.android.widevine.xml",
],
// installable: false,
// apex_available: [
// "//apex_available:platform",
// ],

}

apex_key {
name: "com.google.android.widevine.key",
public_key: "com.google.android.widevine.avbpubkey",
private_key: "com.google.android.widevine.pem",
}

android_app_certificate {
name: "com.google.android.widevine.certificate",
certificate: "com.google.android.widevine",
}

prebuilt_etc {
name: "com.google.android.widevine.rc",
src: "com.google.android.widevine.rc",
vendor:true,
}

prebuilt_etc {
name: "com.google.android.widevine.xml",
src: "com.google.android.widevine.xml",
sub_dir: "vintf",
installable: false,
vendor:true,
}

prebuilt_etc {
name: "allowlist_com.google.android.widevine.xml",
src: "allowlist_com.google.android.widevine.xml",
vendor: true,
check_elf_files: false,
sub_dir: "sysconfig",
}

// cc_prebuilt_binary {
// name: "android.hardware.drm-service.widevine",
// srcs: ["android.hardware.drm-service.widevine"],
// }

// apex {
// name: "com.google.android.widevine",
// manifest: "apex_manifest.json",
// prebuilts: [
// "com.google.android.widevine.rc",
// "com.google.android.widevine.xml", // etc/vintf
// ],
// defaults: [
// "com.google.android.widevine-defaults",
// "com.google.android.widevine-key-defaults",
// ],
// binaries: ["android.hardware.drm-service.widevine"],
// file_contexts: "file_contexts",

// native_shared_libs: ["ibcrypto"],
// // install sysconfig to allow the apex to be updatable
// required: [
// "allowlist_com.google.android.widevine.xml",
// ],
// key: "com.google.android.widevine.key",
// }



// apex_key {
// name: "com.google.android.widevine.key",
// public_key: "com.google.android.widevine.avbpubkey",
// private_key: "com.google.android.widevine.pem",
// }

// android_app_certificate {
// name: "com.google.android.widevine.certificate",
// certificate: "com.google.android.widevine",
// }

// prebuilt_etc {
// name: "com.google.android.widevine.rc",
// src: "com.google.android.widevine.rc",
// }

// prebuilt_etc {
// name: "com.google.android.widevine.xml",
// src: "com.google.android.widevine.xml",
// sub_dir: "vintf",
// installable: false,
// }

// prebuilt_etc {
// name: "allowlist_com.google.android.widevine.xml",
// src: "allowlist_com.google.android.widevine.xml",
// vendor: true,
// sub_dir: "sysconfig",
// }

//cc_prebuilt_binary {
// name: "android.hardware.drm-service.widevine",
// srcs: ["android.hardware.drm-service.widevine"],
// vendor: true,
// relative_install_path: "hw",
// init_rc: ["android.hardware.drm-service.widevine.rc"],
// vintf_fragments: ["manifest_android.hardware.drm-service.widevine.xml"],
// required: [
// "libwvaidl",
// ],
// check_elf_files: false,
//}

// cc_prebuilt_library_shared {
// name: "libwvaidl",
// srcs: ["libwvaidl.so"],
// vendor: true,
// check_elf_files: false,
// }

//cc_prebuilt_library_shared {
//name: "libwvdrmengine",
//srcs: ["libwvdrmengine.so"],
Expand Down
9 changes: 9 additions & 0 deletions widevine/allowlist_com.google.android.widevine.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
This XML file declares the vendor apex package names eligible for installation.
-->

<config>
<allowed-vendor-apex package="com.google.android.widevine" installerPackage="com.android.vending" />
</config>
Binary file modified widevine/android.hardware.drm-service.widevine
100755 → 100644
Binary file not shown.
10 changes: 0 additions & 10 deletions widevine/android.hardware.drm-service.widevine.rc

This file was deleted.

7 changes: 7 additions & 0 deletions widevine/apex_manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "com.google.android.widevine",
"version": 1,
"requireNativeLibs": [
"liboemcrypto.so"
]
}
Binary file added widevine/com.google.android.widevine.apex
Binary file not shown.
Binary file added widevine/com.google.android.widevine.avbpubkey
Binary file not shown.
52 changes: 52 additions & 0 deletions widevine/com.google.android.widevine.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDOOLpUo4QRrwlQ
VpaIOK8plveqKbSW++kkCvX4DV1w712W6LR9tfX8JMcKlI1KY3j7cH2Yn0R8AYhW
wRGfB33SQqkoWOQuYKngcTSXpWZsrYgwo8DbShhcbtQIKRs65oK0OLUmzGWKfoKS
u4dp768WsssZrrKU1qZRXqhEybmKrrgxmJT7/vtrLFdrXzuqTiRBBemTlIgACnca
TtHvXUipOkN+Fhn83XmW8hSuWciI80srtiyoTM7fUB4WMgq5kP16x5yViu/wbFWt
v5L0if35fREClFVCLnqqPjROF2YbjB7kucvg6zNNadrP0po7psEKcUX90MW5nojD
DrYMUkKHidCBDFh1RdmdQslUlCcifbdBFgc2uAwu95J20MxoyggsA1m/JEVN/O7a
G7pNq5nSLRO9mAli8MBIAAOgtl5R8E28LEQL6vKAHRuLmaSiB7ztaCdzlBwq9fCd
BI8fe5hH+wVh7RrToRcdZXjDakXa18vwUe8PHbM/ui4x4t1naEaGxPDFI9MzY+Kn
YjMMQk6YDMt+jAPN1u78cb1Q+Mi6WXZViHou2qU9NI7ubrCXVnMgMmtK5hXTb2HF
oKI2gP7+cOFK3323xyDaqzgZ65ZI2FlGZy5JkUoZfOCZEXxwme1eTwmzi6a/qHzg
2zHQJghNTu0ZQ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nAILuaiW4moO368G9wRjIexIZGiooDUQrek5oOLcb7n8EvO
J1n2BDqILpeusEzCOIoEDBDBPX8i4NnFGj+bwfkoop47zaSMwcWHFciTkkaFnGH6
AlXc/oDBL8/6YXPSpE5ihw7oNzsoap12niHgUYwC91QLfPdlyCvuiysWDWlGWK5d
zqglATmt2Wvir+vF4OPnnxGS4DcqYGu6dOSpjF1Pl7QXxNBRKAQJnlLjxw66y1Wm
jFxf8NXXs1tphpdUdQPuIfmB/g0WzpaGSKpTfL+Ex5+m9FPm+X4Luoe8RfH6lB6P
NeDaCQSbZnEP9SYC+JZstmKE/Uwqyw==
-----END PRIVATE KEY-----
10 changes: 10 additions & 0 deletions widevine/com.google.android.widevine.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on property:apex.all.ready=true
mkdir /data/vendor/mediadrm 0770 media mediadrm

service vendor.drm-widevine-hal /apex/com.google.android.widevine/bin/hw/android.hardware.drm-service.widevine
interface aidl android.hardware.drm.IDrmFactory/widevine
class hal
user media
group media mediadrm drmrpc system
ioprio rt 4
task_profiles ProcessCapacityHigh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 The Android Open Source Project
<!-- Copyright (C) 2022 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.
Expand All @@ -19,4 +19,4 @@
<version>1</version>
<fqname>IDrmFactory/widevine</fqname>
</hal>
</manifest>
</manifest>
9 changes: 9 additions & 0 deletions widevine/file_contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(/.*)? u:object_r:vendor_file:s0
/bin/hw/android\.hardware\.drm-service\.widevine u:object_r:hal_drm_widevine_exec:s0
/etc(/.*)? u:object_r:vendor_configs_file:s0
# TODO(b/268439003) Following two entries are typically handled by the build system.
# We override it so that the Widevine APEX can access it to get the apex version.
# When we have a proper API, we can delete these along with
# use_file_contexts_as_is property in Android.bp
/apex_manifest\.pb u:object_r:vendor_configs_file:s0
/ u:object_r:system_file:s0
Binary file added widevine/libcrypto.so
Binary file not shown.