Skip to main content

Sendevent - Android with Cython

Project description

Solution for UiAutomator's "Could not detect idle state" Cpulimit/Cython

pip install cythonuiautomatorstruct

Tested against Windows 10 / Python 3.11 / Anaconda / ADB / Bluestacks 5

Important!

The module will be compiled when you import it for the first time. Cython and a C++ compiler must be installed!

from cythonuiautomatorstruct import yield_uiautomator_dump, pretty_print_struct_array

import shutil

adb_path = shutil.which("adb")
device_serial = "127.0.0.1:5560"
for r in yield_uiautomator_dump(
    shell_exe=[adb_path, "-s", device_serial, "shell"],
    appname="com.kiwibrowser.browser",
    pid=-1,
    cpu_limit=10,
    include_children=True,
    lazy=True,
    dump_timeout=10,
    nice_level="-20", # max priority for uiautomator 
    outfile="/sdcard/window_dump.xml",
    use_cpulimit=True,
    run_as_shell=True,
    debug=True,
    su_prefix_for_input="su -c '",
    su_sufix_for_input="'",
    cpulimit_path="/data/data/com.termux/files/usr/bin/cpulimit",  # https://github.com/opsengine/cpulimit, limits the cpu usage of the target process 
    su_prefix_for_cpulimit="su -c '",
    su_suffix_for_cpulimit="'",
):
    pretty_print_struct_array(r)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cythonuiautomatorstruct-0.10.tar.gz (28.9 kB view hashes)

Uploaded Source

Built Distribution

cythonuiautomatorstruct-0.10-py3-none-any.whl (30.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page