diff options
author | Seigo Nonaka <nona@google.com> | 2015-06-25 22:27:12 +0900 |
---|---|---|
committer | Seigo Nonaka <nona@google.com> | 2015-06-26 01:30:40 +0900 |
commit | 145252f84027babc196a44ae6ff3debbf763ca30 (patch) | |
tree | 8828f4a6f1cac0cf8499b3e84cedc1a17c397b35 | |
parent | d4d802be39c67bf207bbb693d32c6a59c78ed3bb (diff) | |
download | frameworks_base-145252f84027babc196a44ae6ff3debbf763ca30.zip frameworks_base-145252f84027babc196a44ae6ff3debbf763ca30.tar.gz frameworks_base-145252f84027babc196a44ae6ff3debbf763ca30.tar.bz2 |
Do not show selection action mode when the TextView is not shown.
OnPreDraw is called even if the View is not visible.
So need to check isShown() and hasWindowFocus() before calling
starting selection action mode.
This hack is originally introduced for keeping selection on device rotation.
I manually verified this issue does not revive with this CL.
Bug: 22036870
Change-Id: I814db6165e2345fcacedcbd399c1a3985501c8fd
-rw-r--r-- | core/java/android/widget/TextView.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 207605e..98d3a1f 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -5231,7 +5231,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // ExtractEditText does not call onFocus when it is displayed, and mHasSelectionOnFocus can // not be set. Do the test here instead. if (isInExtractedMode() && hasSelection() && mEditor != null - && mEditor.mTextActionMode == null) { + && mEditor.mTextActionMode == null && isShown() && hasWindowFocus()) { mEditor.startSelectionActionMode(); } |