Merge "Add liboemcrypto.so as required by WV APEX"

This commit is contained in:
Kyle Zhang
2023-01-11 05:37:46 +00:00
committed by Android (Google) Code Review
8 changed files with 31 additions and 28 deletions

View File

@@ -65,7 +65,6 @@ apex {
manifest: "apex_manifest.json", manifest: "apex_manifest.json",
prebuilts: [ prebuilts: [
"com.google.android.widevine.rc", "com.google.android.widevine.rc",
"widevine-linker-config",
"com.google.android.widevine.xml", // etc/vintf "com.google.android.widevine.xml", // etc/vintf
], ],
defaults: [ defaults: [
@@ -83,12 +82,6 @@ apex {
], ],
} }
linker_config {
name: "widevine-linker-config",
src: "linker.config.json",
installable: false,
}
apex_key { apex_key {
name: "com.google.android.widevine.key", name: "com.google.android.widevine.key",
public_key: "com.google.android.widevine.avbpubkey", public_key: "com.google.android.widevine.avbpubkey",

View File

@@ -1,4 +1,7 @@
{ {
"name": "com.google.android.widevine", "name": "com.google.android.widevine",
"version": 1 "version": 1,
"requireNativeLibs": [
"liboemcrypto.so"
]
} }

View File

@@ -0,0 +1,5 @@
linker_config {
name: "widevine_linker_config",
src: "linker.config.json",
vendor: true,
}

View File

@@ -0,0 +1,10 @@
PRODUCT_PACKAGES += \
com.google.android.widevine \
# Check if we can use dev keys
ifneq ($(wildcard vendor/google/dev-keystore),)
$(call soong_config_set,widevine,use_devkey,true)
endif
PRODUCT_PACKAGES += \
widevine_linker_config

View File

@@ -0,0 +1,5 @@
{
"provideLibs": [
"liboemcrypto.so"
]
}

View File

@@ -1,3 +0,0 @@
{
"permittedPaths": ["/vendor/${LIB}"]
}

View File

@@ -849,16 +849,15 @@ class Adapter {
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_NO_L1_LIBRARY_PATH); wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_NO_L1_LIBRARY_PATH);
return result; return result;
} }
if (level1_library_ == nullptr) { if (!level1_library_) {
for (auto& name : library_names) { for (auto& name : library_names) {
level1_library_ = dlopen((name.c_str()), RTLD_NOW); level1_library_ = dlopen((name.c_str()), RTLD_NOW);
if (level1_library_) { if (!level1_library_) {
LOGV("Using oemcrypto path %s", name.c_str()); LOGW("Could not load oemcrypto from path %s. %s", name.c_str(), dlerror());
break;
} }
} }
if (level1_library_ == nullptr) { if (!level1_library_) {
LOGW("Could not load oemcrypto. Falling back to L3. %s", dlerror()); LOGW("Could not load oemcrypto. Falling back to L3.");
metrics.OemCryptoDynamicAdapterMetrics::SetInitializationMode( metrics.OemCryptoDynamicAdapterMetrics::SetInitializationMode(
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_L1_OPEN_FAILED); wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_L1_OPEN_FAILED);
return result; return result;

View File

@@ -180,18 +180,9 @@ bool Properties::GetOEMCryptoPaths(std::vector<std::string>* library_names) {
LOGW("Properties::GetOEMCryptoPath: Invalid parameter"); LOGW("Properties::GetOEMCryptoPath: Invalid parameter");
return false; return false;
} }
std::vector<std::string> library_paths = {"/vendor/", "/system/", "/odm/"};
std::string sub_dir;
#if __LP64__
sub_dir = "lib64/";
#else
sub_dir = "lib/";
#endif
const std::string library_name = "liboemcrypto.so"; library_names->push_back("liboemcrypto.so");
for (auto& path : library_paths) {
library_names->push_back(path + sub_dir + library_name);
}
return true; return true;
} }