From ecfbbf4a920fedad6e0ea31cce63ec69c6981f25 Mon Sep 17 00:00:00 2001 From: Jiajun Xie Date: Sat, 11 Apr 2026 13:22:16 +0800 Subject: [PATCH] fix: Android 13+ compatibility for ADB Keyboard check - Fallback to check package installation when ime list fails due to permission restrictions (SecurityException on Android 13+) --- main.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8cdc34b2b..d0f357916 100755 --- a/main.py +++ b/main.py @@ -203,7 +203,31 @@ def check_system_requirements( ) ime_list = result.stdout.strip() - if "com.android.adbkeyboard/.AdbIME" in ime_list: + # Check if permission denied (Android 13+) + if "SecurityException" in result.stderr or "Permission" in result.stderr: + # Fallback: check if package is installed + pkg_result = subprocess.run( + [ + "adb", + "shell", + "pm", + "list", + "packages", + "com.android.adbkeyboard", + ], + capture_output=True, + text=True, + timeout=10, + ) + if "com.android.adbkeyboard" in pkg_result.stdout: + print( + "✅ OK (package installed, please ensure enabled in settings)" + ) + else: + print("❌ FAILED") + print(" Error: ADB Keyboard is not installed on the device.") + all_passed = False + elif "com.android.adbkeyboard/.AdbIME" in ime_list: print("✅ OK") else: print("❌ FAILED")