OSDN Git Service
(root)
/
android-x86
/
frameworks-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
81c8018
)
Make ArrayMap.EMPTY immutable
author
Adam Lesinski
<adamlesinski@google.com>
Thu, 5 Feb 2015 19:11:03 +0000
(11:11 -0800)
committer
Adam Lesinski
<adamlesinski@google.com>
Thu, 5 Feb 2015 19:11:03 +0000
(11:11 -0800)
This is a regression from KitKat.
Bug:
19271657
Change-Id: I11b8e4dd50f6a8d2b15fef66b44aa2d72b1f0349
core/java/android/util/ArrayMap.java
patch
|
blob
|
history
diff --git
a/core/java/android/util/ArrayMap.java
b/core/java/android/util/ArrayMap.java
index
7c9861f
..
6ed3885
100644
(file)
--- 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;
}