Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e73b204 authored by Jooyung Han's avatar Jooyung Han
Browse files

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
parent fa2dd8e2
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -57,7 +57,6 @@ cc_defaults {
    shared_libs: [
    shared_libs: [
        "libbinder_ndk",
        "libbinder_ndk",
        "liblog",
        "liblog",
        "libvndksupport",
    ],
    ],
    header_libs: ["media_plugin_headers"],
    header_libs: ["media_plugin_headers"],
}
}
+2 −3
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@
#include "SharedLibrary.h"
#include "SharedLibrary.h"
#include <dlfcn.h>
#include <dlfcn.h>
#include <utils/Log.h>
#include <utils/Log.h>
#include <vndksupport/linker.h>


namespace aidl {
namespace aidl {
namespace android {
namespace android {
@@ -27,12 +26,12 @@ namespace hardware {
namespace cas {
namespace cas {


SharedLibrary::SharedLibrary(const String8& path) {
SharedLibrary::SharedLibrary(const String8& path) {
    mLibHandle = android_load_sphal_library(path.c_str(), RTLD_NOW);
    mLibHandle = dlopen(path.c_str(), RTLD_NOW);
}
}


SharedLibrary::~SharedLibrary() {
SharedLibrary::~SharedLibrary() {
    if (mLibHandle != NULL) {
    if (mLibHandle != NULL) {
        android_unload_sphal_library(mLibHandle);
        dlclose(mLibHandle);
        mLibHandle = NULL;
        mLibHandle = NULL;
    }
    }
}
}
+2 −3
Original line number Original line Diff line number Diff line
{
{
    "name": "com.android.hardware.cas",
    "name": "com.android.hardware.cas",
    "version": 1,
    "version": 1,
    // For CAS HAL to open plugins from /vendor/lib, "vendor" namespace should be imported.
    // For CAS HAL to open plugins from /vendor/lib/mediacas
    // ":sphal" is an alias for the "vendor" namespace in Vendor APEX.
    "requireNativeLibs": [
    "requireNativeLibs": [
        ":sphal"
        ":mediacas"
    ]
    ]
}
}