History log of /frameworks/base/core/java/android/util/ArrayMap.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d0ecb1ed10725a6b2c84d64e212984cd4c0d26d2 14-Apr-2017 Dan Sandler <dsandler@android.com> Avoid ClassCastException in ArrayMap.

Only happens if you're put()ing and clear()ing the map from
different threads, and Dianne told you not to do that.

In addition to avoiding the cache poisoning that results
from concurrent access, ArrayMap now attempts to throw
ConcurrentModificationException if clear() or
ensureCapacity() or put() notices you've modified the map
elsewhere.

Bug: 32994281
Test: runtest -x frameworks/base/core/tests/coretests/src/android/util/ArrayMapTest.java
runtest -x cts/tests/tests/util/src/android/util/cts/ArrayMapTest.java
Change-Id: Ia75970aa9e2b2b65692179f51243584b9773797f
/frameworks/base/core/java/android/util/ArrayMap.java
3d1cb6a2b6882a9b702fc97aa50b2d5779956492 28-Feb-2016 Jeff Sharkey <jsharkey@android.com> Utility to detect lock inversions in system.

This change adds a new LockGuard utility class that can be used to
detect lock inversions across the system server. For example, if a
thread is trying to acquire the ActivityManager lock while holding the
PackageManager lock, it will yell.

This class requires no prior knowledge of locks or their ordering; it
derives all of this data at runtime. However, this means the overhead
is substantial and it should not be enabled by default.

Adds overrides to ArrayMap and ArraySet to use identityHashCode()
instead of the hashCode() provided by the object.

Bug: 27336728
Change-Id: I26c31bc99fe8d61ff13c3455aaeddd5517e44433
/frameworks/base/core/java/android/util/ArrayMap.java
894ce60a9f39c709c52c3405ef0e29d7bea93217 04-Dec-2015 Dianne Hackborn <hackbod@google.com> Fix issue #25656837: Static initialization order bug in ArrayMap leading to NPEs

Change-Id: Iec3532ba167b5a09a5e505997e9e6035033f713f
/frameworks/base/core/java/android/util/ArrayMap.java
f16747db093f6d6371d617efc8d90698d2d5b389 11-Jun-2015 Dianne Hackborn <hackbod@google.com> Add ArraySet to the SDK.

Also fix some documentation.

Change-Id: I46025c3b5450e7cd671135b99ff3b298e223651d
/frameworks/base/core/java/android/util/ArrayMap.java
b6bdb0f02df1004307d25ae86e09cdbbc6865e75 05-Feb-2015 Adam Lesinski <adamlesinski@google.com> Make ArrayMap.EMPTY immutable

This is a regression from KitKat.

Bug:19271657
Change-Id: I11b8e4dd50f6a8d2b15fef66b44aa2d72b1f0349
/frameworks/base/core/java/android/util/ArrayMap.java
4e9c07c0de199169374bded403805c92f1c1c6c1 26-Aug-2014 Adam Lesinski <adamlesinski@google.com> Add indexOf method to ArrayMap & ArraySet

Getting the indexOf is useful for doing compound operations
like:

int i = set.indexOf(key);
if (i >= 0) {
Object o = set.valueAt(i);
o.blah();
set.removeAt(i);
}

Change-Id: I3d4b77d1461ba969fc6b4d332d52d4d084b5b53c
/frameworks/base/core/java/android/util/ArrayMap.java
9c3e74f1f77d3b29ad47d2c74b0a0061e67c76f1 14-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16794553: Duplicate ArrayMap entries in Bundle...

...can lead to launching of un-exported activities

We now validate the array map after unparcelling to make sure there
are no duplicate keys.

And to make up for the performance overhead this introduces, I switched
the parcelling/unparcelling code to write keys as explicit string
objects rather than generic values. There was no reason to use generic
values since the write method itself only accepts an array map with
String keys.

Change-Id: I57bda9eb79ceaaa9c1b94ad49d9e462b52102149
/frameworks/base/core/java/android/util/ArrayMap.java
a3fb40d5f492825bb86769f541620baca5616e05 13-Aug-2014 Dianne Hackborn <hackbod@google.com> Add 560dpi, and some other stuff.

Like new settings actions for some of the new settings panels.
And fix voice interaction services so they require a recognizer.
And tweak array map doc to be correct.

Blah blah blah.

Change-Id: Ib5e66b574b10e7b3fa39723b21046a74e6ead204
/frameworks/base/core/java/android/util/ArrayMap.java
776abc24cdd18610232a50b997cce3cffa74609b 07-Mar-2014 Adam Lesinski <adamlesinski@google.com> Uses VMRuntime.newUnpaddedArray for ideal array sizes

Bug:13028925

Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
/frameworks/base/core/java/android/util/ArrayMap.java
4a7d824c3b41eafc4ff91d3253ff8a9ebd60a454 03-Oct-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10921903: CTS: android.os.cts.ParcelTest#testReadBundle...

...fails from KRS84 across all platforms

My fix for issue #10807048 was wrong, wrong, wrong. The problem was
actually just a stupid mistake in ArrayMap.erase(). This makes it
all right.

Change-Id: I762f7a2d5100bceb86a091ab3d6368edc21b4266
/frameworks/base/core/java/android/util/ArrayMap.java
62d708f4dd8e2a8554df4967837df9896efeff7c 26-Jul-2013 Dianne Hackborn <hackbod@google.com> Okay, I give in, add null key support to ArrayMap and ArraySet.

Change-Id: Iac5035f9c5884a9f9d5acb38132bb128d7a55249
/frameworks/base/core/java/android/util/ArrayMap.java
450d8c5b7c936b00fd0d40b5d68670df0fe56daa 20-Jul-2013 Dianne Hackborn <hackbod@google.com> Fix issue #9940105: IllegalArgumentException in ArrayMap

Try to deal with unmarshalling old parcels. Turns out someone
was writing a parcel to disk storing a Bundle. Naughty, naughty.
This helps us not completely keel over.

Change-Id: Id343da2690b7bab89f6c3cb6fad1b92f270dad03
/frameworks/base/core/java/android/util/ArrayMap.java
b87655b3e551c6a32f34084c8533800bbd1aff7d 18-Jul-2013 Dianne Hackborn <hackbod@google.com> Switch Bundle's implementation over to ArrayMap.

That was... um... easier than I thought it was going to be.

Change-Id: Id8f2211c1d5f8145e0bb009dca0f62a590f2b860
/frameworks/base/core/java/android/util/ArrayMap.java
3e82ba1a67b0c756ab6a289985f4cfc53725b311 16-Jul-2013 Dianne Hackborn <hackbod@google.com> Make ArrayMap public! :)

Also do some tweaking of the various container classes
to synchronize them with the support lib and make it
easier to copy code between the two.

And update activity/fragment to use ArrayMap.

Change-Id: I3cfe82392a17119dfc72c3d9961f64e1914f42be
/frameworks/base/core/java/android/util/ArrayMap.java
b993f41eb2f165425dfdf0f93ea0b1e354eca837 13-Jul-2013 Dianne Hackborn <hackbod@google.com> Update SparseArray docs to be more informative.

Change-Id: I5d8d17d46a69ccdcf6b29f93be3d44addd80ab61
/frameworks/base/core/java/android/util/ArrayMap.java
a17c0f5e164729210210ad3f75aea72ed34ca330 21-Jun-2013 Dianne Hackborn <hackbod@google.com> More procstats work: separate global proc account, more dumping.

We now keep track of the time actually process run independently
of the time packages run in process, so we can give an accurate
summary of how long each physical process runs.

New command line options can be supplied to restrict printing to
a specific package, dump in a new csv format, control what is
printed in the csv format, and print a checkin report.

Add toString methods to ArrayMap and ArraySet.

Change-Id: I47b8f68472592ecc0088c5286d3564aa615f4e0a
/frameworks/base/core/java/android/util/ArrayMap.java
21ab6f49910a6f319bc7b9d3964086cb1ffe09d0 11-Jun-2013 Dianne Hackborn <hackbod@google.com> ArrayMap is great, so how about ArraySet!

Also a few little tweaks to the ArrayMap implementation. Note that
these are fairly parallel implementations; I looked at what I could
abstract out as a base class, but there isn't really all that much without
making the resulting code more general and thus slower. If we kept
the data structure for ArraySet the same as map, where the array has
two values per entry, then they could probably share a lot of code.
I couldn't really bring myself to do that at this point, though...

Change-Id: I9e0dd8baa8e1febcc1033ecef61623ad59ce4aae
/frameworks/base/core/java/android/util/ArrayMap.java
f4130cf35fa128e36f96e55955d4f5db86197e4a 07-Jun-2013 Chet Haase <chet@google.com> Additional functionality and performance for ArrayMap

Added equals() and hashCode() to ArrayMap to allow equals() tests
of maps with the same key/value pairs to return true.

Changed putAll() to handle the case of an empty map faster, just copying
the arrays instead of adding elements one by one.

Added to ArrayMapTests to test new equals() and copy constructor
functionality.

Issue #9299310 Optimize ArrayMap copy constructor

Change-Id: I1186a0eddd1fd53a0f380c2f3972fc1942cdf879
/frameworks/base/core/java/android/util/ArrayMap.java
08735185f8105710e18ad02297461bec9268e514 04-Jun-2013 Chet Haase <chet@google.com> Use ArrayMap instead of HashMap in transitions

The new ArrayMap class is more efficient for small collections.
Transitions use maps all over the place to collect/use property
values in setting up the transition animations. Changing to ArrayMap
should be more efficient, especially in terms of memory allocations
and GCs.

Issue #9276256 Transitions: Reduce memory allocations

Change-Id: I07b7d4ba68d5a207808eca11943aa3578fa90e3e
/frameworks/base/core/java/android/util/ArrayMap.java
390517be2d60dd6e6264150c190c372d89bb331a 31-May-2013 Dianne Hackborn <hackbod@google.com> Clean up some temporary allocations.

Yay to ArrayMap, letting me get rid of a bunch of temporary
iterators in core code paths like updateOomAdj. (Now I definitely
need an ArraySet to finish that up.)

Also clean up various other things that are doing unnecessary
allocations, clean up some debug output, make more of the debug
output respect package filtering.

Change-Id: Ib4979faf4de8c7912739bc0937c3fa9e7bfcde67
/frameworks/base/core/java/android/util/ArrayMap.java
f4bf0ae2a7c2d9d92c5c8abdb82baa53b4c9ccda 21-May-2013 Dianne Hackborn <hackbod@google.com> New ArrayMap class.

This is a new kind of key/value mapping that stores its data
as an array, so it doesn't need to create an extra Entry object
for every mapping placed in to it. It is also optimized to reduce
memory overhead in other ways, by keeping the base object small,
being fairly aggressive about keeping the array data structures
small, etc.

There are some unit and performance tests dropped in to some
random places; they will need to be put somewhere else once I
decided what we are going to do with this for the next release
(for example if we make it public the unit tests should go in
to CTS).

Switch IntentResolver to using ArrayMap instead of HashMap.

Also get rid of a bunch of duplicate implementations of binarySearch,
and add an optimization to the various sparse arrays where you can
supply an explicit 0 capacity to prevent it from doing an initial
array allocation; use this new optimization in a few places where it
makes sense.

Change-Id: I01ef2764680f8ae49938e2a2ed40dc01606a056b
/frameworks/base/core/java/android/util/ArrayMap.java