From 064af5c0fc07b3afae3021d42fcac2185158c951 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 21 Apr 2014 13:52:00 -0700 Subject: [PATCH] Stop using modifiable Key array Change-Id: I0f3e96672da4261ae5628d2d5ea39d60e6287ac0 --- .../com/android/inputmethod/keyboard/Keyboard.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 4fd3bac2f..f2dbd14c0 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -25,6 +25,9 @@ import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.CoordinateUtils; +import java.util.Collections; +import java.util.List; + /** * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard * consists of rows of keys. @@ -76,8 +79,8 @@ public class Keyboard { /** Array of keys and icons in this keyboard */ private final Key[] mKeys; - public final Key[] mShiftKeys; - public final Key[] mAltCodeKeysWhileTyping; + public final List mShiftKeys; + public final List mAltCodeKeysWhileTyping; public final KeyboardIconsSet mIconsSet; private final SparseArray mKeyCache = CollectionUtils.newSparseArray(); @@ -101,9 +104,8 @@ public class Keyboard { mVerticalGap = params.mVerticalGap; mKeys = params.mKeys.toArray(new Key[params.mKeys.size()]); - mShiftKeys = params.mShiftKeys.toArray(new Key[params.mShiftKeys.size()]); - mAltCodeKeysWhileTyping = params.mAltCodeKeysWhileTyping.toArray( - new Key[params.mAltCodeKeysWhileTyping.size()]); + mShiftKeys = Collections.unmodifiableList(params.mShiftKeys); + mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping); mIconsSet = params.mIconsSet; mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(),