def is_storage_hardware_backed(serial=None): """ description: check if developer options is enabled usage: ui_utils.is_developer_options_enabled() tags: ui, settings, developer, android """ if serial: uidevice = uiandroid.UIDevice(serial=serial) else: uidevice = uiandroid.UIDevice() ui_steps.open_security_settings(serial=serial)() if uidevice(scrollable=True).exists: result = uidevice(scrollable=True).scroll.to(text="Hardware-backed") else: result = uidevice(text="Hardware-backed").exists uidevice.press.home() return result
def is_dut_encrypted(serial=None): """ description: check if dut is encrypted usage: ui_utils.is_dut_encrypted() tags: ui, settings, security, encrypt, android """ if serial: uidevice = uiandroid.UIDevice(serial=serial) else: uidevice = uiandroid.UIDevice() ui_steps.open_security_settings(serial=serial)() if uidevice(scrollable=True).exists: result = uidevice(scrollable=True).scroll.to(text="Encrypted") else: result = uidevice(text="Encrypted").exists uidevice.press.home() return result
command = "adb shell cat /fstab." + platform_name + " | grep forceencrypt" result = False r = os.popen(command) info = r.readlines() for line in info: line = line.strip("\r\n") line = line.split() for l in line: if "noatime,nosuid,nodev,discard,noauto_da_alloc,errors=panic" in l: result = True if not result: raise Exception("The test result did not achieve the desired results") command = "adb shell mount | grep /data | grep /dev/block/dm" result = False r = os.popen(command) info = r.readlines() for line in info: line = line.strip("\r\n") line = line.split() for l in line: if "rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,errors=panic,data=ordered" in l: result = True if not result: raise Exception("The test result did not achieve the desired results") security_steps.reboot_system(serial=serial)() ui_steps.open_security_settings(serial=serial)() security_steps.disk_encryption_flag_check(serial=serial, platform_name=platform_name)() ##### test end #####