fix adb funcs

This commit is contained in:
hyugogirubato 2024-11-01 19:27:11 +01:00
parent d0bc5ce68e
commit a8287299a5
1 changed files with 8 additions and 2 deletions

View File

@ -141,8 +141,11 @@ class ADB:
# Parse and store applications in the dictionary
for line in sp.stdout.decode('utf-8').splitlines():
try:
path, package = line.strip().split(':', 1)[1].rsplit('=', 1)
applications[package] = path
except Exception as e:
pass
return applications
@ -160,6 +163,9 @@ class ADB:
sp = shell([*self.prompt, 'dumpsys', 'package', package])
lines = sp.stdout.decode('utf-8').splitlines()
# Remove empty lines to ensure backwards compatibility
lines = [l.strip() for l in lines if l.strip()]
# Look for main activity in package information
for i, line in enumerate(lines):
if 'android.intent.action.MAIN' in line: