diff options
| author | Yohei Yukawa <yukawa@google.com> | 2017-03-31 14:28:18 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2017-04-03 17:11:41 +0000 |
| commit | 101ae464fcd4b1ffd226f3c4ea2d2d951cf4e0e7 (patch) | |
| tree | 5d283c05b9d0743ee6ed756cb775b37f89e7b37d /core/java | |
| parent | b0db4017e538469df0406855715e79c8e74ee7d3 (diff) | |
Warn if IMM#showSoftInputUnchecked() is called
With this CL, an @hide method InputMethodManager#showSoftInputUnchecked
is marked to be deprecated and starts showing a warning message in logcat
when it gets called to tell application developers who are still using
old implementation fo android.support.v7.widget.SearchView that they
need to switch to support library ver. 26.0 or later version.
Other than that there is no behavior change in this CL.
Test: Manually verified as follows:
1. Flash an OS image
2. Complete the setup wizard (if any).
3. In N MR-1 AOSP repository
frameworks/support/gradlew -p frameworks/support support-v7-demos:assemble
4. adb install out/host/gradle/frameworks/support/support-v7-demos/build/outputs/apk/support-v7-demos-debug.apk
5. adb logcat -s InputMethodManager
6. adb shell am start -n com.example.android.supportv7/.Support7Demos
7. Tap AppCompat -> Action Bar -> Action Bar Usage
8. Tap the magnifier icon.
9. Make sure that the software keyboard shows up.
10. Make sure that in logcat a warning that showSoftInputUnchecked
is going to be removed is shown.
Fixes: 36015425
Change-Id: If01316a0c2a210f9ea03b53700d0ef651955ba9c
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 79b0420a77e3..958d76109a9e 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1018,9 +1018,20 @@ public final class InputMethodManager { } } - /** @hide */ + /** + * This method is still kept for a while until android.support.v7.widget.SearchView ver. 26.0 + * is publicly released because previous implementations of that class had relied on this method + * via reflection. + * + * @deprecated This is a hidden API. You should never use this. + * @hide + */ + @Deprecated public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) { try { + Log.w(TAG, "showSoftInputUnchecked() is a hidden method, which will be removed " + + "soon. If you are using android.support.v7.widget.SearchView, please update " + + "to version 26.0 or newer version."); mService.showSoftInput(mClient, flags, resultReceiver); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); |
