/** * Last activity to report accessibility events. * * @deprecated The results returned should be considered unreliable * @return String name of activity */ @Deprecated public String getCurrentActivityName() { mUiAutomatorBridge.waitForIdle(); synchronized (mLock) { return mLastActivityName; } }
/** * Returns the last text selection reported by accessibility event * TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY. One way to cause this event is using a DPad * arrows to focus on UI elements. */ public String getLastTraversedText() { mUiAutomatorBridge.waitForIdle(); synchronized (mLock) { if (mLastTraversedText.length() > 0) { return mLastTraversedText; } } return null; }
protected AccessibilityNodeInfo findAccessibilityNodeInfo( UiSelector selector, boolean isCounting) { mUiAutomatorBridge.waitForIdle(); initializeNewSearch(); if (DEBUG) Log.d(LOG_TAG, "Searching: " + selector); synchronized (mLock) { AccessibilityNodeInfo rootNode = getRootNode(); if (rootNode == null) { Log.e(LOG_TAG, "Cannot proceed when root node is null. Aborted search"); return null; } // Copy so that we don't modify the original's sub selectors UiSelector uiSelector = new UiSelector(selector); return translateCompoundSelector(uiSelector, rootNode, isCounting); } }
/** Clears the last text selection value saved from the TYPE_VIEW_TEXT_SELECTION_CHANGED event */ public void clearLastTraversedText() { mUiAutomatorBridge.waitForIdle(); synchronized (mLock) { mLastTraversedText = ""; } }
/** * Last package to report accessibility events * * @return String name of package */ public String getCurrentPackageName() { mUiAutomatorBridge.waitForIdle(); AccessibilityNodeInfo rootNode = getRootNode(); if (rootNode == null) return null; return rootNode.getPackageName() != null ? rootNode.getPackageName().toString() : null; }