diff options
| author | Yohei Yukawa <yukawa@google.com> | 2017-12-12 09:33:26 -0800 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2017-12-12 09:33:26 -0800 |
| commit | cf68d52ce8f21ab85468e6bc7e977aa68b7ab32d (patch) | |
| tree | cf8c1ca124fc633b3561841c1c0ed7f9868230c5 /core/java/android/view/WindowManager.java | |
| parent | b0fbfcea05827223ab7260ad5e2c8e4ba3bf0cd9 (diff) | |
SoftInput flag requires focused View to show IME
Historically SOFT_INPUT_STATE_VISIBLE/SOFT_INPUT_STATE_ALWAYS_VISIBLE
have not required focused editor View [1] to work. This is easy to
use, but also easy to tell IMEs to connect to InputConnection, which
is often recognized as a bug by users because often nothing happens
when the user taps the software keyboard.
This would become more obvious when we start allowing nothing to have
focus (Bug 68841055) in Android P.
Although how we should deal with "dummy InputConnection" is still an
open question, ignoring these SoftInput flags for apps that target P+
when there is no focused editor view is probably better than the
current behavior, where non-functional software keyboard is likely to
be shown. The user is still able to show the IME by explicitly tap
the edit field.
As an implementation note, this CL trusts the targetSdkVersion
reported from the target application process, which is in general
unsafe. That said, for this particular purpose it is acceptable.
[1]: focused View that returns true from View#onCheckIsTextEditor().
Bug: 69256929
Test: atest CtsInputMethodTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod.InputMethodUtilsTest
Change-Id: I56682c7dee71d461687b9e80ab746d382fd55e0c
Diffstat (limited to 'core/java/android/view/WindowManager.java')
| -rw-r--r-- | core/java/android/view/WindowManager.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 500701de7f23..ce3022ed791d 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1672,12 +1672,20 @@ public interface WindowManager extends ViewManager { * Visibility state for {@link #softInputMode}: please show the soft * input area when normally appropriate (when the user is navigating * forward to your window). + * + * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag + * is ignored unless there is a focused view that returns {@code true} from + * {@link View#isInEditMode()} when the window is focused.</p> */ public static final int SOFT_INPUT_STATE_VISIBLE = 4; /** * Visibility state for {@link #softInputMode}: please always make the * soft input area visible when this window receives input focus. + * + * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag + * is ignored unless there is a focused view that returns {@code true} from + * {@link View#isInEditMode()} when the window is focused.</p> */ public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; |
