summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/inputmethod
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-05-15 15:36:23 +0900
committerYohei Yukawa <yukawa@google.com>2014-05-15 16:10:04 +0900
commit419b1b0498e33a556780be1702b444d54fcaa7dd (patch)
treec8867179283d555170fd3e24718833143ee7344d /core/java/android/view/inputmethod
parent9edfec8b4527c62f594adb275e49f6d6ca945c05 (diff)
downloadframeworks_base-419b1b0498e33a556780be1702b444d54fcaa7dd.zip
frameworks_base-419b1b0498e33a556780be1702b444d54fcaa7dd.tar.gz
frameworks_base-419b1b0498e33a556780be1702b444d54fcaa7dd.tar.bz2
Make a copy of Matrix in CursorAnchorInfoBuilder
This CL fixes a bug that CursorAnchorInfoBuilder does't make a copy if the Matrix specified with #setMatrix. Without this fix, IMM#updateCursorAnchorInfo could fail to detect duplicated events when the same instances of CursorAnchorInfoBuilder and Matrix are reused to optimize performance. Change-Id: I50c50a12a06d3cda4dec445b171b61ceb78da21a
Diffstat (limited to 'core/java/android/view/inputmethod')
-rw-r--r--core/java/android/view/inputmethod/CursorAnchorInfo.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/java/android/view/inputmethod/CursorAnchorInfo.java b/core/java/android/view/inputmethod/CursorAnchorInfo.java
index 60691b0..fad6747 100644
--- a/core/java/android/view/inputmethod/CursorAnchorInfo.java
+++ b/core/java/android/view/inputmethod/CursorAnchorInfo.java
@@ -290,14 +290,10 @@ public final class CursorAnchorInfo implements Parcelable {
* is interpreted as an identity matrix.
*/
public CursorAnchorInfoBuilder setMatrix(final Matrix matrix) {
- if (matrix != null) {
- mMatrix = matrix;
- } else {
- mMatrix = Matrix.IDENTITY_MATRIX;
- }
+ mMatrix.set(matrix != null ? matrix : Matrix.IDENTITY_MATRIX);
return this;
}
- private Matrix mMatrix = Matrix.IDENTITY_MATRIX;
+ private final Matrix mMatrix = new Matrix(Matrix.IDENTITY_MATRIX);
/**
* @return {@link CursorAnchorInfo} using parameters in this
@@ -320,7 +316,7 @@ public final class CursorAnchorInfo implements Parcelable {
mInsertionMarkerTop = Float.NaN;
mInsertionMarkerBaseline = Float.NaN;
mInsertionMarkerBottom = Float.NaN;
- mMatrix = Matrix.IDENTITY_MATRIX;
+ mMatrix.set(Matrix.IDENTITY_MATRIX);
if (mCharacterRectBuilder != null) {
mCharacterRectBuilder.reset();
}
@@ -338,7 +334,7 @@ public final class CursorAnchorInfo implements Parcelable {
mInsertionMarkerBottom = builder.mInsertionMarkerBottom;
mCharacterRects = builder.mCharacterRectBuilder != null ?
builder.mCharacterRectBuilder.build() : null;
- mMatrix = builder.mMatrix;
+ mMatrix = new Matrix(builder.mMatrix);
}
/**