Skip to content
Snippets Groups Projects
Commit be734d29 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Return copied String array from getStringArray method

In the Key class constructor, elements in a String[] instance returned
from DeclaredKeyStyle.getStringArray() may be altered by
KeySpecParser.get(Int|Boolean)Value methods.

Bug: 11245712
Change-Id: I3a7fc5ccdb2a14efb72c402dd11559ab13e08596
parent 2bf3a778
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ import com.android.inputmethod.latin.utils.XmlParseUtils; ...@@ -27,6 +27,7 @@ import com.android.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
public final class KeyStylesSet { public final class KeyStylesSet {
...@@ -90,7 +91,8 @@ public final class KeyStylesSet { ...@@ -90,7 +91,8 @@ public final class KeyStylesSet {
} }
final Object value = mStyleAttributes.get(index); final Object value = mStyleAttributes.get(index);
if (value != null) { if (value != null) {
return (String[])value; final String[] array = (String[])value;
return Arrays.copyOf(array, array.length);
} }
final KeyStyle parentStyle = mStyles.get(mParentStyleName); final KeyStyle parentStyle = mStyles.get(mParentStyleName);
return parentStyle.getStringArray(a, index); return parentStyle.getStringArray(a, index);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment