Revert "Revert "Rootless Debug for GLES""
This reverts commit 9f20d92fb3b7ed2a88d2e497ec36d21e9005f497.
Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Test: Chromium starts up
Test: deqp - EGL, GLES2, GLES3
Bug: 110883880
Change-Id: I728ce502f8df43d5bfb370e6f9d4bd382f8c909d
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 2a7d76e..3328ad7 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -18,9 +18,12 @@
#define LOG_TAG "GraphicsEnv"
#include <graphicsenv/GraphicsEnv.h>
+#include <sys/prctl.h>
+
#include <mutex>
#include <android/dlext.h>
+#include <cutils/properties.h>
#include <log/log.h>
// TODO(b/37049319) Get this from a header once one exists
@@ -46,6 +49,14 @@
return env;
}
+int GraphicsEnv::getCanLoadSystemLibraries() {
+ if (property_get_bool("ro.debuggable", false) && prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) {
+ // Return an integer value since this crosses library boundaries
+ return 1;
+ }
+ return 0;
+}
+
void GraphicsEnv::setDriverPath(const std::string path) {
if (!mDriverPath.empty()) {
ALOGV("ignoring attempt to change driver path from '%s' to '%s'",
@@ -181,4 +192,10 @@
const char* android_getAngleAppPref() {
return android::GraphicsEnv::getInstance().getAngleAppPref();
}
+const char* android_getLayerPaths() {
+ return android::GraphicsEnv::getInstance().getLayerPaths().c_str();
+}
+const char* android_getDebugLayers() {
+ return android::GraphicsEnv::getInstance().getDebugLayers().c_str();
+}
}