Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(docker): add Android emulator image support
[email protected]023e79793688
diff --git a/libs/python/computer/computer/providers/docker/provider.py b/libs/python/computer/computer/providers/docker/provider.pyindex ca24c0ee17..673f6d1dc5 100644--- a/libs/python/computer/computer/providers/docker/provider.py+++ b/libs/python/computer/computer/providers/docker/provider.py@@ -59,6 +59,7 @@ class DockerProvider(BaseVMProvider):- "trycua/cua-xfce:latest" (vanilla XFCE)- "trycua/cua-qemu-linux:latest" (QEMU-based, only supports Ubuntu for now)- "trycua/cua-qemu-windows:latest" (QEMU-based, only supports Windows 11 Enterprise for now)+ - "trycua/cua-droid:latest" (Android 11 emulator)verbose: Enable verbose loggingephemeral: Use ephemeral (temporary) storagevnc_port: Port for VNC interface (default: 6901)@@ -91,7 +92,7 @@ class DockerProvider(BaseVMProvider):def _detect_image_config(self):"""Detect image type and configure paths accordingly."""- # Detect if this is a XFCE, Kasm or QEMU image+ # Detect if this is a XFCE, Kasm, QEMU, or Android imageif "docker-xfce" in self.image.lower() or "xfce" in self.image.lower():self._home_dir = "/home/cua"self._image_type = "docker-xfce"@@ -101,6 +102,11 @@ class DockerProvider(BaseVMProvider):self._home_dir = ""self._image_type = "qemu"logger.info("Detected QEMU image: using /")+ elif "droid" in self.image.lower():+ # Android-based images+ self._home_dir = "/home/androidusr"+ self._image_type = "android"+ logger.info("Detected Android image: using /home/androidusr")else:# Default to Kasm configurationself._home_dir = "/home/kasm-user"@@ -303,17 +309,27 @@ class DockerProvider(BaseVMProvider):cpu_count = str(run_opts["cpu"])cmd.extend(["--cpus", cpu_count])- # Add devices if specified (e.g., /dev/kvm for QEMU)+ # Add devices if specified (e.g., /dev/kvm for QEMU and Android)warn_no_kvm = False+ has_kvm = Falseif "devices" in run_opts:devices = run_opts["devices"]- warn_no_kvm = self._image_type == "qemu" and "/dev/kvm" not in devices+ has_kvm = "/dev/kvm" in devices+ warn_no_kvm = self._image_type == "qemu" and not has_kvmfor device in devices:cmd.extend(["--device", device])elif "device" in run_opts:- warn_no_kvm = self._image_type == "qemu" and run_opts["device"] != "/dev/kvm"+ has_kvm = run_opts["device"] == "/dev/kvm"+ warn_no_kvm = self._image_type == "qemu" and not has_kvmcmd.extend(["--device", run_opts["device"]])+ # Android requires /dev/kvm+ if self._image_type == "android" and not has_kvm:+ raise ValueError(+ "Android images require /dev/kvm device. "+ 'Add run_opts={"devices": ["/dev/kvm"]} to your Computer configuration.'+ )+if warn_no_kvm:logger.warning("/dev/kvm device is recommended for QEMU images for better performance."@@ -327,9 +343,16 @@ class DockerProvider(BaseVMProvider):vnc_port = run_opts.get("vnc_port", self.vnc_port)api_port = run_opts.get("api_port", self.api_port)- # Port mappings differ for QEMU vs Kasm/XFCE images- internal_vnc_port = 8006 if self._image_type == "qemu" else 6901- internal_api_port = 5000 if self._image_type == "qemu" else 8000+ # Port mappings differ for QEMU, Android vs Kasm/XFCE images+ if self._image_type == "qemu":+ internal_vnc_port = 8006+ internal_api_port = 5000+ elif self._image_type == "android":+ internal_vnc_port = 6080+ internal_api_port = 8000+ else:+ internal_vnc_port = 6901+ internal_api_port = 8000if vnc_port:cmd.extend(["-p", f"{vnc_port}:{internal_vnc_port}"]) # VNC port@@ -351,6 +374,13 @@ class DockerProvider(BaseVMProvider):cmd.extend(["-e", "VNC_PW=password"]) # Set VNC passwordcmd.extend(["-e", "VNCOPTIONS=-disableBasicAuth"]) # Disable VNC basic auth+ # Add Android-specific default environment variables+ if self._image_type == "android":+ if "env" not in run_opts:+ run_opts["env"] = {}+ run_opts["env"].setdefault("EMULATOR_DEVICE", "Samsung Galaxy S10")+ run_opts["env"]["WEB_VNC"] = "true"+# Add custom environment variables from run_optsif "env" in run_opts and isinstance(run_opts["env"], dict):for key, value in run_opts["env"].items():