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);
  }