App 2.18.0: install from a USB stick
Settings -> App -> "Install from USB stick" (car build only). It looks in the top folder of every mounted volume (found from the app's own folder on it, since the head unit has no file picker) for NilsMG4-unstable-<version>.apk, takes the newest one newer than the installed version, checks it against its .sha256 sidecar and the package name, and installs it with the same PackageInstaller session as the over-the-air update. The stable build gets a stub and no button. Tested on the emulator: 2.18.0 installed a 2.18.1 from the storage's top folder without a confirmation, as the system user, so the OTA install step should not need one either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.evsuite.abrp;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/** Finding a car build on a USB stick — pure JVM. */
|
||||
public class UsbUpdateTest {
|
||||
|
||||
@Test
|
||||
public void theStickRootIsFourLevelsAboveTheAppFolder() {
|
||||
assertEquals(new File("/storage/1234-ABCD"), UsbUpdate.volumeRoot(
|
||||
new File("/storage/1234-ABCD/Android/data/com.stinnesbeck.nilsmg4.unstable/files")));
|
||||
assertEquals(new File("/storage/emulated/0"), UsbUpdate.volumeRoot(
|
||||
new File("/storage/emulated/0/Android/data/com.stinnesbeck.nilsmg4.unstable/files")));
|
||||
assertNull(UsbUpdate.volumeRoot(new File("/data/user/0/com.stinnesbeck.nilsmg4.unstable/files")));
|
||||
assertNull(UsbUpdate.volumeRoot(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theNewestNewerCarBuildIsPicked() {
|
||||
String[] names = {"NilsMG4-unstable-2.17.4.apk", "NilsMG4-unstable-2.18.0.apk", "NilsMG4-unstable-2.18.0.apk.sha256",
|
||||
"NilsMG4-unstable-2.17.10.apk", "NilsMG4-stable-9.0.0.apk", "FatihsMG4-unstable-9.9.9.apk", "notes.txt"};
|
||||
assertEquals("NilsMG4-unstable-2.18.0.apk", UsbUpdate.pickNewest(names, "2.17.5-unstable"));
|
||||
assertEquals("NilsMG4-unstable-2.17.10.apk", UsbUpdate.pickNewest(
|
||||
new String[]{"NilsMG4-unstable-2.17.4.apk", "NilsMG4-unstable-2.17.10.apk"}, "2.17.5-unstable"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nothingNewerMeansNothing() {
|
||||
assertNull(UsbUpdate.pickNewest(new String[]{"NilsMG4-unstable-2.17.5.apk"}, "2.17.5-unstable"));
|
||||
assertNull(UsbUpdate.pickNewest(new String[0], "2.17.5-unstable"));
|
||||
assertNull(UsbUpdate.pickNewest(null, "2.17.5-unstable"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user