summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2016-04-12 13:09:13 -0700
committer Robert Carr <racarr@google.com> 2016-04-12 13:09:13 -0700
commitb8320f7c58b46fea23e2827c82b46783b8c71b63 (patch)
tree8a5d565b5d6daf6075afd4fffb1158dd1f8ca56b
parent4b92594857ce52f96252f43c776f3ed31f0ebdfb (diff)
Correct PopupWindow spaceAbove calculation.
The existing logic just doesn't make sense for a display frame with nonzero top. Consider if we were docked on the bottom of a 2560 tall display and so had say a display frame top of 1280. Then if the anchor were 80 pixels in to our window it's top in screen would be 1320. When we would add these two we would end up a value greater than the entire screen height as the possible space above the anchor. Instead subtract the display frame, to only consider the possible space above the anchor, within the display frame. Bug: 26255254 Change-Id: I95d7575a12a4e319f85c1cf6778970ff37918045
-rw-r--r--core/java/android/widget/PopupWindow.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 0d8d8ed17b65..711eb497d53f 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -1581,7 +1581,7 @@ public class PopupWindow {
return true;
}
- final int spaceAbove = displayFrameTop + anchorTopInScreen - anchorHeight;
+ final int spaceAbove = anchorTopInScreen - anchorHeight - displayFrameTop;
if (height <= spaceAbove) {
// Move everything up.
if (mOverlapAnchor) {