* build: compileSdk 36 -> 37 + okhttp 5.4.0 -> 5.5.0 Take okhttp 5.5.0 (folds in dependabot PR #940) which hard-requires compileSdk 37 via AAR metadata. targetSdk stays 36 for now. * build: targetSdk 36 -> 37 (Android 17) + ACCESS_LOCAL_NETWORK gating Opt into Android 17 runtime behavior. The app connects to a gateway (default 127.0.0.1:9119, plus LAN + remote), so targeting 37 forces the new ACCESS_LOCAL_NETWORK permission for LAN hosts. - AndroidManifest: declare ACCESS_LOCAL_NETWORK (harmless below API 37) - LocalNetwork.kt: pure detector + needsLocalNetworkPermission(baseUrl) (loopback + public remote exempt; RFC1918/link-local/CGNAT gated) - ConnectViewModel: requestConnect() gates on the permission; screen launches the prompt; onLanPermissionResult proceeds or shows a clear error - flake.nix: android platform 36 -> 37 - Tests: LocalNetworkTest + ConnectPermissionGateTest (SDK_INT / permission branching mocked, no device needed) - Task 8 finding: assistant services (VoiceInteraction*/Recognition) and the remoteMessaging ChatNotificationService do NOT hit the Android 17 mic/ while-in-use foreground hardening, so no change required. * fix: ktlint + @Composable LocalContext hoist (was blocking CI) - ConnectScreen: hoist LocalContext.current out of onClick lambda (calling a @Composable inside a non-composable lambda broke compileDebugKotlin) - ktlint --format: multiline-expression-wrapping, function-signature, no-empty-first-line-in-class-body, no-unused-imports - LocalNetwork.kt: merge consecutive KDocs (no-consecutive-comments) flake.nix buildToolsVersion/platformToolsVersion intentionally stay 36.0.0 — they are decoupled from compileSdk; only platformVersions needs 37. * fix: suspend mock (coEvery) + flake toolchain pinned to 37.0.0 - ConnectPermissionGateTest: getStatus() is suspend → use coEvery (was breaking compileDebugUnitTestKotlin) - flake.nix: buildToolsVersion/platformToolsVersion/cmdLineToolsVersion pinned to 37.0.0 (verified against pinned nixpkgs 241313f — resolves to android-sdk-*-37.0.0 derivations; platformVersions already 37) * fix(flake): revert cmdLineToolsVersion to 11.0 (not API-aligned) cmdline-tools uses its own versioning (latest = 21.0, never 37.0.0) — nixpkgs rejects 37.0.0 with 'version missing'. build-tools + platform-tools stay 37.0.0 (verified resolve to android-sdk-*-37.0.0). flake now evals clean against pinned nixpkgs 241313f. * flake: track nixos-unstable + pin toolchain to latest (cmdline 22.0, platform-tools 37.0.1, build-tools 37.0.0, platform 37.1) - inputs.nixpkgs -> nixos-unstable, flake.lock bumped to rev ffb3c9b7 (2026-08-19) - cmdLineToolsVersion 11.0 -> 22.0 (own versioning, not API-aligned; v22_0 confirms) - platformToolsVersion 37.0.0 -> 37.0.1 - buildToolsVersion stays 37.0.0 - platformVersions 37 -> 37.1 - verified: nix flake check --no-build -> all checks passed on hyari * fix: unit tests — Uri stub + Build.SDK_INT final-field mock - LocalNetwork.kt: needsLocalNetworkPermission uses java.net.URI instead of android.net.Uri (latter is a non-functional stub in JVM unit tests, its host returns null -> gate always false). Added pure requiresLocalNetworkPermission(sdkInt, baseUrl). - ConnectViewModel: inject sdkVersion (package-private) instead of reading the final static Build.VERSION.SDK_INT directly; gate via requiresLocalNetworkPermission. - ConnectPermissionGateTest: drop mockkStatic(Build.VERSION) (MockKException on final static field, and against repo convention); inject sdkVersion; add pure gate-decision matrix. Fixes 7 red tests. * fix(test): remove illegal ':' from test function names (compile error) * fix(test): order getString mocks so specific resources win over wildcard * fix(flake): include android-37.0 system image so the emulator can boot Google only publishes the android-37.0 system image (no 37.1 image exists yet). With platformVersions=["37.1"] composeAndroidPackages found no matching system image, leaving system-images/ empty and every AVD FATALing with 'Broken AVD system path'. Adding 37.0 pulls the published image so an AVD boots (verified: hermes37 AVD boots Android 17 / API 37 on hyari). compileSdk/targetSdk stay 37. Also bump AGENTS.md SDK note 36 -> 37 (was stale). * fix(flake): platformVersions 37.1 -> 37.0 Drop 37.1; 37.0 provides both the SDK platform for compileSdk 37 and the published android-37.0 system image the emulator needs. * fix(flake): remove stray tool-scratch line leaked into flake.nix (line 116) A terminal tool's /tmp scratch rename line got appended to flake.nix, making it invalid Nix. Removed; flake now parses + 'nix flake check' passes on hyari. * fix(build): pin buildToolsVersion 37.0.0 to match nix SDK AGP defaulted build-tools to 36.0.0, which isn't in the nix-managed SDK (only 37.0.0 is provisioned). Local ./gradlew builds then tried to *install* 36.0.0 into the immutable /nix/store and failed. Pin 37.0.0 so the local nix devShell builds. CI uses its own SDK so unaffected. --------- Co-authored-by: Hy4ri <Hy4ri@users.noreply.github.com>
116 lines
4.2 KiB
Nix
116 lines
4.2 KiB
Nix
{
|
|
description = "HermesControl - Android app for Hermes agent";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config = {
|
|
android_sdk.accept_license = true;
|
|
allowUnfree = true;
|
|
};
|
|
};
|
|
|
|
buildToolsVersion = "37.0.0";
|
|
androidSdk =
|
|
(pkgs.androidenv.composeAndroidPackages {
|
|
# Toolchain pinned to the latest available on nixos-unstable (rev ffb3c9b7)
|
|
cmdLineToolsVersion = "22.0";
|
|
platformToolsVersion = "37.0.1";
|
|
|
|
# Build tools
|
|
buildToolsVersions = [buildToolsVersion];
|
|
|
|
# Target platforms: 37.0 provides both the SDK platform for
|
|
# compileSdk 37 AND the published android-37.0 system image the
|
|
# emulator needs to boot an AVD (no 37.1 image exists yet).
|
|
# compileSdk/targetSdk in app/build.gradle.kts stay 37.
|
|
platformVersions = ["37.0"];
|
|
|
|
# Emulator + system images for local AVD testing
|
|
includeEmulator = true;
|
|
includeSystemImages = true;
|
|
systemImageTypes = ["google_apis"];
|
|
abiVersions = ["x86_64"];
|
|
|
|
# NDK (not needed for this project, but handy)
|
|
includeNDK = false;
|
|
|
|
# Extra licenses
|
|
extraLicenses = [
|
|
"android-googletv-license"
|
|
"android-sdk-arm-dbt-license"
|
|
"android-sdk-license"
|
|
"android-sdk-preview-license"
|
|
"google-gdk-license"
|
|
"intel-android-extra-license"
|
|
"intel-android-sysimage-license"
|
|
"mips-android-sysimage-license"
|
|
];
|
|
}).androidsdk;
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
# Java 21 (required for AGP 9.x / Gradle 9.x)
|
|
jdk21
|
|
|
|
# Android SDK (platforms, build-tools, platform-tools, emulator, system-images)
|
|
androidSdk
|
|
];
|
|
|
|
# Point everything at the Nix-managed SDK
|
|
ANDROID_HOME = "${androidSdk}/libexec/android-sdk";
|
|
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
|
|
JAVA_HOME = "${pkgs.jdk21}";
|
|
|
|
# Gradle needs a writable home
|
|
GRADLE_USER_HOME = "$PWD/.gradle-home";
|
|
|
|
shellHook = ''
|
|
echo " HermesControl Android dev shell"
|
|
echo " Java: $(java -version 2>&1 | head -1)"
|
|
echo " ANDROID_HOME: $ANDROID_HOME"
|
|
echo ""
|
|
|
|
# Ensure Android CLI tools and local user binaries are on PATH
|
|
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$HOME/.local/bin:$PATH"
|
|
|
|
# Writable gradle home
|
|
mkdir -p "$GRADLE_USER_HOME"
|
|
|
|
# ADB Screen Resolution Aliases
|
|
alias avd-phone='adb shell wm size 1440x3120 && adb shell wm density 500'
|
|
alias avd-phone-fhd='adb shell wm size 1080x2400 && adb shell wm density 420'
|
|
|
|
alias avd-tablet='adb shell wm size 1600x2560 && adb shell wm density 320'
|
|
alias avd-tablet-land='adb shell wm size 2560x1600 && adb shell wm density 320'
|
|
|
|
alias avd-reset='adb shell wm size reset && adb shell wm density reset'
|
|
|
|
# HermesControl app logcat (filtered to the app process only)
|
|
alias logcat-app='adb logcat --pid=$(adb shell pidof com.m57.hermescontrol)'
|
|
|
|
echo "Display Presets Loaded:"
|
|
echo " avd-phone -> 1440x3120 (500 DPI) [QHD+ Flagship]"
|
|
echo " avd-phone-fhd -> 1080x2400 (420 DPI) [FHD+ Flagship]"
|
|
echo " avd-tablet -> 1600x2560 (320 DPI) [Portrait Tablet]"
|
|
echo " avd-tablet-land -> 2560x1600 (320 DPI) [Landscape Tablet]"
|
|
echo " avd-reset -> Reset size & density back to AVD defaults"
|
|
echo " logcat-app -> Logcat for the HermesControl app process only"
|
|
echo ""
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|