Loading core/java/android/os/BaseBundle.java +7 −2 Original line number Diff line number Diff line Loading @@ -437,12 +437,15 @@ public class BaseBundle { map.erase(); map.ensureCapacity(count); } int[] numLazyValues = new int[]{0}; try { // recycleParcel being false implies that we do not own the parcel. In this case, do // not use lazy values to be safe, as the parcel could be recycled outside of our // control. recycleParcel &= parcelledData.readArrayMap(map, count, !parcelledByNative, /* lazy */ recycleParcel, mClassLoader); parcelledData.readArrayMap(map, count, !parcelledByNative, /* lazy */ recycleParcel, mClassLoader, numLazyValues); } catch (BadParcelableException e) { if (sShouldDefuse) { Log.w(TAG, "Failed to parse Bundle, but defusing quietly", e); Loading @@ -451,6 +454,8 @@ public class BaseBundle { throw e; } } finally { recycleParcel &= (numLazyValues[0] == 0); mMap = map; if (recycleParcel) { recycleParcel(parcelledData); Loading core/java/android/os/Parcel.java +5 −7 Original line number Diff line number Diff line Loading @@ -5265,7 +5265,7 @@ public final class Parcel { private void readArrayMapInternal(@NonNull ArrayMap<? super String, Object> outVal, int size, @Nullable ClassLoader loader) { readArrayMap(outVal, size, /* sorted */ true, /* lazy */ false, loader); readArrayMap(outVal, size, /* sorted */ true, /* lazy */ false, loader, null); } /** Loading @@ -5275,17 +5275,16 @@ public final class Parcel { * @param lazy Whether to populate the map with lazy {@link Supplier} objects for * length-prefixed values. See {@link Parcel#readLazyValue(ClassLoader)} for more * details. * @return whether the parcel can be recycled or not. * @param lazyValueCount number of lazy values added here * @hide */ boolean readArrayMap(ArrayMap<? super String, Object> map, int size, boolean sorted, boolean lazy, @Nullable ClassLoader loader) { boolean recycle = true; void readArrayMap(ArrayMap<? super String, Object> map, int size, boolean sorted, boolean lazy, @Nullable ClassLoader loader, int[] lazyValueCount) { while (size > 0) { String key = readString(); Object value = (lazy) ? readLazyValue(loader) : readValue(loader); if (value instanceof LazyValue) { recycle = false; lazyValueCount[0]++; } if (sorted) { map.append(key, value); Loading @@ -5297,7 +5296,6 @@ public final class Parcel { if (sorted) { map.validate(); } return recycle; } /** Loading Loading
core/java/android/os/BaseBundle.java +7 −2 Original line number Diff line number Diff line Loading @@ -437,12 +437,15 @@ public class BaseBundle { map.erase(); map.ensureCapacity(count); } int[] numLazyValues = new int[]{0}; try { // recycleParcel being false implies that we do not own the parcel. In this case, do // not use lazy values to be safe, as the parcel could be recycled outside of our // control. recycleParcel &= parcelledData.readArrayMap(map, count, !parcelledByNative, /* lazy */ recycleParcel, mClassLoader); parcelledData.readArrayMap(map, count, !parcelledByNative, /* lazy */ recycleParcel, mClassLoader, numLazyValues); } catch (BadParcelableException e) { if (sShouldDefuse) { Log.w(TAG, "Failed to parse Bundle, but defusing quietly", e); Loading @@ -451,6 +454,8 @@ public class BaseBundle { throw e; } } finally { recycleParcel &= (numLazyValues[0] == 0); mMap = map; if (recycleParcel) { recycleParcel(parcelledData); Loading
core/java/android/os/Parcel.java +5 −7 Original line number Diff line number Diff line Loading @@ -5265,7 +5265,7 @@ public final class Parcel { private void readArrayMapInternal(@NonNull ArrayMap<? super String, Object> outVal, int size, @Nullable ClassLoader loader) { readArrayMap(outVal, size, /* sorted */ true, /* lazy */ false, loader); readArrayMap(outVal, size, /* sorted */ true, /* lazy */ false, loader, null); } /** Loading @@ -5275,17 +5275,16 @@ public final class Parcel { * @param lazy Whether to populate the map with lazy {@link Supplier} objects for * length-prefixed values. See {@link Parcel#readLazyValue(ClassLoader)} for more * details. * @return whether the parcel can be recycled or not. * @param lazyValueCount number of lazy values added here * @hide */ boolean readArrayMap(ArrayMap<? super String, Object> map, int size, boolean sorted, boolean lazy, @Nullable ClassLoader loader) { boolean recycle = true; void readArrayMap(ArrayMap<? super String, Object> map, int size, boolean sorted, boolean lazy, @Nullable ClassLoader loader, int[] lazyValueCount) { while (size > 0) { String key = readString(); Object value = (lazy) ? readLazyValue(loader) : readValue(loader); if (value instanceof LazyValue) { recycle = false; lazyValueCount[0]++; } if (sorted) { map.append(key, value); Loading @@ -5297,7 +5296,6 @@ public final class Parcel { if (sorted) { map.validate(); } return recycle; } /** Loading