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

Commit db3ed6e6 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: I3befc0d6c1f143dc53eab3762b7ff19c702e8cda
parent 815bb3d4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -611,6 +611,10 @@ android_namespace_t* GraphicsEnv::getDriverNamespace() {
    return mDriverNamespace;
}

std::string GraphicsEnv::getDriverPath() const {
    return mDriverPath;
}

android_namespace_t* GraphicsEnv::getAngleNamespace() {
    std::lock_guard<std::mutex> lock(mNamespaceMutex);

+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ public:
    void setDriverPathAndSphalLibraries(const std::string path, const std::string sphalLibraries);
    // Get the updatable driver namespace.
    android_namespace_t* getDriverNamespace();
    std::string getDriverPath() const;

    /*
     * Apis for GpuStats
+5 −0
Original line number Diff line number Diff line
@@ -238,6 +238,11 @@ void* Loader::open(egl_connection_t* cnx)

    bool failToLoadFromDriverSuffixProperty = false;
    if (!hnd) {
        // If updated driver apk is set but fail to load, abort here.
        if (android::GraphicsEnv::getInstance().getDriverNamespace()) {
            LOG_ALWAYS_FATAL("couldn't find an OpenGL ES implementation from %s",
                             android::GraphicsEnv::getInstance().getDriverPath().c_str());
        }
        // Finally, try to load system driver, start by searching for the library name appended by
        // the system properties of the GLES userspace driver in both locations.
        // i.e.: