/** * Android SDK discovery and one-shot provisioning for `pi-gui android setup`. * * pi-gui's rule everywhere else is "discover + honest dead end, never install" — the * browser driver refuses to download Chrome. The emulator earns the one exception * because there is no app-store Chrome equivalent: a working AVD means cmdline-tools + * platform-tools + emulator + a system image + an AVD definition, five artifacts nobody * assembles by accident. The exception stays narrow: * * - Only the EXPLICIT `pi-gui android setup` command installs anything. The driver and * `android start` still hit honest dead ends that *name* setup as the fix. * - An existing SDK is adopted, never duplicated: ANDROID_HOME / ANDROID_SDK_ROOT / * the default install locations win over our own root (~/.pi-gui/android-sdk). * - Downloads need the caller's explicit consent (--yes), with sizes named up front. * * Java note: sdkmanager/avdmanager are JVM tools, so SETUP needs a JRE (17+). Runtime * does not — the emulator and adb are native. When no adequate `java` answers, setup * provisions its own Temurin 17 JRE under ~/.pi-gui/jre (≈45 MB, setup-only — nothing * at runtime ever touches it), so "one click" on the host side really is one click. */ import { type ExecFn } from "../adb.ts"; export declare const DEFAULT_API = 33; export declare const DEFAULT_AVD = "PiGuiAvd"; export declare const DEFAULT_DEVICE = "pixel_6"; export declare function ownSdkRoot(): string; /** The SDK root to use: adopt an existing install, else our own (which may not exist yet). */ export declare function sdkRoot(): { root: string; adopted: boolean; }; /** The emulator binary: PATH, then the resolved SDK root. */ export declare function findEmulator(): string | null; export declare function preferredAbi(): string; export declare function systemImagePackage(api: number): string; export interface SdkDoctorReport { sdkRoot: string; sdkAdopted: boolean; adb: string | null; emulator: string | null; sdkmanager: string | null; avdmanager: string | null; java: string | null; } export declare function sdkDoctor(exec?: ExecFn): Promise; export declare function ownJreRoot(): string; /** `java -version` prints `… version "17.0.10" …` (or `"1.8.0_281"` — legacy 1.x = major * in the minor slot). Null when the line carries no version at all. */ export declare function javaMajorOf(versionLine: string): number | null; export interface SetupOptions { api?: number; avd?: string; /** avdmanager hardware profile id (default pixel_6). */ device?: string; log?: (line: string) => void; } /** * Provision end to end, skipping every step that is already satisfied: * cmdline-tools → licenses → platform-tools + emulator + system image → AVD. * Called only by `pi-gui android setup` after explicit consent. */ export declare function setupSdk(opts?: SetupOptions): Promise<{ avd: string; }>; export interface EnsureAvdOptions { name: string; api?: number; /** avdmanager hardware profile id (default pixel_6). */ device?: string; log?: (line: string) => void; } /** * Create an AVD from the ALREADY-INSTALLED system image — the cheap slot-provisioning * verb behind multi-emulator hosts (`pi-gui android avd ensure `): the image is * shared, so a new slot costs seconds and zero download. Refuses (naming setup) when * the image is missing rather than silently pulling 1.5 GB. */ /** The newest API whose google_apis image is installed — what slot AVDs default to, * so `avd ensure` works on a machine whose setup ran with a non-default `--api`. */ export declare function highestInstalledApi(): Promise; export declare function ensureAvd(opts: EnsureAvdOptions): Promise<{ created: boolean; }>;