mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: [ALAS] Launch parameters on waydroid
(cherry picked from commit 886736de45ceac0f23250c9aa27d1cb516f0311b)
This commit is contained in:
parent
1f98932bc8
commit
e89c8e7013
@ -307,6 +307,13 @@ class Connection(ConnectionAttr):
|
|||||||
return True
|
return True
|
||||||
return False
|
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
|
@cached_property
|
||||||
@retry
|
@retry
|
||||||
def nemud_app_keep_alive(self) -> str:
|
def nemud_app_keep_alive(self) -> str:
|
||||||
|
@ -163,6 +163,10 @@ class ConnectionAttr:
|
|||||||
def is_network_device(self):
|
def is_network_device(self):
|
||||||
return bool(re.match(r'\d+\.\d+\.\d+\.\d+:\d+', self.serial))
|
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
|
@cached_property
|
||||||
def is_over_http(self):
|
def is_over_http(self):
|
||||||
return bool(re.match(r"^https?://", self.serial))
|
return bool(re.match(r"^https?://", self.serial))
|
||||||
|
@ -303,8 +303,11 @@ class Adb(Connection):
|
|||||||
logger.error(result)
|
logger.error(result)
|
||||||
raise PackageNotInstalled(package_name)
|
raise PackageNotInstalled(package_name)
|
||||||
|
|
||||||
ret = self.adb_shell(['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
|
cmd = ['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
|
||||||
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}'])
|
'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
|
# Invalid activity
|
||||||
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
|
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
|
||||||
# Error type 3
|
# Error type 3
|
||||||
|
@ -288,8 +288,11 @@ class Uiautomator2(Connection):
|
|||||||
raise
|
raise
|
||||||
activity_name = info['mainActivity']
|
activity_name = info['mainActivity']
|
||||||
|
|
||||||
ret = self.u2.shell(['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
|
cmd = ['am', 'start', '-a', 'android.intent.action.MAIN', '-c',
|
||||||
'android.intent.category.LAUNCHER', '-n', f'{package_name}/{activity_name}'])
|
'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
|
# Invalid activity
|
||||||
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
|
# Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=... }
|
||||||
# Error type 3
|
# Error type 3
|
||||||
|
Loading…
Reference in New Issue
Block a user