summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-11-03 20:06:09 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-11-03 20:06:09 +0000
commit0815de7ab6ff793373fb888b814b75725997c7ab (patch)
treeda6256107d2b2f5c59a72db37cb4356e86ef61e5 /core/java/android/inputmethodservice/InputMethodService.java
parent85f5dce5432f34c156d1ad24f28e79c89ab4162c (diff)
parent68349e8aafb58fbf7eab4259934884e8e7ccf4e7 (diff)
Merge "Only use system gesture insets for exclusion rects with root ime view" into rvc-qpr-dev am: 68349e8aaf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12950872 Change-Id: I33e6ab4c4e4320b8e5e6d938d364d969ed5179fe
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 0924e9f5eb7c..64cf2be94444 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -71,6 +71,7 @@ import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowInsets.Side;
+import android.view.WindowInsets.Type;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.CompletionInfo;
@@ -104,7 +105,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Collections;
+import java.util.ArrayList;
/**
* InputMethodService provides a standard implementation of an InputMethod,
@@ -850,10 +851,19 @@ public class InputMethodService extends AbstractInputMethodService {
/** Set region of the keyboard to be avoided from back gesture */
private void setImeExclusionRect(int visibleTopInsets) {
- View inputFrameRootView = mInputFrame.getRootView();
- Rect r = new Rect(0, visibleTopInsets, inputFrameRootView.getWidth(),
- inputFrameRootView.getHeight());
- inputFrameRootView.setSystemGestureExclusionRects(Collections.singletonList(r));
+ View rootView = mInputFrame.getRootView();
+ android.graphics.Insets systemGesture =
+ rootView.getRootWindowInsets().getInsetsIgnoringVisibility(Type.systemGestures());
+ ArrayList<Rect> exclusionRects = new ArrayList<>();
+ exclusionRects.add(new Rect(0,
+ visibleTopInsets,
+ systemGesture.left,
+ rootView.getHeight()));
+ exclusionRects.add(new Rect(rootView.getWidth() - systemGesture.right,
+ visibleTopInsets,
+ rootView.getWidth(),
+ rootView.getHeight()));
+ rootView.setSystemGestureExclusionRects(exclusionRects);
}
/**