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

Commit e50822b9 authored by Peiyong Lin's avatar Peiyong Lin Committed by Automerger Merge Worker
Browse files

Merge "Do not allow wildcard matching in GL loader." am: 91567d79 am: 560a4410

parents 64e5cb39 560a4410
Loading
Loading
Loading
Loading
+21 −24
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <android-base/properties.h>
#include <android/dlext.h>
#include <cutils/properties.h>
#include <dirent.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
@@ -236,13 +237,7 @@ void* Loader::open(egl_connection_t* cnx)
            LOG_ALWAYS_FATAL("couldn't find an OpenGL ES implementation from %s",
                             android::GraphicsEnv::getInstance().getDriverPath().c_str());
        }
        // Finally, try to load system driver.  If ANGLE is the system driver
        // (i.e. we are forcing the legacy system driver instead of ANGLE), use
        // the driver suffix that was passed down from above.
        if (shouldForceLegacyDriver) {
            std::string suffix = android::GraphicsEnv::getInstance().getLegacySuffix();
            hnd = attempt_to_load_system_driver(cnx, suffix.c_str(), true);
        } else {
        // 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.:
@@ -261,7 +256,6 @@ void* Loader::open(egl_connection_t* cnx)
            }
        }
    }
    }

    if (!hnd) {
        // Can't find graphics driver by appending system properties, now search for the exact name
@@ -272,7 +266,10 @@ void* Loader::open(egl_connection_t* cnx)
        hnd = attempt_to_load_system_driver(cnx, nullptr, true);
    }

    if (!hnd && !failToLoadFromDriverSuffixProperty) {
    if (!hnd && !failToLoadFromDriverSuffixProperty &&
        property_get_int32("ro.vendor.api_level", 0) < __ANDROID_API_U__) {
        // Still can't find the graphics drivers with the exact name. This time try to use wildcard
        // matching if the device is launched before Android 14.
        hnd = attempt_to_load_system_driver(cnx, nullptr, false);
    }