fix: add launch parameters on waydroid

This commit is contained in:
2026-07-06 22:40:39 +08:00
parent dcb15deb4b
commit 643a66a0b9
4 changed files with 21 additions and 4 deletions
+7
View File
@@ -305,6 +305,13 @@ class Connection(ConnectionAttr):
return True
return False
@cached_property
@retry
def is_waydroid(self):
res = self.adb_getprop('ro.product.brand')
logger.attr('ro.product.brand', res)
return 'waydroid' in res.lower()
@cached_property
@retry
def nemud_app_keep_alive(self) -> str:
+4
View File
@@ -164,6 +164,10 @@ class ConnectionAttr:
def is_network_device(self):
return bool(re.match(r'\d+\.\d+\.\d+\.\d+:\d+', self.serial))
@cached_property
def is_local_network_device(self):
return bool(re.match(r'192\.168\.\d+\.\d+:\d+', self.serial))
@cached_property
def is_over_http(self):
return bool(re.match(r"^https?://", self.serial))
+5 -2
View File
@@ -303,8 +303,11 @@ class Adb(Connection):
logger.error(result)
raise PackageNotInstalled(package_name)
ret = self.adb_shell(['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}'])
cmd = ['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}']
if self.is_local_network_device and self.is_waydroid:
cmd += ['--windowingMode', '4']
ret = self.adb_shell(cmd)
# Invalid activity
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
# Error type 3
+5 -2
View File
@@ -288,8 +288,11 @@ class Uiautomator2(Connection):
raise
activity_name = info['mainActivity']
ret = self.u2.shell(['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}'])
cmd = ['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}']
if self.is_local_network_device and self.is_waydroid:
cmd += ['--windowingMode', '4']
ret = self.u2.shell(cmd)
# Invalid activity
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
# Error type 3