am f518ad0a: Merge "IndexOutOfBoundsException on addPreference in PreferenceGroup"

* commit 'f518ad0a4941236b72b5d090320d4ab70ebbf26b':
  IndexOutOfBoundsException on addPreference in PreferenceGroup
This commit is contained in:
Alan Viverette
2015-10-07 16:54:26 +00:00
committed by Android Git Automerger

View File

@@ -148,16 +148,15 @@ public abstract class PreferenceGroup extends Preference implements GenericInfla
}
}
int insertionIndex = Collections.binarySearch(mPreferenceList, preference);
if (insertionIndex < 0) {
insertionIndex = insertionIndex * -1 - 1;
}
if (!onPrepareAddPreference(preference)) {
return false;
}
synchronized(this) {
int insertionIndex = Collections.binarySearch(mPreferenceList, preference);
if (insertionIndex < 0) {
insertionIndex = insertionIndex * -1 - 1;
}
mPreferenceList.add(insertionIndex, preference);
}