Adb¶
-
class
apkinjector.adb.
Adb
¶ A utility class for running adb commands.
-
static
get_architecture
() → Optional[apkinjector.arch.ARCH]¶ Get phone architecture as apkpatcher.arch.ARCH.
This function serves as a shorthand for
apkpatcher.utils.abi_to_arch(apkpatcher.adb.Adb.get_prop('ro.product.cpu.abi'))
.- Returns
apkpatcher.arch.ARCH if adb is installed and a device is connected. Otherwise, it returns None.
- Return type
Union[str, None]
-
static
get_prop
(prop: str) → Optional[str]¶ Calls
adb shell getprop {prop}
.- Parameters
prop (str) – Prop to retrieve
- Returns
Returns prop from device if adb is installed and a device is connected. Otherwise, it returns None.
- Return type
Union[str, None]
-
static
install
(path: str = None, progress_callback: Callable = None) → None¶ Install adb tools.
- Parameters
path (str, optional) – Path to existing adb executable. If not found, will use the system installed one or download it. Defaults to None.
progress_callback (callable, optional) – Callback to be called when install progress changes, defaults to None.
-
static
run
(command: str) → Optional[str]¶ Bare method to run adb commands.
- Parameters
command (str) – Command to be run.
- Returns
Output of the command if adb is installed and a device is connected. Otherwise, it returns None.
- Return type
Union[str, None]
-
static
shell
(command: str) → str¶ Run an adb shell command.
- Parameters
command (str) – Command to be ran.
- Returns
Output of the command if adb is installed and a device is connected. Otherwise, it returns None.
- Return type
str
-
static
wait_for_device
() → None¶ Waits for a device to be connected. If adb is not installed, it will skip without waiting.
-
static