gotomypc / eyes-free

Automatically exported from code.google.com/p/eyes-free
0 stars 0 forks source link

[TalkBack] AccessibilityEvents ignored when source is not set, and no way to set it #379

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an AccessibilityEvent in code, as suggested by alanv, with:
if (mAccessibilityService.isEnabled()) {
    AccessibilityEvent event = AccessibilityEvent.obtain(
        AccessibilityEvent.TYPE_VIEW_FOCUSED);
    //event.setSource(myView); // API 14 & later
    event.setClassName(myView.getClass().getName());
    event.setPackageName(myView.getContext().getPackageName());
    event.setEnabled(true);
    event.setContentDescription(text);
    myView.sendAccessibilityEventUnchecked(event);
}
2. Note that 'event.setSource(myView)' is commented out.

What is the expected output? What do you see instead?
Expected output: TalkBack utters the text phrase for the focus event
Actual output: TalkBack ignores the event

What version of the product are you using? On what operating system?
com.google.android.marvin.talkback-v3.5.0_r105.apk on Android 2.2 (API 8) and 
Android 4.1 (API 16)

Please provide any additional information below.
Uncommenting the setSource line allows the code to work for API 14 and later, 
but fails to compile for earlier APIs as AccessibilityEvent.setSource(View) is 
not supported.
This code was suggested by alanv as a substitute for 
'myView.announceForAccessibility(text)' prior to API 16 - see 
http://stackoverflow.com/questions/24809471/android-how-to-force-explore-by-touc
h-talkback-to-repeat-the-contentdescription
However, there is a known bug in TalkBack which causes it to ignore events when 
their source is not set - see alanv's 3/3/14 comment to 
http://stackoverflow.com/questions/22046941/send-accessibility-event-not-linked-
to-view

Original issue reported on code.google.com by awayteam...@gmail.com on 6 Aug 2014 at 9:52