def get_api_level(): """Return device's API level.""" try: return int(adb.get_property('ro.build.version.sdk')) except ValueError: logs.log_error('Failed to fetch API level.') return -1
def get_build_version(): """Return the build version of the system as a character. K = Kitkat, L = Lollipop, M = Marshmellow, A = Master. """ build_version = adb.get_property('ro.build.id') if not build_version or not re.match('^[A-Z]', build_version): return None return build_version[0]
def get_build_version(): """Return the build version of the system as a character. K = Kitkat, L = Lollipop, M = Marshmellow, MASTER = Master. """ build_version = adb.get_property('ro.build.id') if not build_version: return None if build_version == 'MASTER': return build_version match = re.match('^([A-Z])', build_version) if not match: return None return match.group(1)
def get_screen_density(): """Return screen density.""" output = adb.get_property('ro.sf.lcd_density') if not output or not output.isdigit(): return None output = int(output) if output == 120: return 'ldpi' elif output == 160: return 'mdpi' elif output == 240: return 'hdpi' elif output == 320: return 'xhdpi' elif output == 480: return 'xxhdpi' elif output == 560: return 'xxhdpi' elif output == 640: return 'xxxhdpi' logs.log_error('Could not determine the density of the device.') return None
def get_security_patch_level(): """Return the security patch level reported by the device.""" return adb.get_property('ro.build.version.security_patch')
def get_product_brand(): """Return product's brand.""" return adb.get_property('ro.product.brand')
def get_cpu_arch(): """Return cpu architecture.""" return adb.get_property('ro.product.cpu.abi')
def get_build_type(): """Return build type.""" return adb.get_property('ro.build.type')
def get_build_flavor(): """Return the build flavor.""" return adb.get_property('ro.build.flavor')
def get_build_fingerprint(): """Return build's fingerprint.""" return adb.get_property('ro.build.fingerprint')