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

am: c1a0fbcec5

Change-Id: Idde12e81d4f41ab039823470302e099a3c225f68
This commit is contained in:
Louis Chang
2019-04-17 06:22:08 -07:00
committed by android-build-merger
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.