List of usage examples for android.view.accessibility AccessibilityEvent setParcelableData
public void setParcelableData(Parcelable parcelableData)
From source file:com.googlecode.eyesfree.testing.BaseAccessibilityInstrumentationTestCase.java
protected void waitForEventQueueSync() throws Throwable { startRecordingEvents();/* w ww. j a v a 2s . com*/ final AccessibilityEvent event = AccessibilityEvent.obtain(); event.setEnabled(false); event.setEventType(SYNC_EVENT_TYPE); event.setParcelableData(SYNC_PARCELABLE); // Sending the event through the manager sets the event time and // may clear the source node. Only certain event types can be // dispatched (see the framework's AccessibilityManagerService // canDispatchAccessibilityEvent() method). mManager.sendAccessibilityEvent(event); final AccessibilityEvent syncedEvent = stopRecordingEventsAfter(mSyncEventFilter); assertNotNull("Synchronized event queue", syncedEvent); }
From source file:com.googlecode.eyesfree.testing.BaseAccessibilityInstrumentationTestCase.java
/** * Finds an {@link android.view.accessibility.AccessibilityNodeInfo} by View id in the active window. * The search is performed from the root node. * * @param viewId The id of a View.//from w w w . jav a2 s . co m * @return An {@link android.view.accessibility.AccessibilityNodeInfo} if found, null otherwise. */ protected final AccessibilityNodeInfo findAccessibilityNodeInfoByViewIdInActiveWindow(int viewId) { startRecordingEvents(); final View view = getViewForId(viewId); assertNotNull("Obtain view from activity", view); final AccessibilityEvent event = AccessibilityEvent.obtain(); event.setEnabled(false); event.setEventType(NODE_INFO_EVENT_TYPE); event.setParcelableData(SYNC_PARCELABLE); event.setSource(view); // Sending the event through the manager sets the event time and // may clear the source node. Only certain event types can be // dispatched (see the framework's AccessibilityManagerService // canDispatchAccessibilityEvent() method). mManager.sendAccessibilityEvent(event); final AccessibilityEvent syncedEvent = stopRecordingEventsAfter(mNodeInfoEventFilter); assertNotNull("Synchronized event queue", syncedEvent); final AccessibilityNodeInfo sourceNode = syncedEvent.getSource(); assertNotNull("Obtained source node from event", sourceNode); return sourceNode; }