public void test_C1176954_CheckCallBarring() throws Exception {
   mm.log("打开设置");
   mm.pressHome();
   mm.launchActivity("com.android.settings/com.android.settings.MiuiSettings");
   mm.waitFor(3);
   mm.log("找到电话设置");
   mm.waitFor(2);
   UiScrollable list = new UiScrollable(new UiSelector().className("android.widget.ListView"));
   UiObject mms;
   mms = list.getChildByText(new UiSelector().className("android.widget.TextView"), "电话", true);
   mms.click();
   mm.waitFor(2);
   mm.log("查找是否有呼叫限制选项");
   mm.waitFor(2);
   UiScrollable list1 = new UiScrollable(new UiSelector().className("android.widget.ListView"));
   UiObject callbarring;
   callbarring =
       list1.getChildByText(new UiSelector().className("android.widget.TextView"), "呼叫限制", true);
   callbarring.click();
   mm.waitFor(1);
   mm.pressHome();
 }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   marmot = new Marmot(this);
   checker = new Checker(marmot);
   uiDevice = marmot.getUiDevice();
   marmot.log("Step 1 : Screen unlock.");
   if (!marmot.isScreenOn()) {
     marmot.wakeUp();
     marmot.waitFor(1);
   }
   if (marmot.getCurrentPackageName().equals(PACKAGE_NAME_KEY_GUARD)) {
     marmot.move(Direction.UP);
     marmot.waitFor(1);
   }
 }
 private boolean dialNumber(String phoneNumber) {
   UiObject2 dialNumber;
   int phoneNumberLength;
   char temp;
   phoneNumberLength = phoneNumber.length();
   for (int i = 0; i < phoneNumberLength; i++) {
     temp = phoneNumber.charAt(i);
     marmot.log(String.format("temp: %s", temp));
     if (Character.isDigit(temp)) {
       dialNumber =
           marmot.getUiObject(
               By.clazz("android.widget.ImageView").res(DIAL_RES.get(String.valueOf(temp))));
       dialNumber.click();
       marmot.waitFor(0.5);
     } else {
       return false;
     }
   }
   return true;
 }
  public void test_00000001_Phone() throws Exception {
    marmot.log("Step 2 : launch contacts Activity.");
    marmot.pressHome();
    marmot.launchActivity(ACTIVITY_NAME_CONTACTS);
    marmot.waitFor(2);

    marmot.log("Step 3 : dialNumber13581659857.");
    checker.assertTrue("contacts", marmot.getCurrentPackageName().equals(PACKAGE_NAME_CONTACTS));
    UiObject2 showDialPad, dialPad;
    dialPad =
        marmot.getUiObject(
            By.clazz("android.widget.LinearLayout").res("com.android.contacts:id/dialpad"));
    if (dialPad == null) {
      showDialPad = marmot.getUiObject(By.clazz("android.widget.Button").text("拨号"));
      showDialPad.click();
      marmot.waitFor(2);
    }
    checker.assertTrue("dialNumber", dialNumber("13581659857"));
    marmot.saveScreenshot("dialNumber" + IMAGE_EXTENSION);
    UiObject2 callSim1;
    callSim1 =
        marmot.getUiObject(
            By.clazz("android.widget.Button").res("com.android.contacts:id/call_sim1"));
    callSim1.click();
    marmot.waitFor(2);
    checker.assertTrue("incallui", marmot.getCurrentPackageName().equals(PACKAGE_NAME_IN_CALL_UI));
    marmot.waitFor(5);
    marmot.saveScreenshot("incallui" + IMAGE_EXTENSION);

    marmot.log("Step 4 : click contacts.");
    UiObject2 contacts;
    contacts = marmot.getUiObject(By.clazz("android.widget.Button").text("通讯录"));

    marmot.log("Step 5 : jump contacts list.");
    if (contacts != null) {
      contacts.click();
    } else {
      UiObject2 controlboard;
      controlboard =
          marmot.getUiObject(
              By.clazz("android.widget.Button").res("com.android.incallui:id/toolsArrow"));
      controlboard.click();
      marmot.waitFor(1);
      contacts = marmot.getUiObject(By.clazz("android.widget.Button").text("通讯录"));
      contacts.click();
    }
    marmot.waitFor(2);
    marmot.saveScreenshot("contacts" + IMAGE_EXTENSION);

    marmot.log("Step 6 : back talk page.");
    checker.assertTrue("contacts", marmot.getCurrentPackageName().equals(PACKAGE_NAME_CONTACTS));
    marmot.waitFor(3);
    marmot.pressBack();
    marmot.waitFor(2);
    checker.assertTrue("incallui", marmot.getCurrentPackageName().equals(PACKAGE_NAME_IN_CALL_UI));

    marmot.log("Step 7 : hangoff.");
    UiObject2 hangOff;
    hangOff =
        marmot.getUiObject(
            By.clazz("android.widget.Button").res("com.android.incallui:id/endButton"));
    hangOff.click();
    marmot.waitFor(2);
    checker.setTestrailResult("C513250", true);
  }