From 92a71245890943e822367cba98d336725098725f Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 8 Nov 2026 22:07:39 -0500 Subject: [PATCH] fix(gpu): skip system Vulkan pruning when the runtime pack is absent (#2316) fix: skip pruning system Vulkan runtimes when the runtime pack is not installed --- .../launcher/gpu/SystemVulkanDriver.java | 1 + .../gpu/SystemVulkanPruneAbsentRuntimeTest.kt | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 app/src/test/java/com/droiddeck/launcher/gpu/SystemVulkanPruneAbsentRuntimeTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/gpu/SystemVulkanDriver.java b/app/src/main/java/com/droiddeck/launcher/gpu/SystemVulkanDriver.java index 25a6e363c6..1106ac9602 100644 --- a/app/src/main/java/com/droiddeck/launcher/gpu/SystemVulkanDriver.java +++ b/app/src/main/java/com/droiddeck/launcher/gpu/SystemVulkanDriver.java @@ -191,6 +191,7 @@ public final class SystemVulkanDriver { /** Collect abandoned stages, and obsolete versions once older guests can no longer load them. */ public static synchronized void pruneUnused(Context context, boolean guestsStopped) throws IOException { + if (!AddonPack.POWERVR.installed(context)) return; pruneUnused(runtimeDirectory(context), guestsStopped); } diff --git a/app/src/test/java/com/droiddeck/launcher/gpu/SystemVulkanPruneAbsentRuntimeTest.kt b/app/src/test/java/com/droiddeck/launcher/gpu/SystemVulkanPruneAbsentRuntimeTest.kt new file mode 100644 index 0000000000..8a740f1681 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/gpu/SystemVulkanPruneAbsentRuntimeTest.kt @@ -0,0 +1,26 @@ +package com.droiddeck.launcher.gpu + +import android.content.Context +import java.io.File +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [28], manifest = Config.NONE) +class SystemVulkanPruneAbsentRuntimeTest { + @Test fun pruningWithoutTheRuntimeDoesNotThrowAndLeavesFilesAlone() { + val context: Context = RuntimeEnvironment.getApplication() + val base = File(context.filesDir, "system_vulkan").apply { mkdirs() } + val stage = File(base, ".stage-" + java.util.UUID.randomUUID()).apply { mkdir() } + val version = File(base, "a".repeat(64)).apply { mkdir() } + + SystemVulkanDriver.pruneUnused(context, true) + + assertTrue(stage.exists()) + assertTrue(version.exists()) + } +}