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

Commit efa0cbd8 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

Don't fall back to system driver when driver apk fails.

Previously when driver apk fails to load, the loader falls back to load system
driver. However, this provides no indication of driver apk failure and hence
users that intend to use driver apk may end up working against the system
driver.

BUG: b/147459984
Test: Verified by forcing to use a dummy apk
Change-Id: I81f3be5710d1daaba7476f4ccb17d532049a1e68
parent cb6991f1
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -164,6 +164,11 @@ const std::array<const char*, 2> HAL_SUBNAME_KEY_PROPERTIES = {{
    "ro.board.platform",
}};

// LoadDriver returns:
// * 0 when succeed, or
// * -ENOENT when fail to open binary libraries, or
// * -EINVAL when fail to find HAL_MODULE_INFO_SYM_AS_STR or
//   HWVULKAN_HARDWARE_MODULE_ID in the library.
int LoadDriver(android_namespace_t* library_namespace,
               const hwvulkan_module_t** module) {
    ATRACE_CALL();
@@ -221,7 +226,13 @@ int LoadUpdatedDriver(const hwvulkan_module_t** module) {
        return -ENOENT;
    android::GraphicsEnv::getInstance().setDriverToLoad(
        android::GpuStatsInfo::Driver::VULKAN_UPDATED);
    return LoadDriver(ns, module);
    int result = LoadDriver(ns, module);
    if (result != 0) {
        LOG_ALWAYS_FATAL(
            "couldn't find an updated Vulkan implementation from %s",
            android::GraphicsEnv::getInstance().getDriverPath().c_str());
    }
    return result;
}

bool Hal::Open() {