Fix unexpected IME show because of stale requestedVisibleAwaitingControl

Fixes an issue where the IME would unexpectedly open whenever the
controls change because requestedVisibleAwaitingControl might
be stale.

To fix this, we clear the flag whenever it has been applied after
gaining control, when we hide the IME.

Fixes: 181218935
Test: atest 'WindowInsetsControllerTests#testShowImeOnCreate_doesntCauseImeToReappearWhenDialogIsShown'
Change-Id: I251707fc72c908829f2e69d5b1667e71123fbd0f
This commit is contained in:
Adrian Roos
2021-02-25 15:58:32 +01:00
parent 01dabee996
commit b081c42791

View File

@@ -68,8 +68,14 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
}
@Override
void hide(boolean animationFinished, @AnimationType int animationType) {
public void hide() {
super.hide();
mIsRequestedVisibleAwaitingControl = false;
}
@Override
void hide(boolean animationFinished, @AnimationType int animationType) {
hide();
if (animationFinished) {
// remove IME surface as IME has finished hide animation.
@@ -126,6 +132,9 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
hide();
removeSurface();
}
if (control != null) {
mIsRequestedVisibleAwaitingControl = false;
}
}
@Override