diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-10 15:10:43 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-10 15:10:43 +0000 |
| commit | 51ec322208e28b7a850143a411523b227f2f7bf1 (patch) | |
| tree | b9c3407e13c466a6a200bc52ccb23537ea7366fd /core/java | |
| parent | 4e21986e59d09c0dababef47821f9da1da4bc816 (diff) | |
| parent | 7029cc3da8d8b675abd92579aa7f04b50ad6d291 (diff) | |
Merge "Add an empty IMM#windowDismissed(IBinder) for app compat" into rvc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 482d5b25e9da..71dd6653f6a6 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1968,6 +1968,38 @@ public final class InputMethodManager { return true; } + /** + * An empty method only to avoid crashes of apps that call this method via reflection and do not + * handle {@link NoSuchMethodException} in a graceful manner. + * + * @deprecated This is an empty method. No framework method must call this method. + * @hide + */ + @Deprecated + @UnsupportedAppUsage(trackingBug = 37122102, maxTargetSdk = Build.VERSION_CODES.Q, + publicAlternatives = "{@code androidx.activity.ComponentActivity}") + public void windowDismissed(IBinder appWindowToken) { + // Intentionally empty. + // + // It seems that some applications call this method via reflection to null clear the + // following fields that used to exist in InputMethodManager: + // * InputMethodManager#mCurRootView + // * InputMethodManager#mServedView + // * InputMethodManager#mNextServedView + // so that these objects can be garbage-collected when an Activity gets dismissed. + // + // It is indeed true that older versions of InputMethodManager had issues that prevented + // these fields from being null-cleared when it should have been, but the understanding of + // the engineering team is that all known issues have already been fixed as of Android 10. + // + // For older devices, developers can work around the object leaks by using + // androidx.activity.ComponentActivity. + // See https://issuetracker.google.com/u/1/issues/37122102 for details. + // + // If you believe InputMethodManager is leaking objects in API 24 or any later version, + // please file a bug at https://issuetracker.google.com/issues/new?component=192705. + } + private int getStartInputFlags(View focusedView, int startInputFlags) { startInputFlags |= StartInputFlags.VIEW_HAS_FOCUS; if (focusedView.onCheckIsTextEditor()) { |
