diff options
| author | 2022-04-28 02:17:15 +0000 | |
|---|---|---|
| committer | 2022-04-28 02:17:15 +0000 | |
| commit | baae0bcf9df637b053b7abe3e566099bf319b8cc (patch) | |
| tree | 8180478d5103ed6abfd85861de4bbed9c0dbad8c | |
| parent | 6efe0b12b5c29f9acfdc172bc6815e81021ac0e3 (diff) | |
| parent | c65819d83970c9aa8d80f04ec397d3efa22fe4c1 (diff) | |
Merge "Fix touchable region calculation in NavigationBarController (2nd)" into tm-dev
| -rw-r--r-- | core/java/android/inputmethodservice/NavigationBarController.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/NavigationBarController.java b/core/java/android/inputmethodservice/NavigationBarController.java index dc38db2134f4..69105016e0ea 100644 --- a/core/java/android/inputmethodservice/NavigationBarController.java +++ b/core/java/android/inputmethodservice/NavigationBarController.java @@ -152,6 +152,7 @@ final class NavigationBarController { private boolean mDrawLegacyNavigationBarBackground; private final Rect mTempRect = new Rect(); + private final int[] mTempPos = new int[2]; Impl(@NonNull InputMethodService inputMethodService) { mService = inputMethodService; @@ -259,21 +260,28 @@ final class NavigationBarController { switch (originalInsets.touchableInsets) { case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME: if (inputFrame.getVisibility() == View.VISIBLE) { - inputFrame.getBoundsOnScreen(mTempRect); + inputFrame.getLocationInWindow(mTempPos); + mTempRect.set(mTempPos[0], mTempPos[1], + mTempPos[0] + inputFrame.getWidth(), + mTempPos[1] + inputFrame.getHeight()); touchableRegion = new Region(mTempRect); } break; case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT: if (inputFrame.getVisibility() == View.VISIBLE) { - inputFrame.getBoundsOnScreen(mTempRect); - mTempRect.top = originalInsets.contentTopInsets; + inputFrame.getLocationInWindow(mTempPos); + mTempRect.set(mTempPos[0], originalInsets.contentTopInsets, + mTempPos[0] + inputFrame.getWidth() , + mTempPos[1] + inputFrame.getHeight()); touchableRegion = new Region(mTempRect); } break; case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE: if (inputFrame.getVisibility() == View.VISIBLE) { - inputFrame.getBoundsOnScreen(mTempRect); - mTempRect.top = originalInsets.visibleTopInsets; + inputFrame.getLocationInWindow(mTempPos); + mTempRect.set(mTempPos[0], originalInsets.visibleTopInsets, + mTempPos[0] + inputFrame.getWidth(), + mTempPos[1] + inputFrame.getHeight()); touchableRegion = new Region(mTempRect); } break; |