From 0eb8d16d904cb484097f20cf3aa24b0eda223dc1 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 22 Jan 2019 21:47:57 -0800 Subject: Deprecate InputMethodService#onViewClicked() This CL marks InputMethodService#onViewClicked() deprecated. There is no actual implementation change at this moment, but developers should avoid relying on this callback in general not only on futuer versions of Android but also on existing devices. Since this API was implemented in Android 4.0 ICS [1] it never worked well for WebView and any other UI libraries that expose themselves as a giant "Canvas", which can host their own UI hierarchy and sub focus state. If IME developers want consistent and reliable user interaction across devices and applicactions, implementing IMEs' own UI on top of CursorAnchorInfo API would be a good choice. If IME developers just want to be notified an existing input connection is interrupted, they can just monitor InputMethodService#onFinishInput(). [1]: Ia71ad325e50a20e9e1001def662ef992bb50a9d0 863fcd62171e55bc9f2105d9fb5877df982454d8 Fix: 123245358 Test: make -j checkbuild Change-Id: I37a6c6d82d4a424f0df84633b09bca4881efbf02 --- core/java/android/inputmethodservice/InputMethodService.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index d3509d5eb289..38ddc169f527 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -2087,7 +2087,14 @@ public class InputMethodService extends AbstractInputMethodService { * protocol, so applications with custom text editing written before this method appeared will * not call to inform the IME of this interaction. * @param focusChanged true if the user changed the focused view by this click. + * @see InputMethodManager#viewClicked(View) + * @deprecated The method may not be called for composite {@link View} that works as a giant + * "Canvas", which can host its own UI hierarchy and sub focus state. + * {@link android.webkit.WebView} is a good example. Application / IME developers + * should not rely on this method. If your goal is just being notified when an + * on-going input is interrupted, simply monitor {@link #onFinishInput()}. */ + @Deprecated public void onViewClicked(boolean focusChanged) { // Intentionally empty } -- cgit v1.2.3