diff options
| author | Adam Lesinski <adamlesinski@google.com> | 2015-02-05 11:11:03 -0800 |
|---|---|---|
| committer | Adam Lesinski <adamlesinski@google.com> | 2015-02-05 11:11:03 -0800 |
| commit | b6bdb0f02df1004307d25ae86e09cdbbc6865e75 (patch) | |
| tree | 48cd3bae1287e49cfa712b8859d0c258b7a3f023 /core/java/android/util/ArrayMap.java | |
| parent | 81c80180311803d9faabc0bbd6c0813f44edcf7d (diff) | |
Make ArrayMap.EMPTY immutable
This is a regression from KitKat.
Bug:19271657
Change-Id: I11b8e4dd50f6a8d2b15fef66b44aa2d72b1f0349
Diffstat (limited to 'core/java/android/util/ArrayMap.java')
| -rw-r--r-- | core/java/android/util/ArrayMap.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java index 7c9861f435f4..6ed388515599 100644 --- a/core/java/android/util/ArrayMap.java +++ b/core/java/android/util/ArrayMap.java @@ -255,7 +255,10 @@ public final class ArrayMap<K, V> implements Map<K, V> { } private ArrayMap(boolean immutable) { - mHashes = EmptyArray.INT; + // If this is immutable, use the sentinal EMPTY_IMMUTABLE_INTS + // instance instead of the usual EmptyArray.INT. The reference + // is checked later to see if the array is allowed to grow. + mHashes = immutable ? EMPTY_IMMUTABLE_INTS : EmptyArray.INT; mArray = EmptyArray.OBJECT; mSize = 0; } |
