Don't cache IME surface in fullscreen mode
Dont cache IME surface when IME was in fullscreen mode. This is done in order to fix IME closing when it is used with RecyclerView. There can be a special case where RecyclerView detaches the view holding mServedView when IME is in fullscreen mode While exact reason is still a mystery, short term solution is to not cache IME when it was in fullscreen mode. Fix: 187772544 Bug: 188818557 Bug: 167948123 Test: Manually using steps in bug Change-Id: I1194d08a00622f1dfa232209a70dcb0797ba192b
This commit is contained in:
@@ -481,6 +481,7 @@ public class InputMethodService extends AbstractInputMethodService {
|
||||
|
||||
boolean mFullscreenApplied;
|
||||
boolean mIsFullscreen;
|
||||
private boolean mLastWasInFullscreenMode;
|
||||
@UnsupportedAppUsage
|
||||
View mExtractView;
|
||||
boolean mExtractViewHidden;
|
||||
@@ -920,8 +921,17 @@ public class InputMethodService extends AbstractInputMethodService {
|
||||
if (mHandler == null) {
|
||||
mHandler = new Handler(getMainLooper());
|
||||
}
|
||||
mImeSurfaceScheduledForRemoval = true;
|
||||
mHandler.postDelayed(() -> removeImeSurface(), TIMEOUT_SURFACE_REMOVAL_MILLIS);
|
||||
|
||||
if (mLastWasInFullscreenMode) {
|
||||
// Caching surface / delaying surface removal can cause mServedView to detach in certain
|
||||
// cases in RecyclerView (b/187772544).
|
||||
// TODO(b/188818557): Re-enable IME surface caching for fullscreen mode once detaching
|
||||
// view issues is resolved in RecyclerView.
|
||||
removeImeSurface();
|
||||
} else {
|
||||
mImeSurfaceScheduledForRemoval = true;
|
||||
mHandler.postDelayed(() -> removeImeSurface(), TIMEOUT_SURFACE_REMOVAL_MILLIS);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeImeSurface() {
|
||||
@@ -2350,6 +2360,7 @@ public class InputMethodService extends AbstractInputMethodService {
|
||||
onWindowHidden();
|
||||
mDecorViewWasVisible = false;
|
||||
}
|
||||
mLastWasInFullscreenMode = mIsFullscreen;
|
||||
updateFullscreenMode();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user