From 091a35009b00a9c892d2175619908718565944c6 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Mon, 6 Jul 2026 14:55:01 +0800 Subject: [PATCH] feat: add support for BlueStacks Air detection in connection logic --- module/device/connection.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/module/device/connection.py b/module/device/connection.py index 55e3d5b..68af93f 100644 --- a/module/device/connection.py +++ b/module/device/connection.py @@ -312,6 +312,23 @@ class Connection(ConnectionAttr): logger.attr('ro.product.brand', res) return 'waydroid' in res.lower() + @cached_property + @retry + def is_bluestacks_air(self): + # BlueStacks Air is the Mac version of BlueStacks + if not IS_MACINTOSH: + return False + if not self.is_ldplayer_bluestacks_family: + return False + # [bst.installed_images]: [Tiramisu64] + # [bst.instance]: [Tiramisu64] + # Tiramisu64 is Android 13 and BlueStacks Air is the only BlueStacks version that uses Android 13 + res = self.adb_getprop('bst.installed_images') + logger.attr('bst.installed_images', res) + if 'Tiramisu64' in res: + return True + return False + @cached_property @retry def nemud_app_keep_alive(self) -> str: @@ -405,11 +422,13 @@ class Connection(ConnectionAttr): host = '127.0.0.1' if IS_LINUX and host == '127.0.1.1': host = '127.0.0.1' + if self.is_bluestacks_air: + host = '127.0.0.1' logger.info(f'Connecting to local emulator, using host {host}') port = random_port(self.config.FORWARD_PORT_RANGE) # For AVD instance - if self.is_avd: + if self.is_avd or self.is_bluestacks_air: return host, port, "10.0.2.2", port return host, port, host, port