[Magnifier-34] Keep magnifier inside its surface
Before this CL, the magnifier window was sometimes displayed partially
out of screen or overlapping with the system bar. This CL prevents this
issue by clamping the magnifier inside its parent surface, also taking
into account the system window insets of this surface.
Also, the CL fixes two kindof unrelated small bugs:
- remembers to reset the previous show and pixel copy coordinates on
#dismiss()
- when clamping the pixel copy coordinates inside surface, consider the
size of the copied content rather than the size of the window where
this is scaled and then copied
Bug:
74234779
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Iec3404123145aa95b37c88f4fbfa3918cbf24f9d