Merge "Unregister ImeInsetsSourceConsumer when focus lost" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-17 13:03:28 +00:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
@Override
public void onWindowFocusLost() {
mHasWindowFocus = false;
getImm().unregisterImeConsumer(this);
}
/**

View File

@@ -1950,6 +1950,23 @@ public final class InputMethodManager {
}
}
/**
* Unregister for IME state callbacks and applying visibility in
* {@link android.view.ImeInsetsSourceConsumer}.
* @hide
*/
public void unregisterImeConsumer(@NonNull ImeInsetsSourceConsumer imeInsetsConsumer) {
if (imeInsetsConsumer == null) {
throw new IllegalStateException("ImeInsetsSourceConsumer cannot be null.");
}
synchronized (mH) {
if (mImeInsetsConsumer == imeInsetsConsumer) {
mImeInsetsConsumer = null;
}
}
}
/**
* Call showSoftInput with currently focused view.
* @return {@code true} if IME can be shown.