From a8287299a585d0ac95e101d472e91868ce013d24 Mon Sep 17 00:00:00 2001 From: hyugogirubato <65763543+hyugogirubato@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:27:11 +0100 Subject: [PATCH] fix adb funcs --- keydive/adb.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/keydive/adb.py b/keydive/adb.py index a6915a8..fb0c4fc 100644 --- a/keydive/adb.py +++ b/keydive/adb.py @@ -141,8 +141,11 @@ class ADB: # Parse and store applications in the dictionary for line in sp.stdout.decode('utf-8').splitlines(): - path, package = line.strip().split(':', 1)[1].rsplit('=', 1) - applications[package] = path + 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: