Lines Matching +full:- +full:- +full:quiet
2 # Use of this source code is governed by a BSD-style license that can be
24 def _find_adb_bin(platform: Platform) -> pth.AnyPath:
27 macos=["adb", "~/Library/Android/sdk/platform-tools/adb"],
29 win=["adb.exe", "Android/sdk/platform-tools/adb.exe"])
39 adb_bin: Optional[pth.AnyPath] = None) -> Dict[str, Dict[str, str]]:
41 output = platform.sh_stdout(adb_bin, "devices", "-l")
50 def _parse_adb_device_info(value: str) -> Dict[str, str]:
65 adb_bin: Optional[pth.AnyPath] = None) -> None:
79 device_identifier: Optional[str] = None) -> Tuple[str, Dict[str, str]]:
108 def __str__(self) -> str:
114 def has_root(self) -> bool:
117 def path(self, path: pth.AnyPathLike) -> pth.AnyPath:
121 def serial_id(self) -> str:
125 def build_version(self) -> int:
129 def device_info(self) -> Dict[str, str]:
134 bufsize=-1,
140 quiet: bool = False) -> subprocess.Popen:
143 if not quiet:
145 adb_cmd: ListCmdArgs = [self._adb_bin, "-s", self._serial_id, "shell"]
158 quiet: bool = False,
160 use_serial_id: bool = True) -> subprocess.CompletedProcess:
164 adb_cmd = [self._adb_bin, "-s", self._serial_id]
175 quiet=quiet,
180 quiet: bool = False,
182 encoding: str = "utf-8",
184 check: bool = True) -> str:
187 quiet=quiet,
195 quiet: bool = False,
198 check: bool = True) -> bytes:
201 adb_cmd = [self._adb_bin, "-s", self._serial_id]
206 *adb_cmd, quiet=quiet, check=check, stdin=stdin)
210 quiet: bool = False,
211 encoding: str = "utf-8",
214 check: bool = True) -> str:
216 *args, quiet=quiet, stdin=stdin, env=env, check=check)
221 quiet: bool = False,
224 check: bool = True) -> bytes:
225 # -e: choose escape character, or "none"; default '~'
226 # -n: don't read from stdin
227 # -T: disable pty allocation
228 # -t: allocate a pty if on a tty (-tt: force pty allocation)
229 # -x: disable remote exit codes and stdout/stderr separation
235 "shell", *str_args, stdin=stdin, quiet=quiet, check=check)
245 quiet: bool = False,
246 check: bool = True) -> subprocess.CompletedProcess:
257 quiet=quiet,
260 def start_server(self) -> None:
261 self._adb_stdout("start-server", use_serial_id=False)
263 def stop_server(self) -> None:
266 def kill_server(self) -> None:
267 self._adb_stdout("kill-server", use_serial_id=False)
269 def devices(self) -> Dict[str, Dict[str, str]]:
272 def forward(self, local: int, remote: int, protocol: str = "tcp") -> int:
277 def forward_remove(self, local: int, protocol: str = "tcp") -> None:
278 self._adb("forward", "--remove", f"{protocol}:{local}")
280 def reverse(self, remote: int, local: int, protocol: str = "tcp") -> int:
285 def reverse_remove(self, remote: int, protocol: str = "tcp") -> None:
286 self._adb("reverse", "--remove", f"{protocol}:{remote}")
289 local_dest_path: pth.LocalPath) -> None:
293 device_dest_path: pth.AnyPath) -> None:
298 quiet: bool = False,
299 encoding: str = "utf-8") -> str:
301 return self.shell_stdout(*cmd, quiet=quiet, encoding=encoding)
305 quiet: bool = False,
306 encoding: str = "utf-8") -> str:
308 return self.shell_stdout(*cmd, quiet=quiet, encoding=encoding)
312 quiet: bool = False,
313 encoding: str = "utf-8") -> str:
315 return self.shell_stdout(*cmd, quiet=quiet, encoding=encoding).strip()
317 def services(self, quiet: bool = False, encoding: str = "utf-8") -> List[str]:
319 self.cmd("-l", quiet=quiet, encoding=encoding).strip().splitlines())
324 def packages(self, quiet: bool = False, encoding: str = "utf-8") -> List[str]:
327 "package", "list", "packages", quiet=quiet,
333 def force_stop(self, package_name: str) -> None:
336 self.shell("am", "force-stop", package_name)
338 def force_clear(self, package_name: str) -> None:
343 user = self.cmd("user", "get-main-user").strip()
344 cmd.extend(["--user", user])
351 modules: Optional[str] = None) -> None:
359 allow_downgrade: bool = False) -> None:
364 args.append("-d")
371 modules: Optional[str] = None) -> None:
376 "install-apks",
377 f"--apks={apks}",
378 f"--device-id={self._serial_id}",
381 cmd.append("--allow-downgrade")
383 cmd.append(f"--modules={modules}")
386 def uninstall(self, package_name: str, missing_ok: bool = False) -> None:
391 except Exception as e: # pylint: disable=broad-except
397 def grant_notification_permissions(self, package_name: str) -> None:
400 ….android.com/develop/ui/views/notifications/notification-permission # pylint: disable=line-too-lo…
406 user = self.cmd("user", "get-main-user").strip()
407 cmd.extend(["--user", user])
417 adb: Optional[Adb] = None) -> None:
426 def is_android(self) -> bool:
430 def name(self) -> str:
434 def version(self) -> str: #pylint: disable=invalid-overridden-method
438 def device(self) -> str: #pylint: disable=invalid-overridden-method
446 def cpu(self) -> str: #pylint: disable=invalid-overridden-method
455 def adb(self) -> Adb:
459 "arm64-v8a": MachineArch.ARM_64,
460 "armeabi-v7a": MachineArch.ARM_32,
466 def machine(self) -> MachineArch: #pylint: disable=invalid-overridden-method
473 def app_path_to_package(self, app_path: pth.AnyPathLike) -> str:
483 def search_binary(self, app_or_bin: pth.AnyPathLike) -> Optional[pth.AnyPath]:
493 def home(self) -> pth.AnyPath:
494 raise RuntimeError("Cannot access home dir on (non-rooted) android device")
498 def app_version(self, app_or_bin: pth.AnyPathLike) -> str:
499 # adb shell dumpsys package com.chrome.canary | grep versionName -C2
510 recursive: bool = False) -> List[Dict[str, Any]]:
514 def foreground_process(self) -> Optional[Dict[str, Any]]:
519 def get_relative_cpu_speed(self) -> float:
523 def python_details(self) -> JsonDict:
527 def os_details(self) -> JsonDict:
531 def check_autobrightness(self) -> bool:
537 r"mLatestFloatBrightness=(?P<brightness>[0-9]+\.[0-9]+)")
539 def get_main_display_brightness(self) -> int:
547 def default_tmp_dir(self) -> pth.AnyPath:
558 quiet: bool = False,
559 check: bool = False) -> subprocess.CompletedProcess:
568 quiet=quiet,
574 quiet: bool = False,
577 check: bool = True) -> bytes:
581 *args, stdin=stdin, env=env, quiet=quiet, check=check)
585 bufsize=-1,
591 quiet: bool = False) -> subprocess.Popen:
600 quiet=quiet)
602 def port_forward(self, local_port: int, remote_port: int) -> int:
605 def stop_port_forward(self, local_port: int) -> None:
608 def reverse_port_forward(self, remote_port: int, local_port: int) -> int:
611 def stop_reverse_port_forward(self, remote_port: int) -> None:
615 to_path: pth.LocalPath) -> pth.LocalPath:
624 def push(self, from_path: pth.LocalPath, to_path: pth.AnyPath) -> pth.AnyPath:
630 attrs: Optional[List[str]] = None) -> List[Dict[str, Any]]:
631 lines = self.sh_stdout("ps", "-A", "-o", "PID,NAME").splitlines()
642 def cpu_details(self) -> Dict[str, Any]:
661 def _getprop_system_details(self) -> Dict[str, Any]:
671 def system_details(self) -> Dict[str, Any]:
677 "machine": self.sh_stdout("uname", "-m").split()[0],
679 "system": self.sh_stdout("uname", "-s").split()[0],
680 "release": self.sh_stdout("uname", "-r").split()[0],
681 "version": self.sh_stdout("uname", "-v").split()[0],
693 def screenshot(self, result_path: pth.AnyPath) -> None:
694 self.sh("screencap", "-p", result_path)