import { JWProxy } from 'appium/driver';
import type { AppiumLogger, StringRecord, HTTPMethod, HTTPBody, ProxyResponse } from '@appium/types';
import type { ADB, InstallState } from 'appium-adb';
export declare const INSTRUMENTATION_TARGET = "io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner";
export interface PackageInfo {
    installState: InstallState;
    appPath: string;
    appId: string;
}
export interface UiAutomator2ServerOptions {
    adb: ADB;
    host: string;
    systemPort: number;
    disableWindowAnimation: boolean;
    readTimeout?: number;
    disableSuppressAccessibilityService?: boolean;
    basePath?: string;
}
declare class UIA2Proxy extends JWProxy {
    didInstrumentationExit: boolean;
    proxyCommand(url: string, method: HTTPMethod, body?: HTTPBody): Promise<[ProxyResponse, HTTPBody]>;
}
export declare class UiAutomator2Server {
    readonly jwproxy: UIA2Proxy;
    readonly proxyReqRes: typeof UIA2Proxy.prototype.proxyReqRes;
    readonly proxyCommand: typeof UIA2Proxy.prototype.command;
    private readonly host;
    private readonly systemPort;
    private readonly adb;
    private readonly disableWindowAnimation;
    private readonly disableSuppressAccessibilityService?;
    private readonly log;
    private instrumentationProcess;
    constructor(log: AppiumLogger, opts: UiAutomator2ServerOptions);
    /**
     * Installs the apks on to the device or emulator.
     *
     * @param installTimeout - Installation timeout
     */
    installServerApk(installTimeout?: number): Promise<void>;
    startSession(caps: StringRecord): Promise<void>;
    deleteSession(): Promise<void>;
    private prepareServerPackage;
    /**
     * Checks if server components must be installed from the device under test
     * in scope of the current driver session.
     *
     * For example, if one of servers on the device under test was newer than servers current UIA2 driver wants to
     * use for the session, the UIA2 driver should uninstall the installed ones in order to avoid
     * version mismatch between the UIA2 drier and servers on the device under test.
     * Also, if the device under test has missing servers, current UIA2 driver should uninstall all
     * servers once in order to install proper servers freshly.
     *
     * @param packagesInfo
     * @returns true if any of components is already installed and the other is not installed
     *                    or the installed one has a newer version.
     */
    private shouldUninstallServerPackages;
    /**
     * Checks if server components should be installed on the device under test in scope of the current driver session.
     *
     * @param packagesInfo
     * @returns true if any of components is not installed or older than currently installed in order to
     *                    install or upgrade the servers on the device under test.
     */
    private shouldInstallServerPackages;
    private verifyServicesAvailability;
    private startInstrumentationProcess;
    private stopInstrumentationProcess;
    private cleanupAutomationLeftovers;
    /**
     * Blocks until UIA2 server stops running
     * or SERVER_SHUTDOWN_TIMEOUT_MS expires
     *
     * @returns {Promise<void>}
     */
    private _waitForTermination;
}
export {};
//# sourceMappingURL=core.d.ts.map