summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/inputmethod
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-11-30 14:02:49 +0900
committersatok <satok@google.com>2010-11-30 14:02:49 +0900
commitaf4bf400abab86baee44dacbcdf13444d06ee46e (patch)
tree1a7ff28e8936c137597a538204b44f35559eb7a8 /core/java/android/view/inputmethod
parent12190b36a9da88f8db7dbd9ce16d127d76a904b7 (diff)
downloadframeworks_base-af4bf400abab86baee44dacbcdf13444d06ee46e.zip
frameworks_base-af4bf400abab86baee44dacbcdf13444d06ee46e.tar.gz
frameworks_base-af4bf400abab86baee44dacbcdf13444d06ee46e.tar.bz2
Fix a bug of equals in InputMethodSubtype
Change-Id: I68b4726bedfb55d4737cf859ad3cb54bc19f9511
Diffstat (limited to 'core/java/android/view/inputmethod')
-rw-r--r--core/java/android/view/inputmethod/InputMethodSubtype.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java
index 0925940..39a0c19 100644
--- a/core/java/android/view/inputmethod/InputMethodSubtype.java
+++ b/core/java/android/view/inputmethod/InputMethodSubtype.java
@@ -49,19 +49,23 @@ public final class InputMethodSubtype implements Parcelable {
InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue) {
mSubtypeNameResId = nameId;
mSubtypeIconResId = iconId;
- mSubtypeLocale = locale;
- mSubtypeMode = mode;
- mSubtypeExtraValue = extraValue;
+ mSubtypeLocale = locale != null ? locale : "";
+ mSubtypeMode = mode != null ? mode : "";
+ mSubtypeExtraValue = extraValue != null ? extraValue : "";
mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale,
mSubtypeMode, mSubtypeExtraValue);
}
InputMethodSubtype(Parcel source) {
+ String s;
mSubtypeNameResId = source.readInt();
mSubtypeIconResId = source.readInt();
- mSubtypeLocale = source.readString();
- mSubtypeMode = source.readString();
- mSubtypeExtraValue = source.readString();
+ s = source.readString();
+ mSubtypeLocale = s != null ? s : "";
+ s = source.readString();
+ mSubtypeMode = s != null ? s : "";
+ s = source.readString();
+ mSubtypeExtraValue = s != null ? s : "";
mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale,
mSubtypeMode, mSubtypeExtraValue);
}
@@ -110,8 +114,9 @@ public final class InputMethodSubtype implements Parcelable {
public boolean equals(Object o) {
if (o instanceof InputMethodSubtype) {
InputMethodSubtype subtype = (InputMethodSubtype) o;
- return (subtype.getNameResId() == getNameResId())
- && (subtype.getMode() == getMode())
+ return (subtype.hashCode() == hashCode())
+ && (subtype.getNameResId() == getNameResId())
+ && (subtype.getMode().equals(getMode()))
&& (subtype.getIconResId() == getIconResId())
&& (subtype.getLocale().equals(getLocale()))
&& (subtype.getExtraValue().equals(getExtraValue()));
@@ -146,4 +151,4 @@ public final class InputMethodSubtype implements Parcelable {
String mode, String extraValue) {
return Arrays.hashCode(new Object[] {nameResId, iconResId, locale, mode, extraValue});
}
-} \ No newline at end of file
+}