Skip to content

Commit 8b117c8

Browse files
committed
Reduce jankiness of the transition between a text field with FLAG_NO_FULLSCREEN and a text field with FLAG_NO_EXTRACT_UI
Bug: 7393485 Currently, the extract text view blinks at the transition of InputMethodService. This change reduces this blinking by making the extract text view invisible when the extract text view is hidden. Change-Id: I9af96058283a9a5b60707d025ad1abbbbc23c16f
1 parent 7ccb280 commit 8b117c8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

core/java/android/inputmethodservice/InputMethodService.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,11 +930,13 @@ public void updateFullscreenMode() {
930930
*/
931931
public void onConfigureWindow(Window win, boolean isFullscreen,
932932
boolean isCandidatesOnly) {
933-
if (isFullscreen) {
934-
mWindow.getWindow().setLayout(MATCH_PARENT, MATCH_PARENT);
935-
} else {
936-
mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT);
933+
final int currentHeight = mWindow.getWindow().getAttributes().height;
934+
final int newHeight = isFullscreen ? MATCH_PARENT : WRAP_CONTENT;
935+
if (mIsInputViewShown && currentHeight != newHeight) {
936+
Log.w(TAG, "Window size has been changed. This may cause jankiness of resizing window: "
937+
+ currentHeight + " -> " + newHeight);
937938
}
939+
mWindow.getWindow().setLayout(MATCH_PARENT, newHeight);
938940
}
939941

940942
/**
@@ -997,10 +999,11 @@ public boolean isExtractViewShown() {
997999
}
9981000

9991001
void updateExtractFrameVisibility() {
1000-
int vis;
1002+
final int vis;
10011003
if (isFullscreenMode()) {
10021004
vis = mExtractViewHidden ? View.INVISIBLE : View.VISIBLE;
1003-
mExtractFrame.setVisibility(View.VISIBLE);
1005+
// "vis" should be applied for the extract frame as well in the fullscreen mode.
1006+
mExtractFrame.setVisibility(vis);
10041007
} else {
10051008
vis = View.VISIBLE;
10061009
mExtractFrame.setVisibility(View.GONE);

0 commit comments

Comments
 (0)