mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Merge latest origin/main and resolve conflicts
This commit is contained in:
commit
8171bf20fd
581 files changed
+14773
-4227
No files matched your search
@@ -23,7 +23,6 @@ object DeckyManager {
|
||||
private const val PATH = "root/homebrew/services/PluginLoader"
|
||||
private const val VERSION = "root/homebrew/services/.droiddeck-decky-version"
|
||||
private const val SETTINGS = "root/homebrew/settings/loader.json"
|
||||
// droiddeck-session reads the marker from the root of the client it runs.
|
||||
private val CEF_REMOTE_DEBUG_MARKERS = listOf(
|
||||
"root/.local/share/Steam/.cef-enable-remote-debugging",
|
||||
"root/.droiddeck-x64/.local/share/Steam/.cef-enable-remote-debugging",
|
||||
@@ -58,7 +57,6 @@ object DeckyManager {
|
||||
check(staged.renameTo(file)) { "cannot write ${file.path}" }
|
||||
}
|
||||
|
||||
// Mirrors Decky's updater: Stable takes the newest non-prerelease tag, Prerelease the newest tag of either kind.
|
||||
fun latest(channels: ReleaseChannels, branch: Int): Release? =
|
||||
if (branch == BRANCH_STABLE) channels.stable.firstOrNull() else channels.all.firstOrNull()
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ object DesktopCatalog {
|
||||
|
||||
private fun journal(root: File, id: String) = File(root, ".droiddeck-pkg-$id$JOURNAL_SUFFIX")
|
||||
|
||||
/** Packages whose extraction over the runtime started and never finished. */
|
||||
fun interrupted(context: Context): List<Entry> = interrupted(LinuxRuntime.rootDir(context))
|
||||
|
||||
fun interrupted(root: File): List<Entry> =
|
||||
@@ -63,7 +62,6 @@ object DesktopCatalog {
|
||||
|
||||
private fun downloadFile(context: Context, entry: Entry) = File(context.cacheDir, "pkg-${entry.id}-${entry.sha256.take(12)}.download")
|
||||
|
||||
/** Drops downloads kept for installs that no longer need finishing, such as after the runtime was reinstalled. */
|
||||
fun pruneDownloads(context: Context) = synchronized(installLock) {
|
||||
val keep = interrupted(context).map { downloadFile(context, it).name }.toSet()
|
||||
context.cacheDir.listFiles { f -> f.name.startsWith("pkg-") && f.name.removeSuffix(".resume.properties").endsWith(".download") }
|
||||
@@ -102,7 +100,6 @@ object DesktopCatalog {
|
||||
o.optString("icon", "applications-games"), o.optString("category", "Game"),
|
||||
)
|
||||
|
||||
/** A finished download is kept until its extraction completes, so resuming does not fetch it again. */
|
||||
private fun downloaded(file: File, entry: Entry): Boolean =
|
||||
file.isFile && file.length() > 0 && !File(file.path + ".resume.properties").exists() &&
|
||||
(entry.size <= 0 || file.length() == entry.size) && entry.sha256.equals(Hashes.sha256(file), ignoreCase = true)
|
||||
|
||||
@@ -189,7 +189,6 @@ class DeviceControlsComponent(context: Context, root: File, private val activity
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DeviceControls"
|
||||
// AudioService sends these on every stream step; the Settings observer and 250 ms poll lag a held volume key.
|
||||
private const val VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION"
|
||||
private const val STREAM_MUTE_CHANGED_ACTION = "android.media.STREAM_MUTE_CHANGED_ACTION"
|
||||
private const val PERMISSION_CHANNEL = "brightness_permission"
|
||||
|
||||
@@ -39,7 +39,6 @@ object GuestCommand {
|
||||
if (linkDir != null) cmd.add(1, "--link2symlink")
|
||||
val binds = LinuxRuntime.binds(context, null, runtimeDir, Environment.getExternalStorageDirectory(), extraBinds)
|
||||
binds.forEach { cmd.add("-b"); cmd.add(it) }
|
||||
// Fake root and link2symlink are emulated by proot, so their syscalls must stay on the traced path.
|
||||
val fastPathKey = if (fastPath && !fakeRoot && linkDir == null && ProotFastPath.enabled(context)) ProotFastPath.key(root, binds) else null
|
||||
cmd += listOf(
|
||||
"/usr/bin/env", "-i", "HOME=/root", "USER=root", "LANG=C.UTF-8",
|
||||
@@ -48,8 +47,6 @@ object GuestCommand {
|
||||
"DROIDDECK_BWRAP_SOCKET=${BwrapSpawner.socket(context)}",
|
||||
"XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share:/usr/local/share:/usr/share",
|
||||
)
|
||||
// The Steam client installer and the package tools inside the guest fetch over plain curl,
|
||||
// so the app proxy has to reach them through the environment proot starts them with.
|
||||
DownloadSource.proxyHostPort(context).takeIf { it.isNotEmpty() }?.let { hostPort ->
|
||||
cmd += listOf(
|
||||
"http_proxy=http://$hostPort", "https_proxy=http://$hostPort",
|
||||
@@ -77,7 +74,6 @@ object GuestCommand {
|
||||
try {
|
||||
while (process.isAlive && !flag.get()) Thread.sleep(200)
|
||||
if (flag.get()) {
|
||||
// PRoot ignores SIGTERM; SIGQUIT makes it kill its tracees and exit cleanly.
|
||||
if (pid > 0) {
|
||||
runCatching { android.system.Os.kill(pid, android.system.OsConstants.SIGQUIT) }
|
||||
} else {
|
||||
|
||||
@@ -50,7 +50,6 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
public static File liveDir(Context context) {
|
||||
// Android may evict cache files even while guest processes are using them.
|
||||
File dir = new File(context.getNoBackupFilesDir(), "guest-runtime");
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
@@ -63,7 +62,6 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
private static final String HOST_DIR = "opt/android-host";
|
||||
/** The downloaded add-on pack. The APK does not ship this binary. */
|
||||
public static final String PROOT_PACK = "add-on pack";
|
||||
public static final String PROOT_PACKAGED = "packaged";
|
||||
/** Termux's unpatched proot inside the rootfs. Developer switch only. */
|
||||
@@ -94,9 +92,8 @@ public final class LinuxRuntime {
|
||||
return packagedProot(context).isFile() && packagedLoader(context).isFile();
|
||||
}
|
||||
|
||||
/** Patched proot is the add-on pack. The rootfs copy is not that binary. */
|
||||
public static boolean patchedProot(Context context) {
|
||||
return AddonPack.PROOT.installed(context);
|
||||
return packagedProotReady(context) || AddonPack.PROOT.installed(context);
|
||||
}
|
||||
|
||||
public static File prootBinary(Context context) {
|
||||
@@ -113,7 +110,6 @@ public final class LinuxRuntime {
|
||||
return AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
}
|
||||
|
||||
/** Where {@link #prootBinary} came from: {@link #PROOT_PACK}, {@link #PROOT_ROOTFS} or {@link #PROOT_MISSING}. */
|
||||
public static String prootSource(Context context) {
|
||||
File bin = prootBinary(context);
|
||||
if (!bin.isFile()) return PROOT_MISSING;
|
||||
@@ -133,7 +129,6 @@ public final class LinuxRuntime {
|
||||
return hasRootfs(context) && (packagedProotReady(context) || patchedProot(context) || rootfsProotReady(context));
|
||||
}
|
||||
|
||||
/** The rootfs alone: enough to read the game library, while the proot pack can still be downloading. */
|
||||
public static boolean hasRootfs(Context context) {
|
||||
if (LinuxRuntimeInstaller.isRemoving() || LinuxRuntimeInstaller.hasRemovalPending(context)) return false;
|
||||
File root = rootDir(context);
|
||||
@@ -442,9 +437,6 @@ public final class LinuxRuntime {
|
||||
return thermalZone("ddr");
|
||||
}
|
||||
|
||||
// MangoHud reads the GPU and DDR temperatures from these zone numbers (bindAdrenoStats). On phones
|
||||
// where they are CPU zones, their type follows the temperature put there, so they stay out of the
|
||||
// CPU average.
|
||||
private static java.util.Map<String, String> replacedZoneTypes() {
|
||||
java.util.Map<String, String> replaced = new java.util.HashMap<>();
|
||||
if (gpuTempSource() != null) {
|
||||
@@ -455,7 +447,6 @@ public final class LinuxRuntime {
|
||||
return replaced;
|
||||
}
|
||||
|
||||
/** The zones the session's MangoHud averages for the CPU temperature (all typed cpuN-thermal there). */
|
||||
public static List<File> cpuTempZones() {
|
||||
java.util.Map<String, String> replaced = replacedZoneTypes();
|
||||
List<File> zones = new ArrayList<>();
|
||||
|
||||
@@ -244,10 +244,6 @@ public final class LinuxRuntimeInstaller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The download is named after the release, so a partial file is only ever resumed for the same
|
||||
* version and checksum, never for a different runtime that happens to share a fixed name.
|
||||
*/
|
||||
static String archiveName(Release release) {
|
||||
String version = release.version.replaceAll("[^A-Za-z0-9._-]", "_");
|
||||
String sum = release.sha256.replaceAll("[^A-Za-z0-9]", "");
|
||||
@@ -255,7 +251,6 @@ public final class LinuxRuntimeInstaller {
|
||||
return "linuxfs-" + version + "-" + sum + ".tar.zst";
|
||||
}
|
||||
|
||||
/** Removes archives left by other releases and by builds that used the fixed name. */
|
||||
private static void deleteOtherArchives(File dir, String keep) {
|
||||
File[] files = dir.listFiles((d, name) -> name.startsWith("linuxfs") && name.endsWith(".tar.zst") && !name.equals(keep));
|
||||
if (files == null) return;
|
||||
@@ -264,8 +259,6 @@ public final class LinuxRuntimeInstaller {
|
||||
|
||||
private static boolean installOnce(Context context, Release release, ProgressListener listener) {
|
||||
File archive = new File(context.getCacheDir(), archiveName(release));
|
||||
// A failed download keeps what it fetched so the next attempt resumes it; anything that
|
||||
// reached verification and failed is not trusted and is removed.
|
||||
boolean keepPartial = false;
|
||||
try {
|
||||
deleteOtherArchives(context.getCacheDir(), archive.getName());
|
||||
@@ -526,8 +519,6 @@ public final class LinuxRuntimeInstaller {
|
||||
}
|
||||
}
|
||||
|
||||
// Packages extract over the live runtime and their archives list a link before the file it
|
||||
// names, so a kill mid-way must leave neither a truncated file nor a link to a missing one.
|
||||
public static boolean extract(Context context, File archive, File destination, ProgressListener listener) {
|
||||
return extract(context, archive, destination, destination, listener);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,6 @@ object ProotFastPath {
|
||||
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
||||
const val MAX_BINDS = 256
|
||||
|
||||
/**
|
||||
* The fast path's trampoline is let through only by the proot built with patches/0014.
|
||||
* The rootfs copy (Termux's stock proot) is not that binary, so the library stays out.
|
||||
*/
|
||||
fun allows(preference: Boolean, noSeccomp: Boolean, source: String): Boolean =
|
||||
preference && !noSeccomp && source == LinuxRuntime.PROOT_PACK
|
||||
|
||||
|
||||
@@ -74,11 +74,6 @@ public final class RuntimeFileTree {
|
||||
throw new IOException("Cannot make directory removable: " + dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paths in a runtime tree that belong to the user: the home folder, imported AppImages and script apps, and catalog
|
||||
* AppImages with their menu entries and markers. Tar-kind catalog packages (the desktop) unpack over /usr and cannot
|
||||
* be carried.
|
||||
*/
|
||||
static java.util.List<String> userPaths(File tree) throws IOException {
|
||||
java.util.List<String> paths = new java.util.ArrayList<>(java.util.Arrays.asList("root", "opt/appimages/user", "opt/droiddeck-apps", "opt/droiddeck/wincomponents"));
|
||||
for (String n : children(new File(tree, "usr/local/share/applications"))) {
|
||||
@@ -168,13 +163,6 @@ public final class RuntimeFileTree {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves each user path that exists in {@code from} into {@code to}, replacing what {@code to} ships there. With
|
||||
* {@code onlyMissing}, a path already present in {@code to} is left alone. On failure the paths already moved go back
|
||||
* before the exception is thrown. Rollback failures are suppressed on that exception; callers must retain the source
|
||||
* of any incomplete rollback.
|
||||
* Returns the moved paths.
|
||||
*/
|
||||
static java.util.List<String> carryUserData(File from, File to, boolean onlyMissing) throws IOException {
|
||||
return carryUserData(from, to, onlyMissing, new java.util.ArrayList<>(userPaths(from, to)));
|
||||
}
|
||||
@@ -200,7 +188,6 @@ public final class RuntimeFileTree {
|
||||
return moved;
|
||||
}
|
||||
|
||||
/** Puts the given paths back from {@code from} into {@code to}; failures are collected, not stopped on. */
|
||||
static void carryBack(File from, File to, java.util.List<String> paths) throws IOException {
|
||||
IOException failed = null;
|
||||
for (int i = paths.size() - 1; i >= 0; i--) {
|
||||
|
||||
@@ -10,7 +10,6 @@ object RuntimeHealth {
|
||||
|
||||
fun brokenLibraryLinks(context: Context): List<String> = brokenLibraryLinks(LinuxRuntime.rootDir(context))
|
||||
|
||||
/** A complete runtime has no library link in usr/lib whose target is missing. */
|
||||
fun brokenLibraryLinks(root: File): List<String> =
|
||||
listOf("usr/lib", "usr/lib/aarch64-linux-gnu").flatMap { dir ->
|
||||
val lib = File(root, dir)
|
||||
|
||||
@@ -117,7 +117,6 @@ class RuntimeInstallService : Service() {
|
||||
if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(intent) else context.startService(intent)
|
||||
}
|
||||
|
||||
/** Keeps the process in the foreground until the returned release runs, so closing the app does not stop the install. */
|
||||
fun holdForPackage(context: Context, title: String): () -> Unit {
|
||||
packageTitle = title
|
||||
packageStage = title
|
||||
|
||||
Reference in new issue
Block a user