/** * Gets the root node from accessibility and if it fails to get one it will retry every 250ms for * up to 1000ms. * * @return null if no root node is obtained */ protected AccessibilityNodeInfo getRootNode() { final int maxRetry = 4; final long waitInterval = 250; AccessibilityNodeInfo rootNode = null; for (int x = 0; x < maxRetry; x++) { rootNode = mUiAutomatorBridge.getRootInActiveWindow(); if (rootNode != null) { return rootNode; } if (x < maxRetry - 1) { Log.e(LOG_TAG, "Got null root node from accessibility - Retrying..."); SystemClock.sleep(waitInterval); } } return rootNode; }
public AccessibilityNodeInfo getAccessibilityRootNode() { return mUiAutomatorBridge.getRootInActiveWindow(); }