am 24ce3645: Merge "Fix RuntiomeException when no custom input style is defined" into jb-dev

* commit '24ce36458690b34e7315556094b6943003cc490e':
  Fix RuntiomeException when no custom input style is defined
This commit is contained in:
Tadashi G. Takaoka 2012-05-22 23:14:53 -07:00 committed by Android Git Automerger
commit e0e7bba154

View file

@ -22,6 +22,7 @@ import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOAR
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME;
import android.os.Build;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodSubtype;
import java.util.ArrayList;
@ -84,11 +85,14 @@ public class AdditionalSubtype {
}
public static InputMethodSubtype[] createAdditionalSubtypesArray(String prefSubtypes) {
if (TextUtils.isEmpty(prefSubtypes)) {
return null;
}
final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR);
final ArrayList<InputMethodSubtype> subtypesList =
new ArrayList<InputMethodSubtype>(prefSubtypeArray.length);
for (int i = 0; i < prefSubtypeArray.length; i++) {
final InputMethodSubtype subtype = createAdditionalSubtype(prefSubtypeArray[i]);
for (final String prefSubtype : prefSubtypeArray) {
final InputMethodSubtype subtype = createAdditionalSubtype(prefSubtype);
if (subtype.getNameResId() == SubtypeLocale.UNKNOWN_KEYBOARD_LAYOUT) {
// Skip unknown keyboard layout subtype. This may happen when predefined keyboard
// layout has been removed.