from testlib.scripts.android.adb import adb_steps from testlib.scripts.telephony import telephony_steps from testlib.scripts.android.ui import ui_steps from testlib.base.base_utils import get_args import sys ##### initialization ##### globals().update(vars(get_args(sys.argv))) args = {} for entry in script_args: key, val = entry.split("=") args[key] = val # mandatory params sim_pin = args["sim_pin"] adb_steps.wake_up_device(serial = serial)() adb_steps.menu_to_unlock(serial = serial)() ui_steps.close_all_app_from_recent(serial = serial)() telephony_steps.set_sim_pin(serial = serial, state = "ON", pin = sim_pin)() ui_steps.close_all_app_from_recent(serial = serial)() telephony_steps.set_sim_pin(serial = serial, state = "OFF", pin = sim_pin)() ui_steps.press_home(serial = serial)()
print "[BLOCKED] A number to send SMS was not provided!!!" sys.exit(0) if "iterations" in args: iterations = args["iterations"] else: iterations = 1 if "sms_test_content" in args: sms_test_content = args["sms_test_content"] else: sms_test_content = "bogus" adb_steps.wake_up_device(serial=serial, blocking=True)() adb_steps.menu_to_unlock(serial=serial, blocking=True)() ui_steps.close_all_app_from_recent(serial=serial, blocking=True)() telephony_steps.set_sim_pin(serial=serial, state="ON", pin=sim_pin, blocking=True)() telephony_steps.check_pin_is_requested(serial=serial, pin=sim_pin, blocking=True)() telephony_steps.enter_pin(serial=serial, pin=sim_pin, blocking=True)() for i in range(iterations): adb_steps.root_connect_device(serial=serial)() adb_steps.command(serial=serial, command="mount -t debugfs none /d")() adb_steps.command(serial=serial, command="echo c > /proc/sysrq-trigger")() adb_steps.check_device_reboots(serial=serial, reboot_timeout=120)() local_steps.wait_for_adb(serial=serial, reboot_timeout=120)() adb_steps.wait_for_ui(serial=serial, boot_to_Android=False, sim_pin_enabled=True)()
# mandatory params old_pin = telephony_defaults.sim['default_pin'] new_pin1 = "123456789" # This script will test that PIN1 cannot be changed to a number with more than 8 digits try: # Setup part adb_steps.wake_up_device(serial=serial)() adb_steps.menu_to_unlock(serial=serial)() ui_steps.close_all_app_from_recent(serial=serial)() ui_steps.press_home(serial=serial)() # Test: PIN - Changing PIN1 - PIN1 can be changed to any number with 4 to 8 digits telephony_steps.set_sim_pin(serial = serial, state = "ON", pin = telephony_defaults.sim['default_pin'])() telephony_steps.change_pin(serial= serial, old_pin = old_pin, new_pin1 = new_pin1, new_pin2 = new_pin1, lock_sim_switch_value = False)() finally: # TearDown part ui_steps.close_all_app_from_recent(serial=serial)() ui_steps.press_home(serial=serial)()