import { type CacheDirContext } from "./cacheDir.js"; import { detectAndroidSdk, type AndroidSdk } from "./androidSdk.js"; import type { Logger } from "./loader.js"; export declare const CMDLINE_TOOLS_BUILD = "11076708"; export declare const DEFAULT_AVD_NAME = "doc-detective"; export declare const DEVICE_TYPE_PROFILES: Record; export declare function androidVersionToApi(osVersion: string): number | null; export declare function hostAbi(arch?: string): "x86_64" | "arm64-v8a"; export declare function jreDownloadUrl(platform?: NodeJS.Platform, arch?: string): string; export declare function jreArchiveFilename(platform?: NodeJS.Platform): string; export declare function resolveJavaHome(extractDir: string, entries: string[], platform?: NodeJS.Platform): string | null; export declare function javaBinPath(javaHome: string, platform?: NodeJS.Platform): string; export declare function cmdlineToolsUrl(platform: NodeJS.Platform): string; export declare function parseSdkmanagerList(text: string): string[]; export declare function pickSystemImage(images: string[], { osVersion, abi }: { osVersion?: string; abi: string; }): string | null; interface FsDeps { existsSync?: (p: string) => boolean; readdirSync?: (p: string) => string[]; rmSync?: (p: string, opts?: { recursive?: boolean; force?: boolean; }) => void; } export declare function listInstalledSystemImages(sdkRoot: string, deps?: FsDeps): string[]; export declare function isSystemImageComplete(sdkRoot: string, pkg: string, deps?: FsDeps): boolean; export type AndroidInstallAction = { type: "bootstrap-cmdline-tools"; url: string; dest: string; } | { type: "accept-licenses"; } | { type: "install-package"; pkg: string; } | { type: "create-avd"; name: string; systemImage: string; device: string; }; export interface AndroidInstallPlanInput { detected: AndroidSdk | null; cacheSdkRoot: string; platform: NodeJS.Platform; abi: string; installedImages: string[]; availableImages: string[]; osVersion?: string; deviceType?: string; avdName?: string; hasPlatformTools?: boolean; hasEmulator?: boolean; } export interface AndroidInstallPlan { sdkRoot: string; bootstrapped: boolean; actions: AndroidInstallAction[]; systemImage: string | null; blocked?: string; } export declare function buildAndroidInstallPlan(input: AndroidInstallPlanInput): AndroidInstallPlan; export declare const SDK_INSTALL_MAX_ATTEMPTS = 3; export declare function isTransientSdkError(message: unknown): boolean; type SdkRun = (command: string, args: string[], opts?: { input?: string; cwd?: string; }) => Promise; export interface SdkRetryDeps { logger?: Logger; sleep?: (ms: number) => Promise; maxAttempts?: number; } /** * Run a single sdkmanager/avdmanager command with bounded self-repair for * TRANSIENT download failures. On a transient rejection with attempts left, log * a warn (the retry is surfaced, never silent) and retry after a short backoff; * a non-transient failure — or the last attempt — rethrows unchanged. */ export declare function runSdkInstallWithRetry(run: SdkRun, command: string, args: string[], opts?: { input?: string; cwd?: string; }, deps?: SdkRetryDeps): Promise; export interface InstallReport { kind: "android"; assetId: string; action: string; notes?: string[]; } export interface AndroidInstallerDeps { logger?: Logger; detect?: typeof detectAndroidSdk; javaPresent?: () => boolean; run?: (command: string, args: string[], opts?: { input?: string; cwd?: string; }) => Promise; bootstrap?: (url: string, destSdkRoot: string) => Promise; detectCachedJavaHome?: (cacheJreRoot: string) => string | null; bootstrapJava?: (cacheJreRoot: string) => Promise; setJavaEnv?: (javaHome: string, platform: NodeJS.Platform) => void; fs?: FsDeps; arch?: string; platform?: NodeJS.Platform; sleep?: (ms: number) => Promise; } export interface EnsureJavaResult { ok: boolean; source?: "system" | "cache" | "bootstrap"; javaHome?: string; reason?: string; } /** * Make a Java runtime available for sdkmanager/avdmanager without requiring one * on the host: use the system Java if present, else a previously cached * Doc-Detective JRE, else download a portable Temurin JRE into the cache. On a * cache/bootstrap hit JAVA_HOME + PATH are pointed at it for the rest of this * process. Effects are injected so the branch logic is unit-testable. */ export declare function ensureJava(deps: { javaPresent: () => boolean; cacheJreRoot: string; detectCachedJavaHome: (cacheJreRoot: string) => string | null; bootstrapJava: (cacheJreRoot: string) => Promise; setJavaEnv?: (javaHome: string, platform: NodeJS.Platform) => void; platform?: NodeJS.Platform; logger?: Logger; }): Promise; /** * Execute (or, with dryRun, only report) the android install plan. Licenses * acceptance and downloads happen only with `yes: true`; without it the plan * is printed and the caller exits non-zero, matching Doc Detective's * prompt-averse CLI style. Java (JRE 17+) is required for sdkmanager/avdmanager * and checked up front. */ export declare function installAndroid({ yes, force, dryRun, osVersion, deviceType, ctx, deps, }: { yes?: boolean; force?: boolean; dryRun?: boolean; osVersion?: string; deviceType?: string; ctx?: CacheDirContext; deps?: AndroidInstallerDeps; }): Promise; export declare function winShellCommand(command: string, args: string[]): string; export declare function androidAvdHome(): string; export {}; //# sourceMappingURL=androidInstaller.d.ts.map