From 9e73b2047a19a847012b04ddd8faf8bf77dd82e0 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Thu, 12 Oct 2023 16:37:03 +0900 Subject: [PATCH] Use explicit requirements from APEX Previously, CAS APEX used ":sphal" and `android_load_sphal_library` to open plugins from /vendor/lib/mediacas. It was a workaround because there's no way to limit the scope to /vendor/lib/mediacas. And CAS plugins are not SPHAL libraries. Now, the APEX uses more explicit requirements: ":mediacas", which limitss the scope to /vendor/lib/mediacas. Bug: 298542407 Test: atest CtsMediaMiscTestCases:MediaCasTest Change-Id: Id91a87e0f6ef8a761e37cabed7da8b9fed0591c2 --- cas/aidl/default/Android.bp | 1 - cas/aidl/default/SharedLibrary.cpp | 5 ++--- cas/aidl/default/manifest.json | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cas/aidl/default/Android.bp b/cas/aidl/default/Android.bp index 9d094e0364..34ecbf2862 100644 --- a/cas/aidl/default/Android.bp +++ b/cas/aidl/default/Android.bp @@ -57,7 +57,6 @@ cc_defaults { shared_libs: [ "libbinder_ndk", "liblog", - "libvndksupport", ], header_libs: ["media_plugin_headers"], } diff --git a/cas/aidl/default/SharedLibrary.cpp b/cas/aidl/default/SharedLibrary.cpp index 6322ff303a..c12d17d0cd 100644 --- a/cas/aidl/default/SharedLibrary.cpp +++ b/cas/aidl/default/SharedLibrary.cpp @@ -19,7 +19,6 @@ #include "SharedLibrary.h" #include #include -#include namespace aidl { namespace android { @@ -27,12 +26,12 @@ namespace hardware { namespace cas { SharedLibrary::SharedLibrary(const String8& path) { - mLibHandle = android_load_sphal_library(path.c_str(), RTLD_NOW); + mLibHandle = dlopen(path.c_str(), RTLD_NOW); } SharedLibrary::~SharedLibrary() { if (mLibHandle != NULL) { - android_unload_sphal_library(mLibHandle); + dlclose(mLibHandle); mLibHandle = NULL; } } diff --git a/cas/aidl/default/manifest.json b/cas/aidl/default/manifest.json index 16b4f6710e..cdcecb2ec0 100644 --- a/cas/aidl/default/manifest.json +++ b/cas/aidl/default/manifest.json @@ -1,9 +1,8 @@ { "name": "com.android.hardware.cas", "version": 1, - // For CAS HAL to open plugins from /vendor/lib, "vendor" namespace should be imported. - // ":sphal" is an alias for the "vendor" namespace in Vendor APEX. + // For CAS HAL to open plugins from /vendor/lib/mediacas "requireNativeLibs": [ - ":sphal" + ":mediacas" ] }