summaryrefslogtreecommitdiff
path: root/core/java/android/util/SparseArray.java
Commit message (Collapse)AuthorAgeFilesLines
* Accept generic in SparseArray contentEqualsWinson2021-02-241-1/+6
| | | | | | | | | | Also updates the JavaDoc. Bug: 181100924 Test: atest android.util.cts.SparseArrayTest Change-Id: I3704b2519d10e20d02437037c7f92f5d2ed90dcd
* Add internal domain verification data classesWinson2021-02-041-0/+43
| | | | | | | | | | | | | | | | | Eventually will be used to store state that's included as part of com.android.server.pm.Settings. Also adds equality and Kotlin index operator mutation support to SparseArray, to improve ease of use. Exempt-From-Owner-Approval: Already approved by owners on main branch Bug: 163565712 CTS-Coverage-Bug: 179382047 Test: none, will be tested as part of follow up change Change-Id: Ie4eca3a99633465337758ee165e07f35c8db87c8
* Add SparseArray#set for Kotlin index= operatorWinson2021-01-121-0/+8
| | | | | | | | | | Just an alias for put to allow `array[index] = value` syntax in Kotlin. Bug: 163565712 Test: manual, used in tests for separate feature Change-Id: Ie9e17b8f4d16a52f4dc213e1ada8d61fce9eedaf
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* Address API feedback.Kweku Adams2019-11-251-0/+3
| | | | | | | | Add @param and @return to new SparseArray.contains() method. Bug: N/A Test: N/A Change-Id: I81460524f29628a4ce1e47b1510c2887fa51717d
* Extract SparseArrayMap from QuotaController.Kweku Adams2019-11-181-0/+8
| | | | | | | | | | | This structure can be useful in other parts of the system, so extracting it and making it more generic makes sense. Bug: 135764360 Bug: 141645789 Test: atest QuotaControllerTest Test: atest SparseArrayMapTest Change-Id: I2aeb3ea53e3dc2ec00667a0a2ccdb112cf562377
* Add extra comment for implementation.Kweku Adams2019-04-291-0/+4
| | | | | | | | | Add a comment noting that the check to throw the exception is intentionally second so that it's out of the critical path. Bug: 118339123 Test: N/A Change-Id: I36c5ea67579bcd7906f711530392110d9987ffb4
* Gating OutOfBoundsException on targetSdkVersion.Kweku Adams2019-04-261-8/+17
| | | | | | | | | Apps targeting Pie or older will get the old undefined behavior. Apps targeting Q or newer will get the OutOfBoundsException. Bug: 118339123 Test: atest CtsUtilTestCases Change-Id: Ibf5467aadec4a2f76ee180e963afeaf5a8a013a2
* Revert "Revert "Checkng upper bound in *Array classes.""Kweku Adams2019-03-301-1/+18
| | | | | | | | This reverts commit 91ec97056451753d6db55d310fc93fbd93c61cb3. Reason for revert: b/128433495 Change-Id: I4aac43f6aacd594f9c2bf58db9fbc4a1395d8888
* Revert "Checkng upper bound in *Array classes."Paul Scovanner2019-03-121-18/+1
| | | | | | | | This reverts commit 17d453ea85703a5bc26c0669231be4d6f0d8bbac. Reason for revert: b/127750694 Change-Id: I0ffbf0e64109b3ec724e0687a27b231e335f76b4
* Checkng upper bound in *Array classes.Kweku Adams2019-03-051-1/+18
| | | | | | | | | | *Array classes will now throw an IndexOutOfBoundsException if a caller tries to get or set a value for an index that's invalid based on the current size. Bug: 118339123 Test: atest CtsUtilTestCases Change-Id: Iddc9a0c7c89e0ac743b0380049527a1b2dfb434f
* Expose a few APIs in util collections.Jake Wharton2018-09-291-3/+3
| | | | | | | | | | These are either already exposed on other specialized collection variants or are exposed as public API on the androidx versions, or both. With these APIs exposed, all of the unsupported app usage can be done through public API. As a result, all unsupported app usage is now locked to apps targeting API 28 or earlier. Bug: 116877302 Test: none, no implementation change Change-Id: I548d71319bffb0a6b529e380ea936df674dbf515
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-141-0/+4
| | | | | | | | | | | | | | | | | | | For packages: android.util.proto android.util.jar android.util.apk android.util This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ia0f48c244b0fbe33d40d797702a82303648196ed
* Docs: fixed typo and made minor editsLaura Davis2018-07-301-17/+19
| | | | | | | | Test: make ds-docs Bug: 111734031 Bug: 111734470 Change-Id: Ic120368fef0c0673ce954cdf0927a4705b3edcd2
* Removing unused method indexOfValueByValueSuprabh Shukla2017-03-241-0/+1
| | | | | | | | | | The method was confusing and not used by anyone. Same functionality can be implemented trivially in the client code. Test: N/A Bug: 35765468 Change-Id: Ia019088cd023c62d83760d9ebe883f7559a43375
* indexOfValueByValue now uses .equalsTejas Khorana2016-07-151-2/+32
| | | | | | | | | To address the issue that indexOfValue does not compare objects by value (using .equals). I have made a method that does the indexOfValue operation but instead comparing Objects using equals. New method created as it was too late to change indexOfValue itself. Change-Id: Ie58ce279aca74ef25ce151d8f8bde769f644f0d0
* Fix a11y crash when window layer isn't unique.Phil Weaver2016-05-191-0/+14
| | | | | | | | | | | | | | | | | | | TalkBack is seeing crashes that I can only explain by our assumption that window layer is unique in all cases. TalkBack reports that it happens during animation, so I assume that the layer may repeat transiently. Reducing our dependence on this assumption by traversing the list of windows sorted by layer without assuming that the list has the same length as the list of unsorted windows. Also documenting the undefined behavior of SparseArray when indexing beyond its bounds. The undefined behavior itself is intentional for performance reasons. Bug: 28679528 Bug: 28815817 Change-Id: I0c9f90b0b458b4cde465f603ba204fe6691e5c2c
* Update power manager to track uid state like netstats.Dianne Hackborn2015-05-181-0/+18
| | | | | | | | | | | | | | | | To follow the correct semantics for when restricts due to device idle can be applied, power manager need to know about uid process states like net policy so that it can allow wake locks from apps that are in the foreground. Since this is being added to a second place, I reworked things so that the activity manager now keeps track of per-uid process states and allows apps to register to listen to those, rather than having to track lower-level process states and transform them into an overall uid state. Both net policy and power manager use this new facility. Change-Id: I77359164c40d0f36fe1ef296dd9f9c3062431148
* Uses VMRuntime.newUnpaddedArray for ideal array sizesAdam Lesinski2014-03-271-45/+12
| | | | | | Bug:13028925 Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
* Fix javadoc typo in SparseArray.Newton Allen2013-11-211-1/+1
| | | | Change-Id: Ie69b2cf96dae95b6ebe7b7797d3755749aec9f35
* Document the order of values returned by keyAt().Flavio Lerda2013-09-081-0/+17
| | | | | | | | | | | The values returned by keyAt() are currently guaranteed to be in ascending order. This is helpful to users of the API to be able to make assumptions about the keys and values when iterating over one of the sparse array implementations. This commit adds documentation about this. Change-Id: I3d7eb78e115ce174f1167b83904b44bf5120b223
* Make ArrayMap public! :)Dianne Hackborn2013-07-161-23/+47
| | | | | | | | | | 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
* Update SparseArray docs to be more informative.Dianne Hackborn2013-07-121-2/+19
| | | | Change-Id: I5d8d17d46a69ccdcf6b29f93be3d44addd80ab61
* New ArrayMap class.Dianne Hackborn2013-05-241-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Clarify the documentation of SparseArray.indexOfValue.Elliott Hughes2013-03-261-8/+10
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=53297 Change-Id: I28725a2d03d4c11948bfe4fb90d730c86bf41481
* Fixing memory leaks in the accessiiblity layer.Svetoslav Ganov2011-11-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. AccessibilityInteractionConnections were removed from the AccessiiblityManagerService but their DeathRecipents were not unregistered, thus every removed interaction connection was essentially leaking. Such connection is registered in the system for every ViewRootImpl when accessiiblity is enabled and inregistered when disabled. 2. Every AccessibilityEvent and AccessiilbityEventInfo obtained from a widnow content querying accessibility service had a handle to a binder proxy over which to make queries. Hoewever, holding a proxy to a remote binder prevents the latter from being garbage collected. Therefore, now the events and infos have a connection id insteand and the hindden singleton AccessiiblityInteaction client via which queries are made has a registry with the connections. This class looks up the connection given its id before making an IPC. Now the connection is stored in one place and when an accessibility service is disconnected the system sets the connection to null so the binder object in the system process can be GCed. Note that before this change a bad implemented accessibility service could cache events or infos causing a leak in the system process. This should never happen. 3. SparseArray was not clearing the reference to the last moved element while garbage collecting thus causing a leak. bug:5664337 Change-Id: Id397f614b026d43bd7b57bb7f8186bca5cdfcff9
* Touch exploration separate setting and API to poll the latter state.Svetoslav Ganov2011-07-181-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | 1. Seperated touch exploration to be a seperate setting rather being magically enabled by the system of accessiiblity is on the there is at leas one accessibility service that speaks enabled. Now there is a setting for requesting touch exploration but still the system will enabled it only if that makes sense i.e. accessibility is on and one accessibility service that speaks is enabled. 2. Added public API for checking of touch exploration is enabled. 3. Added description attribute in accessibility service declaration which will be shown to the user before enabling the service. 4. Added API for quick cloning of AccessibilityNodeInfo. 5. Added clone functionality to SparseArray, SparseIntArray, and SparseBooleanArray. bug:5034010 bug:5033928 Change-Id: Ia442edbe55c20309244061cd9d24e0545c01b54f
* Integrate Loader support in to Activity/Fragment.Dianne Hackborn2010-07-081-0/+10
| | | | | | | | | | | Introduces a new LoaderManager class that takes care of most of what LoaderManagingFragment does. Every Fragment and Activity can have one instance of this class. In the future, the instance will be retained across config changes. Also various other cleanups and improvement. Change-Id: I3dfb406dca46bda7f5acb3c722efcbfb8d0aa9ba
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+340
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-340/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+340