Skip to content

Commit 7686620

Browse files
satok16Android (Google) Code Review
authored andcommitted
Merge "Send onViewClicked in the extract mode"
2 parents 9f443fb + a67a3cf commit 7686620

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

core/java/android/inputmethodservice/ExtractEditText.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.content.Context;
2020
import android.util.AttributeSet;
2121
import android.view.inputmethod.ExtractedText;
22+
import android.view.inputmethod.InputMethodManager;
2223
import android.widget.EditText;
2324

2425
/***
@@ -142,4 +143,17 @@ public boolean hasVerticalScrollBar() {
142143
@Override public boolean hasFocus() {
143144
return this.isEnabled();
144145
}
146+
147+
/**
148+
* @hide
149+
*/
150+
@Override protected void viewClicked(InputMethodManager imm) {
151+
// As an instance of this class is supposed to be owned by IMS,
152+
// and it has a reference to the IMS (the current IME),
153+
// we just need to call back its onViewClicked() here.
154+
// It should be good to avoid unnecessary IPCs by doing this as well.
155+
if (mIME != null) {
156+
mIME.onViewClicked(false);
157+
}
158+
}
145159
}

core/java/android/widget/TextView.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5432,8 +5432,8 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
54325432
if (mMovement != null && mText instanceof Editable
54335433
&& mLayout != null && onCheckIsTextEditor()) {
54345434
InputMethodManager imm = InputMethodManager.peekInstance();
5435+
viewClicked(imm);
54355436
if (imm != null) {
5436-
imm.viewClicked(this);
54375437
imm.showSoftInput(this, 0);
54385438
}
54395439
}
@@ -8346,9 +8346,7 @@ public boolean onTouchEvent(MotionEvent event) {
83468346
if (touchIsFinished && (isTextEditable() || mTextIsSelectable)) {
83478347
// Show the IME, except when selecting in read-only text.
83488348
final InputMethodManager imm = InputMethodManager.peekInstance();
8349-
if (imm != null) {
8350-
imm.viewClicked(this);
8351-
}
8349+
viewClicked(imm);
83528350
if (!mTextIsSelectable) {
83538351
handled |= imm != null && imm.showSoftInput(this, 0);
83548352
}
@@ -11310,6 +11308,15 @@ protected void resetResolvedDrawables() {
1131011308
mResolvedDrawables = false;
1131111309
}
1131211310

11311+
/**
11312+
* @hide
11313+
*/
11314+
protected void viewClicked(InputMethodManager imm) {
11315+
if (imm != null) {
11316+
imm.viewClicked(this);
11317+
}
11318+
}
11319+
1131311320
@ViewDebug.ExportedProperty(category = "text")
1131411321
private CharSequence mText;
1131511322
private CharSequence mTransformed;

0 commit comments

Comments
 (0)