From dc211bfac3e8f6e75f8b9e7a6f31c112f30d4901 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Wed, 18 Nov 2020 15:04:27 -0800 Subject: Prevent Fullscreen IME when app is in portrait. When an app is running in portrait orientation, regardless of what orientation display is in, IME shouldn't use fullscreen-mode. Setting IME_FLAG_NO_FULLSCREEN in EditorInfo makes sure IME doesn't go fullscreen. Bug: 157870379 Test: Manually using steps in bug Change-Id: I5a5e73e1dec776665f28a7e2eb091b555198001b --- core/java/android/widget/TextView.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/java/android/widget/TextView.java') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 12c91fac0c65..977a0e89a143 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -17,6 +17,7 @@ package android.widget; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; +import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.view.ContentInfo.FLAG_CONVERT_TO_PLAIN_TEXT; import static android.view.ContentInfo.SOURCE_AUTOFILL; import static android.view.ContentInfo.SOURCE_CLIPBOARD; @@ -8738,6 +8739,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION; } } + if (getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT) { + outAttrs.internalImeOptions |= EditorInfo.IME_FLAG_APP_WINDOW_PORTRAIT; + } if (isMultilineInputType(outAttrs.inputType)) { // Multi-line text editors should always show an enter key. outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION; -- cgit v1.2.3