Notification for changed subtree in accessibility mode not fired properly.
We fire notifications that the a view subtree changed for accessibility. In some cases the notifications were fired if accessibility is not enabled. This is now fixed. Also the runnable for making the recurring subtree change was not dequeued if it was pending but we received a request which we decided to run immediately. bug:9337912 Change-Id: I27401b3d11f81c653e8761a704ee530263b08c3a
This commit is contained in:
@@ -7024,7 +7024,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
private void notifySubtreeAccessibilityStateChangedIfNeeded() {
|
||||
public void notifySubtreeAccessibilityStateChangedIfNeeded() {
|
||||
if (!AccessibilityManager.getInstance(mContext).isEnabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -18867,6 +18867,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
final long minEventIntevalMillis =
|
||||
ViewConfiguration.getSendRecurringAccessibilityEventsInterval();
|
||||
if (timeSinceLastMillis >= minEventIntevalMillis) {
|
||||
removeCallbacks(this);
|
||||
run();
|
||||
} else {
|
||||
postDelayed(this, minEventIntevalMillis - timeSinceLastMillis);
|
||||
|
||||
@@ -3595,7 +3595,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
}
|
||||
|
||||
if (child.isImportantForAccessibility() && child.getVisibility() != View.GONE) {
|
||||
childAccessibilityStateChanged(child);
|
||||
notifySubtreeAccessibilityStateChangedIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3838,7 +3838,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
onViewRemoved(view);
|
||||
|
||||
if (view.isImportantForAccessibility() && view.getVisibility() != View.GONE) {
|
||||
childAccessibilityStateChanged(view);
|
||||
notifySubtreeAccessibilityStateChangedIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6397,12 +6397,10 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
public void run() {
|
||||
mLastEventTimeMillis = SystemClock.uptimeMillis();
|
||||
if (AccessibilityManager.getInstance(mContext).isEnabled()) {
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain();
|
||||
event.setEventType(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
|
||||
event.setContentChangeType(AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
|
||||
mSource.sendAccessibilityEventUnchecked(event);
|
||||
}
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain();
|
||||
event.setEventType(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
|
||||
event.setContentChangeType(AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
|
||||
mSource.sendAccessibilityEventUnchecked(event);
|
||||
mSource.resetSubtreeAccessibilityStateChanged();
|
||||
mSource = null;
|
||||
}
|
||||
@@ -6417,6 +6415,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final long minEventIntevalMillis =
|
||||
ViewConfiguration.getSendRecurringAccessibilityEventsInterval();
|
||||
if (timeSinceLastMillis >= minEventIntevalMillis) {
|
||||
mSource.removeCallbacks(this);
|
||||
run();
|
||||
} else {
|
||||
mSource.postDelayed(this, minEventIntevalMillis - timeSinceLastMillis);
|
||||
|
||||
@@ -1033,7 +1033,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
|
||||
checkSelectionChanged();
|
||||
}
|
||||
|
||||
childAccessibilityStateChanged(this);
|
||||
notifySubtreeAccessibilityStateChangedIfNeeded();
|
||||
}
|
||||
|
||||
void checkSelectionChanged() {
|
||||
|
||||
Reference in New Issue
Block a user