Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b948014e authored by Robert Carr's avatar Robert Carr
Browse files

Restore exception behavior of getLocationInWindow.

Restore exception throwing behavior on invalid arguments
for getLocationInWindow. This is tested by CTS.
Tweak some variable names to make the exception string readable.

Change-Id: I069d63b354d90ce74d156362b223765a5c2da2f0
parent 28be2bdb
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -18574,13 +18574,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param location an array of two integers in which to hold the coordinates
     */
    public void getLocationOnScreen(@Size(2) int[] location) {
        getLocationInWindow(location);
    public void getLocationOnScreen(@Size(2) int[] outLocation) {
        getLocationInWindow(outLocation);
        final AttachInfo info = mAttachInfo;
        if (info != null) {
            location[0] += info.mWindowLeft;
            location[1] += info.mWindowTop;
            outLocation[0] += info.mWindowLeft;
            outLocation[1] += info.mWindowTop;
        }
    }
@@ -18591,11 +18591,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param outWindowSpace an array of two integers in which to hold the coordinates
     */
    public void getLocationInWindow(@Size(2) int[] outWindowSpace) {
        outWindowSpace[0] = 0;
        outWindowSpace[1] = 0;
    public void getLocationInWindow(@Size(2) int[] outLocation) {
        if (outLocation == null || outLocation.length < 2) {
            throw new IllegalArgumentException("outLocation must be an array of two integers");
        }
        outLocation[0] = 0;
        outLocation[1] = 0;
        transformFromViewToWindowSpace(outWindowSpace);
        transformFromViewToWindowSpace(outLocation);
    }
    void transformFromViewToWindowSpace(@Size(2) int[] inOutLocation) {