Add SCP support for Android files

SCP uses the JNI headers in generated code, so several targets need
the include path; this will have no effect on non-SCP builds.  Also,
in "protected" builds, there is a generated library that needs to be
linked in the final binary, but this doesn't exist in the "analysis"
step; we create an empty static library if it doesn't exist so it works
on all cases.

Merged from https://widevine-internal-review.googlesource.com/169850

Merged from https://widevine-internal-review.googlesource.com/176177

Bug: 262635528
Change-Id: Ib676d55efbcbec81de9c3123bc70afb570d6caa5
(cherry picked from commit b9482eb23c261788a4432de7566f1b1de1cf9379)
This commit is contained in:
Jacob Trimble
2023-04-03 17:55:19 +00:00
committed by Kyle Zhang
parent b30452a3f6
commit 95b50d39ba
4 changed files with 100 additions and 2 deletions

View File

@@ -220,6 +220,7 @@ cc_library_static {
],
header_libs: [
"jni_headers",
"libbase_headers",
"libutils_headers",
],
@@ -252,6 +253,82 @@ filegroup {
],
}
genrule {
name: "libscp_runtime_genrule_x86",
srcs: [
"copy_scp_runtime.sh",
],
out: [
"libscp_runtime_x86.a",
],
cmd: "$(in) libscp_runtime_x86.a $(out)",
}
genrule {
name: "libscp_runtime_genrule_x64",
srcs: [
"copy_scp_runtime.sh",
],
out: [
"libscp_runtime_x64.a",
],
cmd: "$(in) libscp_runtime_x86_64.a $(out)",
}
genrule {
name: "libscp_runtime_genrule_arm",
srcs: [
"copy_scp_runtime.sh",
],
out: [
"libscp_runtime_arm.a",
],
cmd: "$(in) libscp_runtime_armeabi-v7a.a $(out)",
}
genrule {
name: "libscp_runtime_genrule_arm64",
srcs: [
"copy_scp_runtime.sh",
],
out: [
"libscp_runtime_arm64.a",
],
cmd: "$(in) libscp_runtime_arm64-v8a.a $(out)",
}
cc_prebuilt_library_static {
name: "libscp_runtime",
vendor_available: true,
arch: {
x86: {
srcs: [
":libscp_runtime_genrule_x86",
],
},
x86_64: {
srcs: [
":libscp_runtime_genrule_x64",
],
},
arm: {
srcs: [
":libscp_runtime_genrule_arm",
],
},
arm64: {
srcs: [
":libscp_runtime_genrule_arm64",
],
},
},
}
// ----------------------------------------------------------------------------
// Builds libwvaidl.so
//
@@ -293,6 +370,7 @@ cc_library {
"libprotobuf-cpp-lite",
"libutils",
"libwv_odk",
"libscp_runtime",
"libwvdrmcryptoplugin_aidl",
"libwvdrmdrmplugin_aidl",
"libwvlevel3",
@@ -309,7 +387,10 @@ cc_library {
"wv_media_drm_flags_c_lib",
],
header_libs: ["libstagefright_foundation_headers"],
header_libs: [
"jni_headers",
"libstagefright_foundation_headers",
],
owner: "widevine",

View File

@@ -38,7 +38,10 @@ cc_library_static {
"external/protobuf/src",
],
header_libs: ["libutils_headers"],
header_libs: [
"jni_headers",
"libutils_headers",
],
static_libs: ["libcdm_protos"],
shared_libs: ["libcrypto"],

View File

@@ -0,0 +1,11 @@
#!/bin/bash
# During the protection step, there will be a "libscp_runtime*.a" file in the
# root directory; link it to a different folder so it can be loaded with
# cc_prebuilt_library_static. During the analysis step, it doesn't exist, so
# create a placeholder archive.
if [[ ! -e $1 ]]; then
printf '!<arch>\n' >"$1"
fi
cp "$1" "$2"

View File

@@ -44,6 +44,9 @@ cc_library_static {
"vendor/widevine/libwvdrmengine/oemcrypto/odk/include",
"vendor/widevine/libwvdrmengine/oemcrypto/odk/src",
],
header_libs: [
"jni_headers",
],
srcs: [
"src/generate_entropy_android.cpp",