/** 收到聊天里的红包 */
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
  private void handleChatListHongBao() {
    AccessibilityNodeInfo nodeInfo = getService().getRootInActiveWindow();
    if (nodeInfo == null) {
      Log.w(TAG, "rootWindow为空");
      return;
    }

    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText("领取红包");

    if (list != null && list.isEmpty()) {
      // 从消息列表查找红包
      list = nodeInfo.findAccessibilityNodeInfosByText("[微信红包]");

      if (list == null || list.isEmpty()) {
        return;
      }

      for (AccessibilityNodeInfo n : list) {
        if (BuildConfig.DEBUG) {
          Log.i(TAG, "-->微信红包:" + n);
        }
        n.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        break;
      }
    } else if (list != null) {
      // 最新的红包领起
      for (int i = list.size() - 1; i >= 0; i--) {
        AccessibilityNodeInfo parent = list.get(i).getParent();
        if (BuildConfig.DEBUG) {
          Log.i(TAG, "-->领取红包:" + parent);
        }
        if (parent != null) {
          if (isFirstChecked) {
            parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            isFirstChecked = false;
          }
          break;
        }
      }
    }
  }
Exemplo n.º 2
0
  @Before
  public void setUp() {
    ShadowAccessibilityNodeInfo.resetObtainedInstances();
    mCompat1 = new SwitchAccessNodeCompat(AccessibilityNodeInfo.obtain());
    mShadowInfo1 =
        (ShadowAccessibilityNodeInfo)
            ShadowExtractor.extract((AccessibilityNodeInfo) mCompat1.getInfo());
    mCompat2 = new SwitchAccessNodeCompat(AccessibilityNodeInfo.obtain());
    mShadowInfo2 =
        (ShadowAccessibilityNodeInfo)
            ShadowExtractor.extract((AccessibilityNodeInfo) mCompat2.getInfo());
    mSharedPreferences.edit().clear().commit();
    MockitoAnnotations.initMocks(this);
    mCompat1.setBoundsInScreen(NODE_BOUNDS_1);
    mCompat2.setBoundsInScreen(NODE_BOUNDS_2);
    mActionNode1 =
        new AccessibilityNodeActionNode(
            mCompat1,
            new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
                AccessibilityNodeInfoCompat.ACTION_CLICK, "label1"));
    mActionNode2 =
        new AccessibilityNodeActionNode(
            mCompat2,
            new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
                AccessibilityNodeInfoCompat.ACTION_CLICK, "label2"));
    mSelectionNode = new OptionScanSelectionNode(mActionNode1, mActionNode2);

    when(mOverlayController.getContext()).thenReturn(mContext);
    mOptionManager = new OptionManager(mOverlayController);
  }
 @Override
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(info);
   info.setClassName(MaterialCompoundButton.class.getName());
   info.setCheckable(true);
   info.setChecked(mButtonView.isChecked());
 }
Exemplo n.º 4
0
  public boolean generateHongbaoMsg(AccessibilityNodeInfo node) {
    try {
      AccessibilityNodeInfo hongbaoNode = node.getParent();
      String hongbaoContent = hongbaoNode.getChild(0).getText().toString();

      if (hongbaoContent == null) return false;

      AccessibilityNodeInfo messageNode = hongbaoNode.getParent();

      String[] hongbaoInfo = getSenderContentDescriptionFromNode(messageNode);

      String cur = this.getSignature(hongbaoInfo[0], hongbaoContent, hongbaoInfo[1]);
      String last = this.toString();
      Log.e("Test", "curSignature=" + cur);
      Log.e("Test", "lastSignature=" + last);

      if (cur.equals(last)) return false;

      this.sender = hongbaoInfo[0];
      this.time = hongbaoInfo[1];
      this.content = hongbaoContent;
      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
  @LargeTest
  public void testGetRootAccessibilityNodeInfoInActiveWindow() throws Exception {
    final long startTimeMillis = SystemClock.uptimeMillis();
    try {
      // get the root via the designated API
      AccessibilityNodeInfo fetched =
          mUiTestAutomationBridge.getRootAccessibilityNodeInfoInActiveWindow();
      assertNotNull(fetched);

      // get the root via traversal
      AccessibilityNodeInfo expected =
          mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.root);
      while (true) {
        AccessibilityNodeInfo parent = expected.getParent();
        if (parent == null) {
          break;
        }
        expected = parent;
      }
      assertNotNull(expected);

      assertEquals("The node with id \"root\" should be the root.", expected, fetched);
    } finally {
      if (DEBUG) {
        final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
        Log.i(
            LOG_TAG, "testGetRootAccessibilityNodeInfoInActiveWindow: " + elapsedTimeMillis + "ms");
      }
    }
  }
 /**
  * Necessary for accessibility, to ensure we support "scrolling" forward and backward in the
  * circle.
  */
 @SuppressLint("NewApi")
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   if (Build.VERSION.SDK_INT >= 14) {
     super.onInitializeAccessibilityNodeInfo(info);
     info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
     info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
   }
 }
 @Override
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(info);
   info.setScrollable(isScrollableForAccessibility());
   View selectedView = getSelectedView();
   if (selectedView != null) {
     info.setEnabled(selectedView.isEnabled());
   }
 }
Exemplo n.º 8
0
 @Override
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(info);
   if (mCode != 0) {
     info.addAction(new AccessibilityNodeInfo.AccessibilityAction(ACTION_CLICK, null));
     if (mSupportsLongpress) {
       info.addAction(new AccessibilityNodeInfo.AccessibilityAction(ACTION_LONG_CLICK, null));
     }
   }
 }
    @Override
    protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfo node) {
      final boolean hasBounds = getBoundsForDay(virtualViewId, mTempRect);

      if (!hasBounds) {
        // The day is invalid, kill the node.
        mTempRect.setEmpty();
        node.setContentDescription("");
        node.setBoundsInParent(mTempRect);
        node.setVisibleToUser(false);
        return;
      }

      node.setText(getDayText(virtualViewId));
      node.setContentDescription(getDayDescription(virtualViewId));
      node.setBoundsInParent(mTempRect);

      final boolean isDayEnabled = isDayEnabled(virtualViewId);
      if (isDayEnabled) {
        node.addAction(AccessibilityAction.ACTION_CLICK);
      }

      node.setEnabled(isDayEnabled);

      if (virtualViewId == mActivatedDay) {
        // TODO: This should use activated once that's supported.
        node.setChecked(true);
      }
    }
  @LargeTest
  public void testTraverseAllViews() throws Exception {
    final long startTimeMillis = SystemClock.uptimeMillis();
    try {
      // make list of expected nodes
      List<String> classNameAndTextList = new ArrayList<String>();
      classNameAndTextList.add("android.widget.LinearLayout");
      classNameAndTextList.add("android.widget.LinearLayout");
      classNameAndTextList.add("android.widget.LinearLayout");
      classNameAndTextList.add("android.widget.LinearLayout");
      classNameAndTextList.add("android.widget.ButtonButton1");
      classNameAndTextList.add("android.widget.ButtonButton2");
      classNameAndTextList.add("android.widget.ButtonButton3");
      classNameAndTextList.add("android.widget.ButtonButton4");
      classNameAndTextList.add("android.widget.ButtonButton5");
      classNameAndTextList.add("android.widget.ButtonButton6");
      classNameAndTextList.add("android.widget.ButtonButton7");
      classNameAndTextList.add("android.widget.ButtonButton8");
      classNameAndTextList.add("android.widget.ButtonButton9");

      AccessibilityNodeInfo root =
          mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.root);
      assertNotNull("We must find the existing root.", root);

      Queue<AccessibilityNodeInfo> fringe = new LinkedList<AccessibilityNodeInfo>();
      fringe.add(root);

      // do a BFS traversal and check nodes
      while (!fringe.isEmpty()) {
        AccessibilityNodeInfo current = fringe.poll();

        CharSequence className = current.getClassName();
        CharSequence text = current.getText();
        String receivedClassNameAndText =
            className.toString() + ((text != null) ? text.toString() : "");
        String expectedClassNameAndText = classNameAndTextList.remove(0);

        assertEquals(
            "Did not get the expected node info",
            expectedClassNameAndText,
            receivedClassNameAndText);

        final int childCount = current.getChildCount();
        for (int i = 0; i < childCount; i++) {
          AccessibilityNodeInfo child = current.getChild(i);
          fringe.add(child);
        }
      }
    } finally {
      if (DEBUG) {
        final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
        Log.i(LOG_TAG, "testTraverseAllViews: " + elapsedTimeMillis + "ms");
      }
    }
  }
 @LargeTest
 public void testObjectContract() throws Exception {
   final long startTimeMillis = SystemClock.uptimeMillis();
   try {
     // find a view and make sure it is not focused
     AccessibilityNodeInfo button =
         mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.button5);
     assertNotNull(button);
     AccessibilityNodeInfo parent = button.getParent();
     final int childCount = parent.getChildCount();
     for (int i = 0; i < childCount; i++) {
       AccessibilityNodeInfo child = parent.getChild(i);
       assertNotNull(child);
       if (child.equals(button)) {
         assertEquals(
             "Equal objects must have same hasCode.", button.hashCode(), child.hashCode());
         return;
       }
     }
     fail("Parent's children do not have the info whose parent is the parent.");
   } finally {
     if (DEBUG) {
       final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
       Log.i(LOG_TAG, "testObjectContract: " + elapsedTimeMillis + "ms");
     }
   }
 }
 @Test
 public void lastDescentWithoutChildren_shouldReturnFalseAndDoNotResetInnerNode() {
   AccessibilityNodeInfo node = AccessibilityNodeInfo.obtain();
   node.setVisibleToUser(true);
   AccessibilityNodeInfoCompat compat = new AccessibilityNodeInfoCompat(node);
   AccessibilityNodeInfoRef ref = AccessibilityNodeInfoRef.obtain(compat);
   assertFalse(ref.lastDescendant());
   assertEquals(compat, ref.get());
   node.recycle();
   ref.recycle();
 }
Exemplo n.º 13
0
 @SuppressLint("NewApi")
 @Override
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(info);
   info.setClassName(AdapterView.class.getName());
   info.setScrollable(isScrollableForAccessibility());
   View selectedView = getSelectedView();
   if (selectedView != null) {
     info.setEnabled(selectedView.isEnabled());
   }
 }
 @Override
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(info);
   if (!TextUtils.isEmpty(mAccessibilityClass)) {
     info.setClassName(mAccessibilityClass);
     if (Switch.class.getName().equals(mAccessibilityClass)) {
       String label =
           getResources().getString(mTileState ? R.string.switch_bar_on : R.string.switch_bar_off);
       info.setText(label);
       info.setChecked(mTileState);
       info.setCheckable(true);
     }
   }
 }
 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo paramAccessibilityNodeInfo)
 {
   if (Build.VERSION.SDK_INT >= 14)
   {
     super.onInitializeAccessibilityNodeInfo(paramAccessibilityNodeInfo);
     paramAccessibilityNodeInfo.setClassName(LinearLayoutCompat.class.getName());
   }
 }
Exemplo n.º 16
0
 private static void sendBrailleText(
     final View view, final String text, final int selectionStart, final int selectionEnd) {
   AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(view, VIRTUAL_CURSOR_POSITION);
   WriteData data = WriteData.forInfo(info);
   data.setText(text);
   // Set either the focus blink or the current caret position/selection
   data.setSelectionStart(selectionStart);
   data.setSelectionEnd(selectionEnd);
   sSelfBrailleClient.write(data);
 }
  private AccessibilityNodeInfo findNodeRegularRecursive(
      UiSelector subSelector, AccessibilityNodeInfo fromNode, int index) {

    if (subSelector.isMatchFor(fromNode, index)) {
      if (DEBUG) {
        Log.d(LOG_TAG, formatLog(String.format("%s", subSelector.dumpToString(false))));
      }
      if (subSelector.isLeaf()) {
        return fromNode;
      }
      if (subSelector.hasChildSelector()) {
        mLogIndent++; // next selector
        subSelector = subSelector.getChildSelector();
        if (subSelector == null) {
          Log.e(LOG_TAG, "Error: A child selector without content");
          return null; // there is an implementation fault
        }
      } else if (subSelector.hasParentSelector()) {
        mLogIndent++; // next selector
        subSelector = subSelector.getParentSelector();
        if (subSelector == null) {
          Log.e(LOG_TAG, "Error: A parent selector without content");
          return null; // there is an implementation fault
        }
        // the selector requested we start at this level from
        // the parent node from the one we just matched
        fromNode = fromNode.getParent();
        if (fromNode == null) return null;
      }
    }

    int childCount = fromNode.getChildCount();
    boolean hasNullChild = false;
    for (int i = 0; i < childCount; i++) {
      AccessibilityNodeInfo childNode = fromNode.getChild(i);
      if (childNode == null) {
        Log.w(
            LOG_TAG,
            String.format("AccessibilityNodeInfo returned a null child (%d of %d)", i, childCount));
        if (!hasNullChild) {
          Log.w(LOG_TAG, String.format("parent = %s", fromNode.toString()));
        }
        hasNullChild = true;
        continue;
      }
      if (!childNode.isVisibleToUser()) {
        if (VERBOSE)
          Log.v(LOG_TAG, String.format("Skipping invisible child: %s", childNode.toString()));
        continue;
      }
      AccessibilityNodeInfo retNode = findNodeRegularRecursive(subSelector, childNode, i);
      if (retNode != null) {
        return retNode;
      }
    }
    return null;
  }
 /**
  * Takes a list of {@code AccessibilityCheckResult}s and returns a list with only results
  * pertaining to the given {@code AccessibilityNodeInfo}.
  *
  * @param results a list of {@code AccessibilityCheckResult}s
  * @param info the {@code AccessibilityNodeInfo} to get results for
  * @return a list of {@code AccessibilityCheckResult}s pertaining to the given {@code
  *     AccessibilityNodeInfo}.
  */
 public static List<AccessibilityInfoCheckResult> getResultsForInfo(
     Iterable<AccessibilityInfoCheckResult> results, AccessibilityNodeInfo info) {
   List<AccessibilityInfoCheckResult> resultsForInfo =
       new ArrayList<AccessibilityInfoCheckResult>();
   for (AccessibilityInfoCheckResult result : results) {
     if (info.equals(result.getInfo())) {
       resultsForInfo.add(result);
     }
   }
   return resultsForInfo;
 }
  @LargeTest
  public void testPerformAccessibilityActionClearSelection() throws Exception {
    final long startTimeMillis = SystemClock.uptimeMillis();
    try {
      // find a view and make sure it is not selected
      AccessibilityNodeInfo button =
          mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.button5);
      assertFalse(button.isSelected());

      // select the view
      assertTrue(button.performAction(ACTION_SELECT));

      // find the view again and make sure it is selected
      button =
          mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.button5);
      assertTrue(button.isSelected());

      // unselect the view
      assertTrue(button.performAction(ACTION_CLEAR_SELECTION));

      // find the view again and make sure it is not selected
      button =
          mUiTestAutomationBridge.findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.button5);
      assertFalse(button.isSelected());
    } finally {
      if (DEBUG) {
        final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
        Log.i(LOG_TAG, "testPerformAccessibilityActionClearSelection: " + elapsedTimeMillis + "ms");
      }
    }
  }
Exemplo n.º 20
0
 @Override
 public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
   super.onInitializeAccessibilityNodeInfo(host, info);
   String label = null;
   if (host == mLockIcon) {
     label = getResources().getString(R.string.unlock_label);
   } else if (host == mCameraImageView) {
     label = getResources().getString(R.string.camera_label);
   } else if (host == mPhoneImageView) {
     label = getResources().getString(R.string.phone_label);
   }
   info.addAction(new AccessibilityAction(ACTION_CLICK, label));
 }
  @Test
  public void parentWithSelfReferencedParent_shouldReturnFalse() {
    AccessibilityNodeInfo curNode = AccessibilityNodeInfo.obtain();
    curNode.setVisibleToUser(true);
    AccessibilityNodeInfo parentNode = AccessibilityNodeInfo.obtain();
    parentNode.setVisibleToUser(true);

    curNode.setContentDescription("Current");
    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(curNode)).addChild(curNode);
    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(curNode)).setVisibleToUser(true);

    AccessibilityNodeInfoCompat currentCompat = new AccessibilityNodeInfoCompat(curNode);

    AccessibilityNodeInfoRef ref = AccessibilityNodeInfoRef.obtain(currentCompat);
    assertFalse(ref.parent());
    parentNode.recycle();
    curNode.recycle();
    ref.recycle();
  }
Exemplo n.º 22
0
 public void recycle(AccessibilityNodeInfo info) {
   if (info.getChildCount() == 0) {
     log("child widget----------------------------" + info.getClassName(), 1);
     log("Text:" + info.getText(), 1);
     log("hash:=" + info.hashCode(), 1);
   } else {
     for (int i = 0; i < info.getChildCount(); i++) {
       if (info.getChild(i) != null) {
         recycle(info.getChild(i));
       }
     }
   }
 }
Exemplo n.º 23
0
 public boolean ReadyPCID(AccessibilityNodeInfo info) {
   if (info.getChildCount() == 4) {
     AccessibilityNodeInfo child = info.getChild(0);
     if (child != null
         && child.getChildCount() == 0
         && child.getText() != null
         && child.getText().toString().trim().equals("允许远程支持吗?")) {
       String temp = info.getChild(1).getText().toString();
       int postion = temp.indexOf("to remote support");
       if (temp.contains("Would you like to allow")) {
         mTeamViewData.mPCIDTEXT =
             info.getChild(1).getText().toString().substring(24, postion).replace(" ", "").trim();
         mTeamViewData.rejectButton = info.getChild(2);
         mTeamViewData.allowButton = info.getChild(3);
         return true;
       }
     } else {
       return false;
     }
   }
   return false;
 }
Exemplo n.º 24
0
 private String[] getSenderContentDescriptionFromNode(AccessibilityNodeInfo node) {
   int count = node.getChildCount();
   String[] result = {"unknownSender", "unknownTime"};
   for (int i = 0; i < count; i++) {
     AccessibilityNodeInfo thisNode = node.getChild(i);
     if ("android.widget.ImageView".equals(thisNode.getClassName())) {
       CharSequence contentDescription = thisNode.getContentDescription();
       if (contentDescription != null) result[0] = contentDescription.toString();
     } else if ("android.widget.TextView".equals(thisNode.getClassName())) {
       CharSequence thisNodeText = thisNode.getText();
       if (thisNodeText != null) result[1] = thisNodeText.toString();
     }
   }
   return result;
 }
  @Test
  public void parentWithParents_shouldReturnTrueAndSetItselfForParent() {
    AccessibilityNodeInfo currentNode = AccessibilityNodeInfo.obtain();
    currentNode.setVisibleToUser(true);
    AccessibilityNodeInfo parentNode = AccessibilityNodeInfo.obtain();
    parentNode.setVisibleToUser(true);

    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(parentNode)).addChild(currentNode);

    AccessibilityNodeInfoCompat currentCompat = new AccessibilityNodeInfoCompat(currentNode);
    AccessibilityNodeInfoCompat parentCompat = new AccessibilityNodeInfoCompat(parentNode);

    AccessibilityNodeInfoRef ref = AccessibilityNodeInfoRef.obtain(currentCompat);
    assertTrue(ref.parent());
    assertEquals(parentCompat, ref.get());
    parentNode.recycle();
    currentNode.recycle();
    ref.recycle();
  }
Exemplo n.º 26
0
 public int findIDTextView(AccessibilityNodeInfo info) {
   if (info.getChildCount() == 0) {
     if (info != null && info.getClassName().equals("android.widget.EditText")) {
       if (info.getText().toString().trim().equals("正在激活")) {
         state = STATE_BEGIN;
       }
       if (info.getText().toString().trim().equals("-")) {
         mTeamViewData.mIdTextHash = info.hashCode();
         return info.hashCode();
       }
     }
   } else {
     for (int i = 0; i < info.getChildCount(); i++) {
       if (info.getChild(i) != null) {
         int hash = findIDTextView(info.getChild(i));
         if (hash != 0) {
           return hash;
         }
       }
     }
   }
   return 0;
 }
Exemplo n.º 27
0
 public boolean ReadyID(AccessibilityNodeInfo info) {
   if (info.getChildCount() == 0) {
     if (info != null && info.getClassName().equals("android.widget.EditText")) {
       if (info.hashCode() == mTeamViewData.mIdTextHash) {
         if (!info.getText().toString().trim().equals("-")) {
           mTeamViewData.mIdText = info.getText().toString().replace(" ", "").trim();
           return true;
         }
       }
     }
   } else {
     for (int i = 0; i < info.getChildCount(); i++) {
       if (info.getChild(i) != null) {
         if (ReadyID(info.getChild(i))) {
           return true;
         }
       }
     }
   }
   return false;
 }
  @Test
  public void parentWithLoopedParents_shouldReturnFalse() {
    AccessibilityNodeInfo curNode = AccessibilityNodeInfo.obtain();
    curNode.setVisibleToUser(true);
    AccessibilityNodeInfo parentNode = AccessibilityNodeInfo.obtain();
    parentNode.setVisibleToUser(true);

    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(parentNode)).addChild(curNode);
    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(curNode)).addChild(parentNode);

    /* Set nodes to be invisible to force the the code to traverse the loop */
    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(parentNode)).setVisibleToUser(false);
    ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(curNode)).setVisibleToUser(false);

    AccessibilityNodeInfoCompat currentCompat = new AccessibilityNodeInfoCompat(curNode);

    AccessibilityNodeInfoRef ref = AccessibilityNodeInfoRef.obtain(currentCompat);
    assertFalse(ref.parent());
    parentNode.recycle();
    curNode.recycle();
    ref.recycle();
  }
Exemplo n.º 29
0
  public boolean ReadyLoad(AccessibilityNodeInfo info) {

    if (info.getChildCount() == 0) {
      if (info.getText() != null && info.getText().toString().contains("已经连接到您的设备")) {
        return true;
      }
    } else {
      for (int i = 0; i < info.getChildCount(); i++) {
        if (info.getChild(i) != null) {
          if (ReadyLoad(info.getChild(i))) {
            return true;
          }
          ;
        }
      }
    }
    return false;
  }
 private String accessibilityNodeInfoRecursion(AccessibilityNodeInfo ani) {
   if (ani == null) return null;
   if (ani.getClassName()
           .toString()
           .equals("com.google.android.search.searchplate.SimpleSearchText")
       || ani.getClassName()
               .toString()
               .equals("com.google.android.apps.gsa.searchplate.SimpleSearchText")
           && ani.getText() != null) {
     return ani.getText().toString();
   }
   String result = null;
   for (int i = 0; i < ani.getChildCount(); i++) {
     result = accessibilityNodeInfoRecursion(ani.getChild(i));
     if (result != null) {
       break;
     }
   }
   return result;
 }