use of android.view.accessibility.AccessibilityEvent in project platform_frameworks_base by android.
the class PhoneStatusBarView method onRequestSendAccessibilityEventInternal.
@Override
public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEventInternal(child, event)) {
// The status bar is very small so augment the view that the user is touching
// with the content of the status bar a whole. This way an accessibility service
// may announce the current item as well as the entire content if appropriate.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
use of android.view.accessibility.AccessibilityEvent in project httpclient by pixmob.
the class IcsAdapterView method onRequestSendAccessibilityEvent.
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEvent(child, event)) {
// Add a record for ourselves as well.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
// Populate with the text of the requesting child.
child.dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
use of android.view.accessibility.AccessibilityEvent in project platform_frameworks_base by android.
the class MockAccessibilityService method onAccessibilityEvent.
@Override
public void onAccessibilityEvent(AccessibilityEvent receivedEvent) {
if (!mReplaying) {
return;
}
if (mExpectedEvents.isEmpty()) {
throw new IllegalStateException("Unexpected event: " + receivedEvent);
}
AccessibilityEvent expectedEvent = mExpectedEvents.poll();
assertEqualsAccessiblityEvent(expectedEvent, receivedEvent);
}
use of android.view.accessibility.AccessibilityEvent in project platform_frameworks_base by android.
the class AccessibilityManagerTest method testSendAccessibilityEvent_AccessibilityDisabled.
@MediumTest
public void testSendAccessibilityEvent_AccessibilityDisabled() throws Exception {
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
AccessibilityManager manager = createManager(false);
try {
manager.sendAccessibilityEvent(sentEvent);
fail("No accessibility events are sent if accessibility is disabled");
} catch (IllegalStateException ise) {
// check expected result
assertEquals("Accessibility off. Did you forget to check that?", ise.getMessage());
}
}
use of android.view.accessibility.AccessibilityEvent in project platform_frameworks_base by android.
the class AccessibilityManagerTest method testSendAccessibilityEvent_AccessibilityEnabled.
@MediumTest
public void testSendAccessibilityEvent_AccessibilityEnabled() throws Exception {
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
when(mMockService.sendAccessibilityEvent(eq(sentEvent), anyInt())).thenReturn(true).thenReturn(false);
AccessibilityManager manager = createManager(true);
manager.sendAccessibilityEvent(sentEvent);
assertSame("The event should be recycled.", sentEvent, AccessibilityEvent.obtain());
manager.sendAccessibilityEvent(sentEvent);
assertNotSame("The event should not be recycled.", sentEvent, AccessibilityEvent.obtain());
}
Aggregations