diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
index 05d855e313a53d93943992ac9449c69d247d91b2..f7e43a6c2a462c1046e9d54666753dbd6e18d54e 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
@@ -27,6 +27,7 @@ import com.android.inputmethod.latin.utils.XmlParseUtils;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
+import java.util.Arrays;
 import java.util.HashMap;
 
 public final class KeyStylesSet {
@@ -90,7 +91,8 @@ public final class KeyStylesSet {
             }
             final Object value = mStyleAttributes.get(index);
             if (value != null) {
-                return (String[])value;
+                final String[] array = (String[])value;
+                return Arrays.copyOf(array, array.length);
             }
             final KeyStyle parentStyle = mStyles.get(mParentStyleName);
             return parentStyle.getStringArray(a, index);