{"id":378886,"date":"2024-06-14T15:00:51","date_gmt":"2024-06-14T15:00:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=378886"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=378886","title":{"rendered":"<span>\u0414\u0440\u043e\u0438\u0434\u044b \u0438 \u043f\u0438\u0442\u043e\u043d\u044b: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 ADB \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043f\u0440\u043e\u0449\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b, \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0431\u0435\u0441\u0441\u043e\u043d\u043d\u044b\u0445 \u043d\u043e\u0447\u0435\u0439, \u044f \u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435. \u041d\u0443 \u0432\u044b \u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2014 \u0438\u0445 \u0445\u043b\u0435\u0431\u043e\u043c \u043d\u0435 \u043a\u043e\u0440\u043c\u0438, \u0434\u0430\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e-\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0411\u0443\u0434\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u042f \u043c\u043d\u043e\u0433\u043e <a href=\"https:\/\/t.me\/+sIId9DrhbKBlNTBi\" rel=\"nofollow noopener noreferrer\">\u043f\u0438\u0448\u0443 \u043f\u0440\u043e \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0443\u044e <\/a> \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f\u0445, \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u043e\u0434\u043d\u0443 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u2014 Android Debug Bridge, ADB. \u042d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>Android<\/strong> \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0439\u0441\u044f \u0447\u0435\u043c \u0445\u043e\u0447\u0435\u0448\u044c. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0442\u0430\u043a \u043b\u0435\u043d\u044c \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u2026 \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 Python. \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 ADB \u0447\u0435\u0440\u0435\u0437 python.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Android, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0438\u043b\u0438 \u044e\u0437\u0435\u0440 \u2014 \u0442\u043e \u0432\u044b \u043f\u043e\u043f\u0430\u043b\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e Python.<\/p>\n<p>  <\/p>\n<p>Python \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u0438\u0447 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 Python 3.10 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f match-case.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">http_status = 404  match http_status:     case 400:         print(\"Bad Request\")     case 404:         print(\"Not Found\")     case 200:         print(\"Success\")     case _:         print('Other')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e Python \u2014 &#171;\u043a\u043e\u043b\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u044f\u0437\u044b\u043a&#187;, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438, \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0433\u0438\u043d\u0433\u0430 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">number: int = 10 fnum: float = 10.10 text: str = \"Hello\" is_normal: bool = True  # \u0418 \u0434\u0440\u0443\u0433\u0438\u0435, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043a\u0438, \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 Python. \u041e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044f\u0445 \u043b\u0438\u0441\u043f\u0430. \u0422\u0430\u043a, \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>filter<\/code>, <code>map<\/code> \u0438 <code>reduce<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u0437 \u043b\u0438\u0441\u043f\u0430 \u0431\u044b\u043b\u0438 \u0432\u0437\u044f\u0442\u044b \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u043e\u0432. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f (<code>itertools<\/code> \u0438 <code>functools<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Haskell.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e &#171;\u0434\u0437\u0435\u043d\u0443&#187; \u043f\u0438\u0442\u043e\u043d\u0430, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u044f\u0434\u0440\u043e \u044f\u0437\u044b\u043a\u0430 \u0432\u0441\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u043d \u0431\u044b\u043b \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u043c. \u041f\u0438\u0442\u043e\u043d \u0441\u0442\u0430\u043b \u0442\u0430\u043a\u0438\u043c \u0438\u0437-\u0437\u0430 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u044f\u0437\u044b\u043a\u0430 ABC \u2014 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0413\u0432\u0438\u0434\u043e \u0412\u0430\u043d \u0420\u043e\u0441\u0441\u0443\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u044f\u0434\u0440\u043e.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2014 \u0432 Python \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 C-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a (.so \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435, .dll \u0432 Windows) \u0432 \u043a\u043e\u0434 \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043e\u0434\u0443\u043b\u044f ctypes.<\/p>\n<p>  <\/p>\n<p>Python \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445 \u0438 \u041e\u0421. \u0414\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043a\u0430\u0436\u0443, <a href=\"https:\/\/wiki.osdev.org\/Porting_Python\" rel=\"nofollow noopener noreferrer\">\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u041e\u0421<\/a>!<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u0440\u0430\u043b \u044f \u0435\u0433\u043e \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0430 \u043d\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u043e\u0439, \u043a\u0430\u043a bash), \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c, \u0438 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043e\u043d \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<h1 id=\"adb-otladka-po-usb\">ADB, \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u043f\u043e USB<\/h1>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 &#171;\u043c\u043e\u0441\u0442 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 android&#187; \u2014 \u0442\u043e \u0435\u0441\u0442\u044c ADB.<\/p>\n<p>  <\/p>\n<p>ADB \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 Google \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Android. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u041e\u043d \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0440\u0435\u0448\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u0439 \u0440\u044f\u0434 \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/li>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 shell-\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434<\/li>\n<li>\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u0439, \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u0432\u0430\u0439\u043f\u043e\u0432 \u0438 \u0442\u0434<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/li>\n<li>\u0421\u043d\u0438\u043c\u043a\u0438 \u0438 \u0432\u0438\u0434\u0435\u043e \u0441 \u044d\u043a\u0440\u0430\u043d\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo apt install android-tools-adb # Ubuntu\/debian sudo pacman -S android-tools # Arch<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f ADB, \u043d\u0430\u0434\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043f\u043e USB.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/s7\/im\/kn\/s7imkn3hwqnvanqpmmkpfg8xdde.png\" alt=\"USB Debug\" data-src=\"https:\/\/habrastorage.org\/webt\/s7\/im\/kn\/s7imkn3hwqnvanqpmmkpfg8xdde.png\"\/><\/p>\n<p>  <\/p>\n<blockquote><p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>scrcpy<\/code> \u2014 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0434\u043b\u044f \u0448\u0430\u0440\u0438\u043d\u0433\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u0441 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043d\u0430 \u041f\u041a \u0447\u0435\u0440\u0435\u0437 ADB<\/p><\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u043f\u043e USB. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 USB-\u043f\u0440\u043e\u0432\u043e\u0434 \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>adb usb<\/code> \u0438 <code>adb devices<\/code>. \u0412\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0434\u0435\u0432\u0430\u0439\u0441\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443 \u0432\u0430\u0441 \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u0434\u0435\u0432\u0430\u0439\u0441. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<h1 id=\"osnovnye-komandy-adb\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b ADB<\/h1>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>adb reboot<\/code> \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/li>\n<li><code>adb reboot recovery<\/code> \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f (recovery)<\/li>\n<li><code>adb reboot bootloader<\/code> \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c fastboot.<\/li>\n<li><code>adb install &lt;APK><\/code> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 APK \u0444\u0430\u0439\u043b\u0430. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u043a\u043d\u043e \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043a\u043e\u043d \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442.<\/li>\n<li><code>adb install -t &lt;APK><\/code> \u2014 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li><code>adb install -r &lt;APK><\/code> \u2014 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><code>adb shell pm list packages<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/li>\n<li><code>adb uninstall com.example.example<\/code> \u2014 \u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0435\u0433\u043e Bundle ID.<\/li>\n<li><code>adb shell<\/code> \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0448\u0435\u043b\u043b, \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443<\/li>\n<li><code>adb shell screencap \/sdcard\/screenshot.png<\/code> \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430<\/li>\n<li><code>adb shell screenrecord --size 1280x720 --bit-rate 6000000 --time-limit 20 --verbose \/sdcard\/video.mp<\/code> \u2014 \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440, \u0431\u0438\u0442\u0440\u0435\u0439\u0442, \u043b\u0438\u043c\u0438\u0442 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445).<\/li>\n<li><code>adb shell dumpsys package com.app.example<\/code> \u2014 \u0432\u044b\u0432\u043e\u0434 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/li>\n<li><code>adb logcat<\/code> \u2014 \u0432\u044b\u0432\u043e\u0434 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432<\/li>\n<li><code>adb bugreport<\/code> \u2014 \u0434\u043e\u043a\u043b\u0430\u0434 \u043e \u0433\u0440\u0435\u0448\u043a\u0430\u0445. \u0421\u0431\u043e\u0440 \u043e\u0442\u0447\u0435\u0442\u0430 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<\/li>\n<li><code>adb shell dumpsys<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0441\u043b\u0443\u0436\u0431\u0430\u0445<\/li>\n<li><code>adb push &lt;local> &lt;remote><\/code> \u2014 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e<\/li>\n<li><code>adb pull &lt;remote> &lt;local><\/code> \u2014 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<\/li>\n<li><code>adb shell am start -a android.intent.action.VIEW 'https:\/\/nometa.xyz'<\/code> \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u0430\u0439\u0442\u0430<\/li>\n<li><code>adb shell input tap X Y<\/code> \u2014 \u0442\u0430\u043f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/li>\n<li><code>adb shell input swipe X1 Y1 X2 Y2 &lt;\u0414\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u043c\u0441><\/code> \u2014 \u0441\u0432\u0430\u0439\u043f.<\/li>\n<li><code>adb shell dumpsys<\/code> \u2014 \u0434\u0430\u043c\u043f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/li>\n<li><code>adb shell dumpsys battery<\/code> \u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0431\u0430\u0442\u0430\u0440\u0435\u0435.<\/li>\n<li><code>adb shell input text \"Hello, Habr!\"<\/code> \u2014 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"chto-pod-kapotom\">\u0427\u0442\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c?<\/h1>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>adb input tap\/swipe<\/code>? ADB \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c &#171;\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c&#187; adb-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c, \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0448\u0435\u043b\u043b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442, \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 Java-\u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0430 \u0443\u0436\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u0436\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u0438\u043b\u0438 \u0441\u0432\u0430\u0439\u043f. \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0442\u0430\u043f\u0430 \u0438 \u0441\u0432\u0430\u0439\u043f\u0430 \u0435\u0441\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u2014 <code>adb shell input touchscreen tap X Y<\/code> \u0438 <code>adb shell input touchscreen X1 Y1 X2 Y2<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u0430\u0439\u043f \u0432\u043d\u0438\u0437, \u0432\u0432\u0435\u0440\u0445 \u0438 \u0442\u0434 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>adb shell touchscreen motionevent DOWN\/MOVE\/UP X Y<\/code>.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u0430\u044f \u0438 \u043d\u0443\u0436\u043d\u0430\u044f, \u0432\u0435\u0434\u044c \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0437\u0430 \u0432\u0430\u0441.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 <code>adb shell input<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>adb shell input keyboard keyevent 3<\/code> \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043e\u043c\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u041a\u0435\u0439\u043a\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/developer.android.com\/reference\/android\/view\/keyevent#keycode_home\" rel=\"nofollow noopener noreferrer\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>  <\/p>\n<h1 id=\"kak-mozhno-rabotat-s-adb-cherez-python\">\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 ADB \u0447\u0435\u0440\u0435\u0437 python?<\/h1>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 subprocess, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 ppadb.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">python3 -m venv venv source venv\/bin\/activate<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0430\u0439\u043b \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import subprocess       # \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434  def get_devices(self) -> list:     \"\"\"     \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.      :return: \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432     \"\"\"     # \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 adb devices     command = subprocess.run(['adb', 'devices'], stdout=subprocess.PIPE,                             stderr=subprocess.PIPE, text=True)      # \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435 0, \u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c     if command.returncode != 0:         print(f'Error receiving devices: {command.stderr}')         return None      # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u043e\u0442 \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0438 \u0441\u043f\u043b\u0438\u0442\u0438\u043c \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c     result = command.stdout.strip().split('\\n')     # \u041e\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 1 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435     devices = result[1:]      # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0443\u0434\u0430\u043b\u044f\u044f \u043b\u0438\u0448\u043d\u0435\u0435     devices = [device.replace('\\tdevice', '') for device in devices]      # \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432     return devices  print(f'\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: {\" \".join(devices)}')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: da7045007d79<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u0441\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def reboot(reboot_type: str='plain') -> bool:     \"\"\"     \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430      :param reboot_type: \u0422\u0438\u043f \u0440\u0435\u0431\u0443\u0442\u0430, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e plain. \u0422\u0430\u043a\u0436\u0435: recovery, fastboot     :return: True \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, False \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435     \"\"\"     if reboot_type == 'plain':         command = ['adb', 'reboot']     elif reboot_type == 'recovery':         command = ['adb', 'reboot', 'recovery']     elif reboot_type == 'fastboot':         command = ['adb', 'reboot', 'fastboot']      result = subprocess.run(command,                              stdout=subprocess.PIPE,                             stderr=subprocess.PIPE, text=True)      if result.returncode != 0:         return False      return True<\/code><\/pre>\n<p>  <\/p>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043d\u0430 Python. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0448\u043b\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u2014 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u0434 \u043a\u043e\u0440\u043e\u0447\u0435, \u0438 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043d\u0435\u0441\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import subprocess from typing import Union  def execute(command: Union[list, str]) -> subprocess.CompletedProcess:     \"\"\"     \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 subprocess.      :param command: \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0438     :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess     \"\"\"     if isinstance(command, str):         command = command.split(' ')      result = subprocess.run(command,                      stdout=subprocess.PIPE,                     stderr=subprocess.PIPE, text=True)      if result.returncode != 0:         print(f'Failed execute command: {result.stderr}')      return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Keyevent, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u043e\u0442 Enum.<\/p>\n<p>  <\/p>\n<p>\u041e\u043d \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0448 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>adb shell input keyevent<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from enum import Enum  class Keyevent(Enum):     \"\"\"     \u0427\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448 (adb shell keyevent)      \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432:      DIGIT - \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438     CONTROL - \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u044b     WORD - \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0430     \"\"\"     DIGIT_0 = 7     DIGIT_1 = 8     DIGIT_2 = 9     DIGIT_3 = 10     DIGIT_4 = 11     DIGIT_5 = 12     DIGIT_6 = 13     DIGIT_7 = 14     DIGIT_8 = 15     DIGIT_9 = 16      CONTROL_BACK = 4     CONTROL_CALL = 5     CONTROL_CAMERA = 27     CONTROL_CHANNEL_DOWN = 167     CONTROL_CHANNEL_UP = 166     CONTROL_DPAD_CENTER = 23     CONTROL_DPAD_DOWN = 20     CONTROL_DPAD_LEFT = 21     CONTROL_DPAD_RIGHT = 22     CONTROL_DPAD_UP = 19     CONTROL_ENDCALL = 6     CONTROL_ENTER = 66     CONTROL_ESCAPE = 111     CONTROL_HEADSETHOOK = 79     CONTROL_HOME = 3     CONTROL_MENU = 82     CONTROL_MUTE = 91     CONTROL_NOTIFICATION = 83     CONTROL_POWER = 26     CONTROL_SEARCH = 84     CONTROL_SETTINGS = 176     CONTROL_VOLUME_DOWN = 25     CONTROL_VOLUME_UP = 24     CONTROL_VOLUME_MUTE = 164     CONTROL_ZOOM_IN = 168     CONTROL_ZOOM_OUT = 169     CONTROL_BRIGHTNESS_DOWN = 220     CONTROL_BRIGHTNESS_UP = 221     CONTROL_MEDIA_PREVIOUS = 89     CONTROL_MEDIA_NEXT = 87     CONTROL_MEDIA_PLAY_PAUSE = 85     CONTROL_MEDIA_STOP = 86     CONTROL_MEDIA_REWIND = 90     CONTROL_MEDIA_FAST_FORWARD = 88      WORD_A = 29     WORD_B = 30     WORD_C = 31     WORD_D = 32     WORD_E = 33     WORD_F = 34     WORD_G = 35     WORD_H = 36     WORD_I = 37     WORD_J = 38     WORD_K = 39     WORD_L = 40     WORD_M = 41     WORD_N = 42     WORD_O = 43     WORD_P = 44     WORD_Q = 45     WORD_R = 46     WORD_S = 47     WORD_T = 48     WORD_U = 49     WORD_V = 50     WORD_W = 51     WORD_X = 52     WORD_Y = 53     WORD_Z = 54<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u2014 Device.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class Device:     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 ADB      \u041a\u0430\u0436\u0434\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.     \"\"\"     def __init__(self, serial: str) -> None:         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430          :param serial: \u0421\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430         \"\"\"         self.serial: str = serial         self.shell_template: str = 'adb shell'      # \u0428\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430 \u0448\u0435\u043b\u043b-\u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439, \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 ADB:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class ADB:     \"\"\"     \u041a\u043b\u0430\u0441\u0441, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0443 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 ADB     \"\"\"     def __init__(self):         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430         \"\"\"         self.devices: list = []         execute(['adb', 'start-server'])      def get_devices(self) -> list:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.          :return: \u0421\u043f\u0438\u0441\u043e\u043a \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Device         \"\"\"         result = execute(['adb', 'devices'])          result = result.stdout.strip().split('\\n')         devices = result[1:]          devices = [Device(device.replace('\\tdevice', '')) for device in devices]          if not devices:             print('No devices attached')          return devices<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Device \u043c\u0435\u0442\u043e\u0434 shell, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 shell-\u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def shell(self, command: str) -> subprocess:         \"\"\"         \u0412\u044b\u0437\u043e\u0432 shell-\u043a\u043e\u043c\u0430\u043d\u0434\u044b.          \u0428\u0430\u0431\u043b\u043e\u043d: adb shell &lt;command>          :param command: \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430         :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         command = f'{self.shell_template} {command}'         command_list = command.split(' ')          result = execute(command_list)         print(f'Command {command} has been processed')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u043b\u0438\u0448\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u043e \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def input_key(self, keyevent: Keyevent) -> subprocess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448          :param keyevent: \u041d\u043e\u043c\u0435\u0440 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f         :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = self.shell(f'input keyevent {keyevent.value}')         print(f'Event of pressing {keyevent.value} ({keyevent}) key has been processed')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043c\u044b \u0432\u0438\u0434\u0435\u043c, \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f Keyevent. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e\u0442 Enum-\u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432\u043d\u0430\u0447\u0430\u043b\u0435. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043e\u043c\u043e\u0439, \u0447\u0438\u0441\u043b\u043e 3 (\u043d\u043e\u043c\u0435\u0440), \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u2014 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <code>Keyevent.CONTROL_HOME<\/code>. \u0421\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0439, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430<a href=\"https:\/\/uproger.com\/android-i-python-mobilnaya-razrabotka\/\" rel=\"nofollow noopener noreferrer\">.<\/a><\/p>\n<p>  <\/p>\n<p>\u0418 \u043a\u0430\u043a \u0440\u0430\u0437 \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043c\u044b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0439, \u0434\u043b\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u2014 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>adb shell input text<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def input_text(self, text: str) -> subprocess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430.          :param text: \u0422\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430         :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = self.shell(f'input text \"{text}\"')         print(f'Text input event processed: {text}')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 input&#8217;\u0430 \u2014 tap \u0438 swipe:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def input_tap(self, x: int, y: int) -> subprocess.CompletedProcess:         \"\"\"         \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b adb shell input tap x y          :param x: \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 X         :param y: \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = self.shell(f'input tap {x} {y}')         print(f'Action processed: tap {x} {y}')          return result      def input_swipe(self, x1: int, y1: int,                      x2: int, y2: int, duration: int) -> subprocess.CompletedProcess:         \"\"\"         \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b adb shell input swipe x1 y1 x2 y2 duration.          :param x1: \u041f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 X         :param y1: \u041f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y         :param x2: \u0412\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 X         :param y2: \u0412\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y         :param duration: \u0414\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u043c\u0441          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = self.shell(f'input swipe {x1} {y1} {x2} {y2} {duration}')         print(f'Action processed: swipe {x1} {y1} {x2} {y2} ({duration}ms)')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def _get_battery_status(self, status_code: int) -> str:         \"\"\"         \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0438\u0437 \u0441\u0442\u0430\u0442\u0443\u0441-\u043a\u043e\u0434\u0430          :param status_code: \u041a\u043e\u0434 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0431\u0430\u0442\u0430\u0440\u0435\u0438         :return: \u0427\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441         \"\"\"         match status_code:             case 1:                 status = 'Charing'             case 2:                 status = 'Discharging'             case 3:                 status = \"Not charging\"             case 4:                 status = \"Full\"          return status      def _get_battery_health(self, status_code: int) -> str:         \"\"\"         \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0438\u0437 \u0441\u0442\u0430\u0442\u0443\u0441-\u043a\u043e\u0434\u0430.          :param status_code: \u041a\u043e\u0434 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438         :return: \u0427\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f         \"\"\"         match status_code:             case 1:                 status = 'Good'             case 2:                 status = \"Overheat\"             case 3:                 status = 'Dead'             case 4:                 status = \"Over voltage\"             case 5:                 status = 'Unspecified failure'             case 6:                 status = \"Cold\"          return status      def get_battery_info(self) -> dict:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0431\u0430\u0442\u0430\u0440\u0435\u0435 \u0432 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435.          :return: \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0437\u0430\u0440\u044f\u0434\u0430, \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u0430\u0442\u0430\u0440\u0435\u0438         \"\"\"         result = self.shell('dumpsys battery')          for line in result.stdout.splitlines():             if \"level\" in line:                 level = int(line.split(':')[1].strip())             elif 'scale' in line:                 scale = int(line.split(':')[1].strip())             elif 'status' in line:                 status = self._get_battery_status(int(line.split(':')[1].strip()))             elif 'health' in line:                 health = self._get_battery_health(int(line.split(':')[1].strip()))             elif 'temperature' in line:                 temp = float(line.split(':')[1].strip()) \/ 10             elif 'technology' in line:                 technology = line.split(':')[1].strip()          return {             'level': level,             'scale': scale,             'status': status,             'health': health,             'temp': temp,             'technology': technology         }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u043a\u0442, \u0432 \u043a\u043e\u0434\u0435 \u0433\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u0430\u0442\u0430\u0440\u0435\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 USB, \u0442\u043e \u0432\u0430\u0448 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u043e\u043d \u0437\u0430\u0440\u044f\u0436\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u0434, \u0442\u043e \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0437\u0440\u044f\u0436\u0430\u0435\u0442\u0441\u044f (\u0442\u043e \u0435\u0441\u0442\u044c 2). \u0422\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0447\u0442\u043e \u0440\u0435\u0436\u0438\u043c \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u0447\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c USB \u043f\u043e\u0440\u0442.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u2014 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0431\u0430\u0442\u0430\u0440\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>adb shell getprop<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def _split_getprop(self, line: str) -> str:         \"\"\"         \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f get_system_info, \u043f\u0430\u0440\u0441\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0432\u044b\u0432\u043e\u0434\u0430         \u043a\u043e\u043c\u0430\u043d\u0434\u044b adb shell getprop.          :param line: \u0421\u0442\u0440\u043e\u043a\u0430 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430         :return: \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430         \"\"\"         return line.split(\"[\")[2].split(\"]\")[0]      def get_system_info(self) -> dict:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 adb shell getprop.          :return: \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435         \"\"\"         result = self.shell(\"getprop\")         other_info = dict()          for line in result.stdout.splitlines():             try:                 param_name = line.split(':')[0].replace('[', '').replace(']', '')                 other_info[param_name] = self._split_getprop(line)             except IndexError:                 continue          return other_info<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>adb shell pm list packages<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 Bundle ID \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def get_packages(self) -> list:         \"\"\"         \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 bundle id.          :return: \u0421\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432         \"\"\"         installed_packages = list()          result = self.shell('pm list packages')          for line in result.stdout.splitlines():             try:                 installed_packages.append(line.split(':')[-1])             except IndexError:                 continue          return installed_packages      def get_package_by_bundle(self, bundle_name: str) -> list:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u043e \u0435\u0433\u043e bundle id.          :param bundle_name: Bundle ID \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430         :return: \u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439         \"\"\"         result = self.shell('pm list packages')         matches = list()          for line in result.stdout.splitlines():             if bundle_name in line.split(':')[-1].split('.')[-1]:                 matches.append(line.split(':')[-1])          return matches<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import os  # ...     def install_apk(self, apk_path: str, test=False) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 adb install &lt;APK>.          :param apk_path: \u041f\u0443\u0442\u044c \u0434\u043e APK-\u0444\u0430\u0439\u043b\u0430         :param test: \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0436\u0438\u043c          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         apk_path = os.path.join(apk_path)          if not os.path.isfile(apk_path):             print(f'APK {apk_path} for installing is not exists')             return None          match test:             case True:                 result = execute(f'adb install {apk_path} -t')             case False:                 result = execute(f'adb install {apk_path} -t')          return result      def remove_apk(self, bundle_name: str) -> subprocess.CompletedProcess:         \"\"\"         \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u043e \u0435\u0433\u043e Bundle ID.          :param bundle_name: Bundle ID \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"          result = execute(f'adb uninstall {bundle_name}')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430 \u2014 logcat \u0438 bugreport:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def logcat(self, loglevel: str) -> str:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043b\u043e\u0433\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 adb logcat.          :param loglevel: \u0423\u0440\u043e\u0432\u0435\u0442 \u043b\u043e\u0433\u043e\u0432 (Verbose, Debug, Info, Warn, Error, Fatal, Silent)         :return: \u041b\u043e\u0433\u0438         \"\"\"         if loglevel not in ['V', 'D', 'I', 'W', 'E', \"F\", \"S\"]:             return f'Invalid log level {loglevel}'          result = execute(f\"adb logcat '*:{loglevel}\")          return result.stdout      def bugreport(self) -> str:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 adb bugreport.          :return: \u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445         \"\"\"         result = execute('adb bugreport')          return result.stdout<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0447\u0435\u0440\u0435\u0437 <code>adb shell start -a android.intent.action.&lt;\u0414\u0415\u0419\u0421\u0422\u0412\u0418\u0415><\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def input_action(self, action: str, metadata: dict) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.          :param action: \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (send, call, sms, email, app, shutdown).         :param metadata: \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u043c\u0435\u0442\u0430-\u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f send, call, sms, emaiil, app.         :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         pattern = 'am start -a android.intent.action.'          print(action, metadata)          if action == 'view':             # \u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438             pattern = f\"{pattern}VIEW '{metadata['URL']}'\"         elif action == 'call':             # \u0417\u0432\u043e\u043d\u043e\u043a             pattern = f'{pattern}DIAL \"{metadata[\"tel\"]}\"'         elif action == 'sms':             # \u0421\u041c\u0421             pattern = f'{pattern}SENDTO \"{metadata[\"tel\"]}\"'         elif action == 'email':             # \u041f\u0438\u0441\u044c\u043c\u043e \u043d\u0430 \u0435\u043c\u0430\u0439\u043b             pattern = f'{pattern}SEND --es subject \"{metadata[\"subject\"]}\"' \\                     f' --es text {metadata[\"text\"]}\" --es email \"{metadata[\"email\"]}\"'         elif action == 'app':             # \u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435             pattern = f'{pattern}MAIN {metadata[\"app\"]}\/.MainActivity'         elif action == 'shutdown':             # \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430             pattern = f'{pattern}REQUEST_SHUTDOWN'         else:             print(f'Unsupported action: {action}')          result = self.shell(pattern)          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u043d\u0430 \u0444\u0438\u043d\u0438\u0448\u043d\u043e\u0439 \u043f\u0440\u044f\u043c\u043e\u0439! \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043d\u0435\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442\u0430 \u0438 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430, \u0430 \u043f\u043e\u0441\u043b\u0435 \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u043e\u043c \u0438 \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def screenshot(self, filepath: str) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430.          :param filepath: \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f         :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = self.shell(f'screencap {filepath}')          return result      def screencast(self, filepath: str, size: str=None, bitrate: int=6000000,                 time_limit: int=20) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442\u0430.          :param filepath: \u041f\u0443\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f         :param size: \u0420\u0430\u0437\u043c\u0435\u0440 \u0432\u0438\u0434\u0435\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 1280x720)         :param bitrate: \u0411\u0438\u0442\u0440\u0435\u0439\u0442         :param time_limit: \u0412\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445)          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         command = f'screenrecord --bit-rate {bitrate} --time-limit {time_limit}'          if size is not None:             command += f' --size {size}'          result = self.shell(f'{command} --verbose {filepath}')          return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0442\u043e \u0444\u0438\u043d\u0430\u043b \u2014 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def push_file(self, local_path: str,                      remote_path: str) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d.          :param local_path: \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d         :param remote_path: \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         local_path = os.path.join(local_path)          if not os.path.isfile(local_path):             print(f'Local file {local_path} is not exists')             return None          result = execute(f'adb push {local_path} {remote_path}')          print(result.stdout.strip())         return result      def pull_file(self, remote_path: str,                      local_path: str) -> subprocess.CompletedProcess:         \"\"\"         \u041c\u0435\u0442\u043e\u0434, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.          :param remote_path: \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438         :param local_path: \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438          :return: \u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 subprocess         \"\"\"         result = execute(f'adb pull {remote_path} {local_path}')          print(result.stdout.strip())         return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u0442 \u043c\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432, \u0438\u043b\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 (\u043f\u0440\u0430\u0432\u0434\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430)<a href=\"https:\/\/uproger.com\/android-i-python-mobilnaya-razrabotka\/\" rel=\"nofollow noopener noreferrer\">.<\/a><\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0430 \u043c\u044b \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439, \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/Swind\/pure-python-adb\" rel=\"nofollow noopener noreferrer\">ppadb<\/a>.<\/p>\n<p>  <\/p>\n<h1 id=\"pure-python-adb\">Pure Python ADB<\/h1>\n<p>  <\/p>\n<p>\u0410\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430 <code>ppadb<\/code> \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a Pure Python ADB.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/hd\/xr\/-f\/hdxr-fnary2wp50xksljlzs7ba4.png\" data-src=\"https:\/\/habrastorage.org\/webt\/hd\/xr\/-f\/hdxr-fnary2wp50xksljlzs7ba4.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: <a href=\"https:\/\/github.com\/Swind\/pure-python-adb\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">pip3 install pure-python-adb<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as ADBClient  client = ADBClient() devices = client.devices()  for device in devices:     print(f'\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e: {device.serial}')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0434\u0435\u0432\u0430\u0439\u0441\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043b\u0438 \u043f\u0430\u043a\u0435\u0442, \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as AdbClient  apk_path = \"example.apk\"  client = AdbClient(host=\"127.0.0.1\", port=5037) devices = client.devices()  for device in devices:     device.install(apk_path)  for device in devices:     print(device.is_installed(\"example.package\"))  for device in devices:     device.uninstall(\"example.package\")<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0432\u044b\u0437\u043e\u0432 \u0448\u0435\u043b\u043b-\u043a\u043e\u043c\u0430\u043d\u0434?<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as AdbClient  client = AdbClient(host=\"127.0.0.1\", port=5037) devices = client.devices()  for device in devices:     device.shell('echo Hello, Habr!')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as AdbClient  client = AdbClient(host=\"127.0.0.1\", port=5037) device = client.device(\"emulator-5554\") result = device.screencap()  with open(\"screen.png\", \"wb\") as fp:     fp.write(result)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as AdbClient client = AdbClient(host=\"127.0.0.1\", port=5037) device = client.device(\"emulator-5554\")  device.push(\"example.apk\", \"\/sdcard\/example.apk\")<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ppadb.client import Client as AdbClient client = AdbClient(host=\"127.0.0.1\", port=5037) device = client.device(\"emulator-5554\")  device.shell(\"screencap -p \/sdcard\/screen.png\") device.pull(\"\/sdcard\/screen.png\", \"screen.png\")<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 ppadb \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import asyncio import aiofiles from ppadb.client_async import ClientAsync as AdbClient  async def _save_screenshot(device):     result = await device.screencap()     file_name = f\"{device.serial}.png\"     async with aiofiles.open(f\"{file_name}\", mode='wb') as f:         await f.write(result)      return file_name  async def main():     client = AdbClient(host=\"127.0.0.1\", port=5037)     devices = await client.devices()     for device in devices:         print(device.serial)      result = await asyncio.gather(*[_save_screenshot(device) for device in devices])     print(result)  asyncio.run(main())<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 adb, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c python \u043a\u0430\u043a \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430. \u041e\u0434\u0438\u043d \u0440\u0430\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u0432, \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0435\u0441\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u043b\u044e\u0431\u0438\u0442\u0435 Android, <a href=\"https:\/\/t.me\/+sIId9DrhbKBlNTBi\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u0430\u043d\u0430\u043b\u0435 <\/a>\u044f \u0441\u043e\u0431\u0440\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0430\u0439\u0434\u043e\u0432, \u0443\u0440\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. <\/p>\n<p>  <\/p>\n<h2 id=\"istochniki-informacii\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/dev.to\/plotegor\/adb-fastboot-3mgf\" rel=\"nofollow noopener noreferrer\">dev.to\/adb fastboot commands<\/a><\/li>\n<li><a href=\"https:\/\/t.me\/+pQAI9p2U6DBmM2Iy\" rel=\"nofollow noopener noreferrer\">Python <\/a>.<\/li>\n<li><a href=\"https:\/\/github.com\/Swind\/pure-python-adb\" rel=\"nofollow noopener noreferrer\">github\/ppadb repository<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/821781\/\"> https:\/\/habr.com\/ru\/articles\/821781\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b, \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0431\u0435\u0441\u0441\u043e\u043d\u043d\u044b\u0445 \u043d\u043e\u0447\u0435\u0439, \u044f \u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435. \u041d\u0443 \u0432\u044b \u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2014 \u0438\u0445 \u0445\u043b\u0435\u0431\u043e\u043c \u043d\u0435 \u043a\u043e\u0440\u043c\u0438, \u0434\u0430\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e-\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0411\u0443\u0434\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u042f \u043c\u043d\u043e\u0433\u043e <a href=\"https:\/\/t.me\/+sIId9DrhbKBlNTBi\" rel=\"nofollow noopener noreferrer\">\u043f\u0438\u0448\u0443 \u043f\u0440\u043e \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0443\u044e <\/a> \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f\u0445, \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u043e\u0434\u043d\u0443 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u2014 Android Debug Bridge, ADB. \u042d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>Android<\/strong> \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0439\u0441\u044f \u0447\u0435\u043c \u0445\u043e\u0447\u0435\u0448\u044c. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0442\u0430\u043a \u043b\u0435\u043d\u044c \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u2026 \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 Python. \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 ADB \u0447\u0435\u0440\u0435\u0437 python.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Android, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0438\u043b\u0438 \u044e\u0437\u0435\u0440 \u2014 \u0442\u043e \u0432\u044b \u043f\u043e\u043f\u0430\u043b\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-378886","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=378886"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378886\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=378886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=378886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=378886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}