fix(session): hide an unlistable /sys/bus/pci/devices so libpci does not abort Chromium's GPU init

This commit is contained in:
Kurt Himebauch committed 2026-11-08 20:39:32 -05:00
1 parent 7fa7e7f05d
commit f2adff9486
1 file changed
+11 -1
@@ -306,7 +306,17 @@ public final class LinuxRuntime {
private static boolean unreadablePciDevice() {
File[] devices = new File("/sys/bus/pci/devices").listFiles();
if (devices == null) return false;
if (devices == null) {
// The directory is there but the app may not list it (Android 13 on the AYN Thor): libpci then
// aborts the whole program with "Cannot open /sys/bus/pci/devices", which Chromium's GPU
// initialisation runs into. Not there at all (no PCI bus) is fine as it is.
try {
android.system.Os.stat("/sys/bus/pci/devices");
return true;
} catch (android.system.ErrnoException e) {
return e.errno == android.system.OsConstants.EACCES;
}
}
for (File device : devices) {
if (!new File(device, "vendor").canRead()) return true;
}