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

Commit 0e72f130 authored by Jesse Hall's avatar Jesse Hall
Browse files

Require targetSdkVersion>=O for updated graphics driver packages

In O, graphics drivers are loaded into a new restricted linker
namespace. Drivers built for previous versions of the OS may not work
under those restrictions, so require an updated driver package to
declare compatibility by setting targetSdkVersion >= O.

Bug: 34228255
Test: manually construct packages with and without
      targetSdkVersion >= O, confirm driver is used/not-used as
      expected.
Change-Id: I4518360433a6de5c6e1e792a6eedddf8c6bf4394
parent ba4ac09d
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.opengl.EGL14;
import android.opengl.EGL14;
import android.os.Build;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.util.Log;
import android.util.Log;


@@ -81,6 +82,12 @@ public final class GraphicsEnvironment {
            }
            }
            return;
            return;
        }
        }
        if (driverInfo.targetSdkVersion < Build.VERSION_CODES.O) {
            // O drivers are restricted to the sphal linker namespace, so don't try to use
            // packages unless they declare they're compatible with that restriction.
            Log.w(TAG, "updated driver package is not known to be compatible with O");
            return;
        }


        StringBuilder sb = new StringBuilder();
        StringBuilder sb = new StringBuilder();
        sb.append(driverInfo.nativeLibraryDir)
        sb.append(driverInfo.nativeLibraryDir)
+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ static void setupVulkanLayerPath_native(JNIEnv* env, jobject clazz,
        loader_data.layer_path = layerPathChars.c_str();
        loader_data.layer_path = layerPathChars.c_str();
        loader_data.app_namespace = ns;
        loader_data.app_namespace = ns;
    } else {
    } else {
        ALOGD("ignored Vulkan layer search path %s for namespace %p",
        ALOGV("Vulkan layer search path already set, not clobbering with '%s' for namespace %p'",
                layerPathChars.c_str(), ns);
                layerPathChars.c_str(), ns);
    }
    }
}
}