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

Commit f9151368 authored by Courtney Goeltzenleuchter's avatar Courtney Goeltzenleuchter Committed by Android (Google) Code Review
Browse files

Merge "Pass more ANGLE info from runtime"

parents 96f2ef48 eb0ca8e5
Loading
Loading
Loading
Loading
+28 −25
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public class GraphicsEnvironment {
    }

    /**
     * Selectively enable ANGLE for applications
     * Pass ANGLE details down to trigger enable logic
     */
    private static void setupAngle(Context context) {

@@ -143,12 +143,16 @@ public class GraphicsEnvironment {

        String packageName = context.getPackageName();

        // Only provide an ANGLE namespace if the package name matches setting
        boolean optIn = false;

        if ((angleEnabledApp != null && packageName != null)
                && (!angleEnabledApp.isEmpty() && !packageName.isEmpty())
                && angleEnabledApp.equals(packageName)) {

            if (DEBUG) Log.v(TAG, "ANGLE enabled for " + packageName);
            if (DEBUG) Log.v(TAG, packageName + " opted in for ANGLE via Developer Setting");

            optIn = true;
        }

        ApplicationInfo angleInfo;

@@ -173,9 +177,8 @@ public class GraphicsEnvironment {

        if (DEBUG) Log.v(TAG, "ANGLE package libs: " + paths);

            // Providing any path will trigger namespace creation
            setAnglePath(paths);
        }
        // Further opt-in logic is handled in native, so pass relevant info down
        setAngleInfo(paths, packageName, optIn);
    }

    /**
@@ -266,5 +269,5 @@ public class GraphicsEnvironment {
    private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
    private static native void setDebugLayers(String layers);
    private static native void setDriverPath(String path);
    private static native void setAnglePath(String path);
    private static native void setAngleInfo(String path, String appPackage, boolean optIn);
}
+4 −3
Original line number Diff line number Diff line
@@ -28,9 +28,10 @@ void setDriverPath(JNIEnv* env, jobject clazz, jstring path) {
    android::GraphicsEnv::getInstance().setDriverPath(pathChars.c_str());
}

void setAnglePath(JNIEnv* env, jobject clazz, jstring path) {
void setAngleInfo_native(JNIEnv* env, jobject clazz, jstring path, jstring appName, jboolean optIn) {
    ScopedUtfChars pathChars(env, path);
    android::GraphicsEnv::getInstance().setAnglePath(pathChars.c_str());
    ScopedUtfChars appNameChars(env, appName);
    android::GraphicsEnv::getInstance().setAngleInfo(pathChars.c_str(), appNameChars.c_str(), optIn);
}

void setLayerPaths_native(JNIEnv* env, jobject clazz, jobject classLoader, jstring layerPaths) {
@@ -49,7 +50,7 @@ void setDebugLayers_native(JNIEnv* env, jobject clazz, jstring layers) {

const JNINativeMethod g_methods[] = {
    { "setDriverPath", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPath) },
    { "setAnglePath", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setAnglePath) },
    { "setAngleInfo", "(Ljava/lang/String;Ljava/lang/String;Z)V", reinterpret_cast<void*>(setAngleInfo_native) },
    { "setLayerPaths", "(Ljava/lang/ClassLoader;Ljava/lang/String;)V", reinterpret_cast<void*>(setLayerPaths_native) },
    { "setDebugLayers", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDebugLayers_native) },
};