INNER CODE UNIT · Python
get_device_property
cvet/fonline · BuildTools/android_device.py:69
def get_device_property(adb_path: str, endpoint: str, prop_name: str) -> str:
return run_capture([adb_path, '-s', endpoint, 'shell', 'getprop', prop_name], check=False).strip()
def describe_device(adb_path: str, endpoint: str) -> str:
manufacturer = get_device_property(adb_path, endpoint, 'ro.product.manufacturer')
model = get_device_property(adb_path, endpoint, 'ro.product.model')
parts = [part for part in [manufacturer, model] if part]
if parts:
return ' '.join(parts)
return endpoint
def log_install_failed_user_restricted(adb_path: str, endpoint: str) -> None:
device_name = describe_device(adb_path, endpoint)
log(f'Install blocked by device policy on {device_name}')
print('The APK push reached the device, but Android canceled the installation on the device side.', flush=True)
print('What to do on the device:', flush=True)