AGENTS.md: an overview for agents; car-emulator in the flake

AGENTS.md still described upstream's EVABRPUploader (GitHub updates,
the old architecture and tabs). It is now the entry point for agents:
what the project is (app, Go server, k8s, EVHardware), the rules
(nothing touches the cluster, secrets, read-only telemetry, null is not
zero, fail closed, honesty), the facts confirmed on the car, the app's
structure and UI conventions, how to build, test, publish and install,
and which document holds what. SPECS.md stays the journal.

The Android 9 test emulator, so far a file under the ignored build/,
is now reproducible: nix run .#car-emulator creates an AVD at
1920x720/160 dpi with the AOSP image that shares the car's platform key
and starts it on port 5560. Checked from scratch: the car build
installs as the system user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
2026-10-18 21:12:41 +02:00
co-authored by Claude Opus 5.5
parent 69d284f81b
commit 253c768781
3 changed files with 164 additions and 102 deletions
+53
View File
@@ -182,5 +182,58 @@
'';
};
});
# An Android 9 emulator shaped like the head unit, for testing the car build: the AOSP
# "default" image is signed with the same public platform key, so the car APK installs
# there as the system user too. 1920x720 at 160 dpi; `adb shell wm size 1778x640` gives
# the app window the car leaves. No vehicle data: every value shows "—". Not in the dev
# shell, because the emulator and its image are a large download.
# nix run .#car-emulator (from the checkout; state in build/emulator/)
packages.x86_64-linux.car-emulator =
let
pkgs = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; android_sdk.accept_license = true; };
};
emu = (pkgs.androidenv.composeAndroidPackages {
platformVersions = [ "28" ];
includeEmulator = true;
includeSystemImages = true;
systemImageTypes = [ "default" ];
abiVersions = [ "x86_64" ];
includeNDK = false;
}).androidsdk;
in
pkgs.writeShellApplication {
name = "car-emulator";
runtimeInputs = [ pkgs.coreutils pkgs.gnugrep ];
text = ''
root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
state="$root/build/emulator"
mkdir -p "$state/avd" "$state/home"
export ANDROID_HOME=${emu}/libexec/android-sdk ANDROID_SDK_ROOT=${emu}/libexec/android-sdk
export ANDROID_AVD_HOME="$state/avd" ANDROID_EMULATOR_HOME="$state/home" ANDROID_USER_HOME="$state/home"
avd="$state/avd/mg4test.avd"
if [ ! -d "$avd" ]; then
echo no | ${emu}/bin/avdmanager create avd -n mg4test \
-k "system-images;android-28;default;x86_64" --force -p "$avd"
{
echo "hw.lcd.width=1920"
echo "hw.lcd.height=720"
echo "hw.lcd.density=160"
echo "hw.ramSize=2G"
echo "disk.dataPartition.size=10G"
} >> "$avd/config.ini"
fi
echo "Starting the MG4-shaped emulator on port 5560 (adb: emulator-5560); Ctrl-C stops it."
echo "adb: ${emu}/bin/adb -s emulator-5560"
exec "$ANDROID_HOME/emulator/emulator" -avd mg4test -no-audio -no-boot-anim \
-gpu swiftshader_indirect -no-snapshot -port 5560 "$@"
'';
};
apps.x86_64-linux.car-emulator = {
type = "app";
program = "${self.packages.x86_64-linux.car-emulator}/bin/car-emulator";
};
};
}