diff --git a/GramAddict/core/utils.py b/GramAddict/core/utils.py index b9665e8f..475c0fcf 100644 --- a/GramAddict/core/utils.py +++ b/GramAddict/core/utils.py @@ -428,16 +428,23 @@ def print_telegram_reports( def kill_atx_agent(device): _restore_keyboard(device) logger.info("Kill atx agent.") - cmd: str = f"adb{'' if configs.device_id is None else f' -s {configs.device_id}'} shell pkill atx-agent" + cmd: str = ( + f"adb{'' if configs.device_id is None else f' -s {configs.device_id}'} shell pkill atx-agent" + ) subprocess.run(cmd, stdout=PIPE, stderr=PIPE, shell=True, encoding="utf8") + def restart_atx_agent(device): kill_atx_agent(device) logger.info("Restarting atx agent.") - cmd: str = f"adb{'' if configs.device_id is None else f' -s {configs.device_id}'} shell /data/local/tmp/atx-agent server -d" + cmd: str = ( + f"adb{'' if configs.device_id is None else f' -s {configs.device_id}'} shell /data/local/tmp/atx-agent server -d" + ) try: - result = subprocess.run(cmd, stdout=PIPE, stderr=PIPE, shell=True, encoding="utf8", check=True) + result = subprocess.run( + cmd, stdout=PIPE, stderr=PIPE, shell=True, encoding="utf8", check=True + ) if result.returncode != 0: logger.error(f"Failed to restart atx-agent: {result.stderr}") else: @@ -445,6 +452,7 @@ def restart_atx_agent(device): except subprocess.CalledProcessError as e: logger.error(f"Error occurred while restarting atx-agent: {e}") + def _restore_keyboard(device): logger.debug("Back to default keyboard!") device.deviceV2.set_fastinput_ime(False)