fix adb funcs
This commit is contained in:
parent
d0bc5ce68e
commit
a8287299a5
|
@ -141,8 +141,11 @@ class ADB:
|
||||||
|
|
||||||
# Parse and store applications in the dictionary
|
# Parse and store applications in the dictionary
|
||||||
for line in sp.stdout.decode('utf-8').splitlines():
|
for line in sp.stdout.decode('utf-8').splitlines():
|
||||||
|
try:
|
||||||
path, package = line.strip().split(':', 1)[1].rsplit('=', 1)
|
path, package = line.strip().split(':', 1)[1].rsplit('=', 1)
|
||||||
applications[package] = path
|
applications[package] = path
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
return applications
|
return applications
|
||||||
|
|
||||||
|
@ -160,6 +163,9 @@ class ADB:
|
||||||
sp = shell([*self.prompt, 'dumpsys', 'package', package])
|
sp = shell([*self.prompt, 'dumpsys', 'package', package])
|
||||||
lines = sp.stdout.decode('utf-8').splitlines()
|
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
|
# Look for main activity in package information
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if 'android.intent.action.MAIN' in line:
|
if 'android.intent.action.MAIN' in line:
|
||||||
|
|
Loading…
Reference in New Issue