[Magnifier-39] Hide both handles on overlap

In general, since text insertion/selection handles are implemented as
PopupWindows, if they get to overlap the magnifier they are going to be
rendered above it. Therefore, we are trying to avoid this case.

Before this CL, we were only hiding the grabbed handle, when this would
overlap the magnifier. Since the magnifier would usually be displayed a
certain offset above the grabbed handle, this could only possibly happen
when there was not enough space for the magnifier above in the current
surface.

However, this is not enough, as in the case of selection, the other
handle could as well overlap the magnifier in certain cases. This CL
intersects the magnifier rectangle with the rectangles of both handles
and detects whether these should hidden or not.

Bug: 76459199
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Test: atest FrameworksCoreTests:android.widget.TextViewTest
Change-Id: I22519979eead276dbcf273f7c1a54d654fa251bc
2 files changed