Skip to content

Commit c27cc01

Browse files
author
Romain Guy
committed
Prevent AutoCompleteTextView from opening a popup when it shouldn't
Bug #5553515 The People app is forcing ACTV to show the IME which had the side effect of showing the drop down popup. ACTV was unfortunately not ready to show the drop down if the filtering resulted in no results. Doing so was putting ACTV in a weird state that in turn caused a window to be leaked and really bad behavior to occur in the lower graphics levels. Change-Id: I2ff146d5ae4e4a28edf6ea17039c9f8fdb710e4f
1 parent fe455af commit c27cc01

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

core/java/android/widget/AutoCompleteTextView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ public void showDropDownAfterLayout() {
10311031
public void ensureImeVisible(boolean visible) {
10321032
mPopup.setInputMethodMode(visible
10331033
? ListPopupWindow.INPUT_METHOD_NEEDED : ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
1034-
showDropDown();
1034+
if (mPopup.isDropDownAlwaysVisible() || (mFilter != null && enoughToFilter())) {
1035+
showDropDown();
1036+
}
10351037
}
10361038

10371039
/**

tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.graphics.Canvas;
2222
import android.graphics.Paint;
2323
import android.os.Bundle;
24+
import android.text.TextPaint;
2425
import android.view.View;
2526

2627
@SuppressWarnings({"UnusedDeclaration"})
@@ -39,6 +40,7 @@ static class CustomTextView extends View {
3940
private final Paint mScaledPaint;
4041
private final Paint mSkewPaint;
4142
private final Paint mHugePaint;
43+
private final TextPaint mEventPaint;
4244

4345
CustomTextView(Context c) {
4446
super(c);
@@ -70,13 +72,20 @@ static class CustomTextView extends View {
7072
mHugePaint.setAntiAlias(true);
7173
mHugePaint.setColor(0xff000000);
7274
mHugePaint.setTextSize(300f);
75+
76+
mEventPaint = new TextPaint();
77+
mEventPaint.setFakeBoldText(true);
78+
mEventPaint.setAntiAlias(true);
79+
mEventPaint.setTextSize(14);
7380
}
7481

7582
@Override
7683
protected void onDraw(Canvas canvas) {
7784
super.onDraw(canvas);
7885
canvas.drawRGB(255, 255, 255);
7986

87+
canvas.drawText("Hello OpenGL renderer!", 300, 20, mEventPaint);
88+
8089
mMediumPaint.setStyle(Paint.Style.FILL_AND_STROKE);
8190
mMediumPaint.setStrokeWidth(2.0f);
8291
canvas.drawText("Hello OpenGL renderer!", 100, 20, mMediumPaint);

0 commit comments

Comments
 (0)