From 43ee0ab8777632cf171b598153fc2c427586d332 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Sun, 9 Oct 2011 14:11:05 -0700 Subject: [PATCH] Fix issue #5433910: RTE while adding an account from settings Make the new marshalling/unmarshalling code for the long sparse array of ints always consistent. And sane. Change-Id: Ifbfbe6e56f59e469acb66257c504b1168d6566fa --- core/java/android/widget/AbsListView.java | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 0d287cfdf8f2a..38bb2e1bde811 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1443,14 +1443,13 @@ public abstract class AbsListView extends AdapterView implements Te inActionMode = in.readByte() != 0; checkedItemCount = in.readInt(); checkState = in.readSparseBooleanArray(); - long[] idState = in.createLongArray(); - int[] idPositions = in.createIntArray(); - - final int idLength = idState.length; - if (idLength > 0) { + final int N = in.readInt(); + if (N > 0) { checkIdState = new LongSparseArray(); - for (int i = 0; i < idLength; i++) { - checkIdState.put(idState[i], idPositions[i]); + for (int i=0; i implements Te out.writeByte((byte) (inActionMode ? 1 : 0)); out.writeInt(checkedItemCount); out.writeSparseBooleanArray(checkState); - out.writeLongArray(checkIdState != null ? checkIdState.getKeys() : new long[0]); - - int size = checkIdState != null ? checkIdState.size() : 0; - int[] idPositions = new int[size]; - if (size > 0) { - for (int i = 0; i < size; i++) { - idPositions[i] = checkIdState.valueAt(i); - } - out.writeIntArray(idPositions); + final int N = checkIdState != null ? checkIdState.size() : 0; + out.writeInt(N); + for (int i=0; i