Files
mg4/app/src/unstable/java/com/evsuite/abrp/UsbUpdate.java
T
nilsandClaude Opus 5.5 66b403acb8 App 2.19.4: Export CarPlay data to the USB stick
Read-only diagnostic for CarPlay's resolution: window, SurfaceFlinger
and display state captured while CarPlay is in front, display-related
properties without identifiers, Allgo's APK and libraries and
CarPlay-named system files, written to the app's folder on the stick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
2026-10-23 21:40:08 +02:00

43 lines
1.7 KiB
Java

package com.evsuite.abrp;
import java.io.File;
import java.util.Locale;
/**
* Installing a car build from a USB stick — UNSTABLE BUILDS ONLY. For development: copy
* {@code NilsMG4-unstable-<version>.apk} and its {@code .sha256} (both from build-car) to the top
* folder of a stick, plug it in, press the button on the Settings tab.
*
* The same checks as the over-the-air update apply, minus the server: the newest such file that
* is newer than the installed version, a matching SHA-256 sidecar, this app's package, and the
* installer's own signature check. The pure parts are here, unit-tested; UpdateHook does the IO.
*/
final class UsbUpdate {
private UsbUpdate() { }
/** The top folder of the volume [appFilesDir] lives on; see {@link UsbVolume#root}. */
static File volumeRoot(File appFilesDir) {
return UsbVolume.root(appFilesDir);
}
/**
* The car-build APK to install among [names]: the highest version that is newer than
* [currentVersion], or null. Only names build-car writes count.
*/
static String pickNewest(String[] names, String currentVersion) {
String best = null, bestVersion = null;
if (names == null) return null;
for (String name : names) {
if (name == null || !name.toLowerCase(Locale.US).startsWith("nilsmg4-unstable-")) continue;
String version = OtaUpdater.versionFromAssetName(name);
if (version == null || !OtaUpdater.isNewer(version, currentVersion)) continue;
if (bestVersion == null || OtaUpdater.isNewer(version, bestVersion)) {
best = name;
bestVersion = version;
}
}
return best;
}
}