Chore: [ALAS] Cache prop nemud.app_keep_alive

This commit is contained in:
LmeSzinc 2024-03-28 18:57:28 +08:00
parent cef99b81c5
commit a553d4d7eb
2 changed files with 13 additions and 3 deletions

View File

@ -273,15 +273,20 @@ class Connection(ConnectionAttr):
return True return True
return False return False
@cached_property
def nemud_app_keep_alive(self) -> str:
res = self.adb_getprop('nemud.app_keep_alive')
return res
@retry @retry
def check_mumu_app_keep_alive(self): def check_mumu_app_keep_alive(self):
if not self.is_mumu_family: if not self.is_mumu_family:
return False return False
res = self.adb_getprop('nemud.app_keep_alive') res = self.nemud_app_keep_alive
logger.attr('nemud.app_keep_alive', res) logger.attr('nemud.app_keep_alive', res)
if res == '': if res == '':
# Empry property, might not be a mumu emulator or might be an old mumu # Empty property, probably MuMu6 or MuMu12 version < 3.5.6
return True return True
elif res == 'false': elif res == 'false':
# Disabled # Disabled

View File

@ -127,7 +127,12 @@ class ConnectionAttr:
def is_mumu_family(self): def is_mumu_family(self):
# 127.0.0.1:7555 # 127.0.0.1:7555
# 127.0.0.1:16384 + 32*n # 127.0.0.1:16384 + 32*n
return self.serial == '127.0.0.1:7555' or self.serial.startswith('127.0.0.1:16') return self.serial == '127.0.0.1:7555' or self.is_mumu12_family
@cached_property
def is_mumu12_family(self):
# 127.0.0.1:16384 + 32*n
return len(self.serial) == 15 and self.serial.startswith('127.0.0.1:16')
@cached_property @cached_property
def is_emulator(self): def is_emulator(self):