Revert "Revert "Do not allow wildcard matching in GL loader.""
This reverts commit 237ab0873378805fc2d00fda9b3969216aad912e.
Reason for revert: The original patch is not the culprit.
Original commit message:
```
Original commit message:
```
Previously when ro.hardware.egl and ro.board.platform were not set, the
loader would attempt to load the exact GLES drivers, and if it failed,
it would attempt to use wildcard matching to find the GLES drivers.
However, ro.hardware.egl must be set to point to the GLES drivers and
hence wildcard matching should be disallowed. This patch makes sure the
GL loader no longer uses that path if a device is launched in Android 14
and beyond.
```
Reason for revert: startup regression in b/283393625
```
Bug: b/283393625
Change-Id: Id6fdd60e9a011679cedbd4eef5b3c7ea83882af9
Test: N/A
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 6cfb608..2c3ce16 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -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>
@@ -261,7 +262,10 @@
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);
}