summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cosmin Băieș <cosminbaies@google.com> 2025-02-11 17:21:42 +0100
committer Cosmin Băieș <cosminbaies@google.com> 2025-02-11 17:21:42 +0100
commit9622684b2ce8803e4402b16b859ef910314aaa40 (patch)
tree863365b033c03cdbcdda340200308abf76ddec3c
parentdb4d909371d09dee8b0ceeeac21d9636c7b94617 (diff)
Handle edge-to-edge for SimpleInputMethodService
As the SimpleIME is targetting the current SDK, we have to handle the bottom insets so that the SimpleKeyboardView does not overlap with the navigation bar area. Flag: EXEMPT testfix Bug: 394328311 Test: atest InputMethodServiceTest Change-Id: Ica92b730a93bc18438c0ca7cde2af0b338b57113
-rw-r--r--services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/SimpleKeyboardView.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/SimpleKeyboardView.java b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/SimpleKeyboardView.java
index 55d1b451c6b0..1840cdea4c20 100644
--- a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/SimpleKeyboardView.java
+++ b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/SimpleKeyboardView.java
@@ -23,6 +23,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
+import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.TextView;
@@ -107,6 +108,15 @@ final class SimpleKeyboardView extends FrameLayout {
mapSoftKeys();
}
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ // Handle edge to edge for navigationBars insets (system nav bar)
+ // and captionBars insets (IME navigation bar).
+ final int insetBottom = insets.getInsets(WindowInsets.Type.systemBars()).bottom;
+ setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), insetBottom);
+ return insets.inset(0, 0, 0, insetBottom);
+ }
+
/**
* Sets the key press listener.
*