Ensure accessibility works with dialogs

Dialogs normally display in a different window, but in layoutlib they
are simply added to the current view hierarchy. That causes a problem
for accessibility, as the root view for dialogs is a DecorView, which is
automatically considered to be the root for accessibility.
This confuses the accessibility node info creation, resulting in a
cycle. To prevent that, we set the decor view to be the root view as far
as ViewRootImpl is concerned, which is enough to solve the accessibility
cycle issue. But we need to make sure that Layout, which is the actual
root of the hierarchy still considers itself visible (which requires
overriding getChildVisibleRect and getGlobalVisibleRect, as those
normally query ViewRootImpl which is not the parent of Layout anymore
when there is a Dialog).

Bug: 312418057
Test: test added
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:69e377a789407277ebb748f2c4e01216f2e9a92d)
Merged-In: I0742c0bc9469fdf114853e686f9cf213ef676f2d
Change-Id: I0742c0bc9469fdf114853e686f9cf213ef676f2d
6 files changed