New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range checks in SparseArrays #159

Closed
wants to merge 6 commits into
base: master
from

Conversation

2 participants
@Miha-x64
Copy link

Miha-x64 commented Oct 5, 2017

At the moment, keyAt, valueAt, removeAt and setValueAt methods are performing no range checks. This is great for performance, but exposes unused tail of array: if one passes an index from range [mSize .. mKeys.length) to such method, unexpected result will be returned.

typical SparseArray
keys:    1    3    7    9    0    0    0    0    0    0
values:  a    b    c    d    null null null null null null
indices: 0    1    2    3    4    5    6    7    8    9
                             ^ size                        ^ length

Added range checks into SparseArray, LongSparseArray, LongSparseLongArray, SparseBooleanArray, SparseIntArray, SparseLongArray. Throwing ArrayIndexOutOfBoundsException for consistency (because VM throws it for indices, which are < 0).

As a bonus, added setValueAt methods into LongSparseLongArray and SparseLongArray.

Miha-x64 added some commits Oct 5, 2017

Added range checks to SparseArray
`keyAt`, `valueAt`, `removeAt` and `setValueAt` methods expose keys/values within range `[mSize ... mKeys.length)`. Added range check to avoid this. Using ArrayIndexOutOfBoundsException for consistency (because VM throws them for indices, which are < 0).

followmsi pushed a commit to followmsi/platform_frameworks_base that referenced this pull request Feb 10, 2018

Add large battery percentage and also the switch for it. (aosp-mirror…
…#159)

*  Circle and landscape battery perc inside the icon: use bigger text

Circle:
https://s18.postimg.org/4zbfvog2h/Screenshot_20161123_001840.png

Landscape:
https://s22.postimg.org/w9m8k3w5t/Screenshot_20161123_001902.png

Change-Id: Ic11c82b8e40c00fd5c0009a358d1357b08c99a2c

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

* Battery percentage large text switch [1/2]
@willnorris

This comment has been minimized.

Copy link

willnorris commented Nov 5, 2018

To report bugs or submit patches to Android, please follow the instructions at http://source.android.com/source/contributing.html. More information on these mirrors (like the fact that issues and pull requests are ignored) is available at http://aosp-mirror.github.io/.

@willnorris willnorris closed this Nov 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment