Search in sources :

Example 6 with AccessibilityEvent

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;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 7 with AccessibilityEvent

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;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 8 with AccessibilityEvent

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);
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 9 with AccessibilityEvent

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());
    }
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 10 with AccessibilityEvent

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());
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

AccessibilityEvent (android.view.accessibility.AccessibilityEvent)234 AccessibilityManager (android.view.accessibility.AccessibilityManager)47 LargeTest (android.test.suitebuilder.annotation.LargeTest)40 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)20 ViewParent (android.view.ViewParent)13 TimeoutException (java.util.concurrent.TimeoutException)11 MediumTest (android.test.suitebuilder.annotation.MediumTest)10 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)10 Notification (android.app.Notification)7 ITransientNotification (android.app.ITransientNotification)6 RemoteException (android.os.RemoteException)6 StatusBarNotification (android.service.notification.StatusBarNotification)6 SuppressLint (android.annotation.SuppressLint)5 AccessibilityEventFilter (android.app.UiAutomation.AccessibilityEventFilter)5 OnAccessibilityEventListener (android.app.UiAutomation.OnAccessibilityEventListener)5 ViewGroup (android.view.ViewGroup)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 SimpleDateFormat (java.text.SimpleDateFormat)5 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5