simutil_adb 1.4.0
simutil_adb: ^1.4.0 copied to clipboard
Android emulator and device APIs for SimUtil via adb.
Changelog #
1.4.0 #
EmulatorGrpcSessionstreams and controls an Android emulator over its gRPC API (streamScreenshotwith the MMAP transport into a caller-owned RGB888 file, input throughstreamInputEvent, recording withadb emu screenrecord), like Android Studio's embedded emulator.EmulatorEndpoint.find(serial)reads an emulator's gRPC port and token from its discovery file (avd/running/pid_<pid>.ini).emulatorCameraArgs(back:, front:)builds-camera-back/-camera-frontemulator args fromwebcam<N>,image:<path>,video:<path>,virtualscene,emulatedornone; one webcam cannot be both cameras.AndroidDeviceService.listWebcams()lists the host cameras the emulator can use (emulator -webcam-list).launchDevice(headless: true)also addsAndroidDeviceService.headlessGpuArgs(-gpu host) unless the caller passes-gpu: headless emulators otherwise render in software (lavapipe) and stream at ~5 fps instead of ~55.ScrcpySession.startwaits (up to 3 min) forsys.boot_completedbefore starting the server, which crashed when started on a still-booting emulator.
1.3.0 #
AndroidAutomation.installrunsadb install -r -tand reports theFailure [...]code. Requiressimutil_core1.3.0.ScrcpySessionfails a live stream withDevice disconnectedwhen the server process exits (device unplugged or adb disconnected).
1.2.0 #
ScrcpySession.typeText(text)/pressKey(keycode, metaState:)inject text and Android key codes over the control socket (ScrcpyProtocol.text,ScrcpyProtocol.keycode(..., metaState:)).ScrcpySessionoptionsshowTouches,stayAwake,turnScreenOff(ScrcpyProtocol.displayPower) andpowerOffOnClose.AndroidDeviceService.wipeDatadeletes an AVD's user data, cache and snapshots. Requiressimutil_core1.2.0.ScrcpySessionadds the server's own output to thescrcpy server did not starterror (e.g. a version mismatch), and waits up to ~10 s (was ~5 s) for a cold emulator to start the server.
1.1.0 #
AndroidDeviceService.adbPathfalls back to Homebrew (/opt/homebrew/bin,/usr/local/bin) and winget (%LOCALAPPDATA%\Microsoft\WinGet\Links) installs before bareadbonPATH.ScrcpySessionreads video on a worker isolate;attachDecoder(decode, id)/detachDecoder(id)feed a native decoder (a Cdecodefunction address) straight from that isolate. Adds theffidependency.ScrcpySessionasks the encoder for a key frame every second (video_codec_options=i-frame-interval:int=1), so a decoder that dropped frames recovers within a second instead of up to ~10 s.ScrcpySession.presshandlesDeviceButton.volumeUp/volumeDown(ScrcpyProtocol.keyVolumeUp/keyVolumeDown).AdbWirelessPairing: pairs Android 11+ devices over Wi-Fi and connects them asip:port(pairAndConnect), including QR pairing (startQr()→QrPairingSession.payload/result()).WifiDiscoveryService.watchConnectDevices()discovers_adb-tls-connect._tcpendpoints.connectDevice/disconnectDevicetime out after 15 s andpairDeviceafter 30 s (interactive priority) instead of waiting forever.launchDevice(headless: true)addsAndroidDeviceService.headlessArgs(-no-window -no-audio -no-boot-anim); flags the caller also passes are not repeated.deleteSimulatordeletes an AVD (its.iniand data directory underavdHome).watchDevices()followsadb track-devices(reconnecting when the adb server restarts) and the AVD directory, instead of polling.- Device listing (
adb devices,emu avd name,-list-avds) runs atCommandPriority.background; launch andemu killatinteractive. ScrcpySession: streams and controls a device through the user's installed scrcpy server (ScrcpyInstall.locate), exposing H.264 access units onvideo(60 fps by default), with recording to.mp4(remuxed by ffmpeg when available, else.ts).requestKeyFrame()asks for a fresh key frame (at most once a second; requests in between are deferred, not dropped). Session setup commands run atCommandPriority.interactive.AndroidAutomation.tapElementtaps a node at its own pixel center withinput tap(works on permission prompts too).AndroidAutomation: relaunches apps (am force-stop, orpm clearwithclearState, thenmonkey), types withinput text(ASCII) and reads elements fromuiautomator dump(parseUiautomatorDump, normalized to thewm sizescreen so dialogs and permission prompts map right).- Devices carry their Android version in
platform: emulators from the AVD.initarget, booted hardware fromro.build.version.release(androidPlatformNamemaps API levels to versions).
1.0.1 #
- Windows: resolves
adb.exe/emulator.exeand defaults the SDK root to%LOCALAPPDATA%\Android\Sdk. NewisWindowstest seam onAndroidDeviceService.
1.0.0 #
- Initial release, extracted from the
simutilapp.