diff options
| author | Evan Rosky <erosky@google.com> | 2020-04-24 18:28:25 -0700 |
|---|---|---|
| committer | Evan Rosky <erosky@google.com> | 2020-04-28 11:59:22 -0700 |
| commit | e067ddfc05c495eebf7e07664774a0776ec7813d (patch) | |
| tree | 8de00cac21b2b3200ec036ab919b42b9240e8136 /core/java | |
| parent | 046df72d9a8a7d5f6e6f255c313fc129db874f68 (diff) | |
Shift Primary stack as well as secondary during ime adjustment
Previously, was only 'adjusting' the secondary split for
ime. So the secondary had functional insets and drag/drop.
However, the primary wasn't being adjusted (accorcding to
WM). This caused its insets to be calculated against its
originla position (which allowed ime insets to potentially
overlap it) and it meant that WM didn't use its visual
position when calculating drag/drop coordinates.
So, this does the same with the primary stack as what was
done with secondary.
However, doing this required some other fixes in WM. Basically,
if appbounds is explicitly overridden, just use them instead of
intersecting with parent. Also, WSA doesn't apply crop for
splits (maybe it shouldn't apply crop to anything anymore).
Additionally, insets calculation was applying top insets to the
bottom if the inset frame's top wasn't exactly equal to the
window's top -- because of a catch-all else condition. So this
adds checks for matching the bottoms as well.
Bug: 154056542
Bug: 151862790
Test: Open two apps in split screen and open IME in secondary. Drag
from secondary to primary.
Change-Id: I2391783e726e4a1c8ed3150628af2f398218fe90
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/InsetsSource.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/java/android/view/InsetsSource.java b/core/java/android/view/InsetsSource.java index 033ccef3666d..a501779637bc 100644 --- a/core/java/android/view/InsetsSource.java +++ b/core/java/android/view/InsetsSource.java @@ -136,20 +136,25 @@ public class InsetsSource implements Parcelable { if (mTmpFrame.width() == relativeFrame.width()) { if (mTmpFrame.top == relativeFrame.top) { return Insets.of(0, mTmpFrame.height(), 0, 0); - } else { + } else if (mTmpFrame.bottom == relativeFrame.bottom) { return Insets.of(0, 0, 0, mTmpFrame.height()); } + // TODO: remove when insets are shell-customizable. + // This is a hack that says "if this is a top-inset (eg statusbar), always apply it + // to the top". It is used when adjusting primary split for IME. + if (mTmpFrame.top == 0) { + return Insets.of(0, mTmpFrame.height(), 0, 0); + } } // Intersecting at left/right else if (mTmpFrame.height() == relativeFrame.height()) { if (mTmpFrame.left == relativeFrame.left) { return Insets.of(mTmpFrame.width(), 0, 0, 0); - } else { + } else if (mTmpFrame.right == relativeFrame.right) { return Insets.of(0, 0, mTmpFrame.width(), 0); } - } else { - return Insets.NONE; } + return Insets.NONE; } /** |
