Loading core/java/android/app/ActivityThread.java +5 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.SuperNotCalledException; import android.util.UtilConfig; import android.util.proto.ProtoOutputStream; import android.view.Choreographer; import android.view.ContextThemeWrapper; Loading Loading @@ -6078,6 +6079,10 @@ public final class ActivityThread extends ClientTransactionHandler { AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } // Let the util.*Array classes maintain "undefined" for apps targeting Pie or earlier. UtilConfig.setThrowExceptionForUpperArrayOutOfBounds( data.appInfo.targetSdkVersion >= Build.VERSION_CODES.Q); Message.updateCheckRecycle(data.appInfo.targetSdkVersion); // Prior to P, internal calls to decode Bitmaps used BitmapFactory, Loading core/java/android/util/ArrayMap.java +28 −4 Original line number Diff line number Diff line Loading @@ -449,11 +449,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Return the key at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the key stored at the given index. */ public K keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -462,11 +468,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Return the value at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value stored at the given index. */ public V valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -475,12 +487,18 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Set the value at a given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @param value The new value to store at this index. * @return Returns the previous value at the given index. */ public V setValueAt(int index, V value) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -673,11 +691,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Remove the key/value mapping at the given index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value that was stored at this index. */ public V removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading core/java/android/util/ArraySet.java +14 −2 Original line number Diff line number Diff line Loading @@ -356,11 +356,17 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { /** * Return the value at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value stored at the given index. */ public E valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -527,11 +533,17 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { /** * Remove the key/value mapping at the given index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value that was stored at this index. */ public E removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading core/java/android/util/LongSparseArray.java +24 −4 Original line number Diff line number Diff line Loading @@ -142,9 +142,14 @@ public class LongSparseArray<E> implements Cloneable { /** * Removes the mapping at the specified index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public void removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -235,9 +240,14 @@ public class LongSparseArray<E> implements Cloneable { * be in ascending order, e.g., <code>keyAt(0)</code> will return the * smallest key and <code>keyAt(size()-1)</code> will return the largest * key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -258,10 +268,15 @@ public class LongSparseArray<E> implements Cloneable { * <code>valueAt(0)</code> will return the value associated with the * smallest key and <code>valueAt(size()-1)</code> will return the value * associated with the largest key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ @SuppressWarnings("unchecked") public E valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -276,9 +291,14 @@ public class LongSparseArray<E> implements Cloneable { * Given an index in the range <code>0...size()-1</code>, sets a new * value for the <code>index</code>th key-value mapping that this * LongSparseArray stores. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public void setValueAt(int index, E value) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading core/java/android/util/LongSparseLongArray.java +12 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,14 @@ public class LongSparseLongArray implements Cloneable { * be in ascending order, e.g., <code>keyAt(0)</code> will return the * smallest key and <code>keyAt(size()-1)</code> will return the largest * key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -189,9 +194,14 @@ public class LongSparseLongArray implements Cloneable { * <code>valueAt(0)</code> will return the value associated with the * smallest key and <code>valueAt(size()-1)</code> will return the value * associated with the largest key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading
core/java/android/app/ActivityThread.java +5 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.SuperNotCalledException; import android.util.UtilConfig; import android.util.proto.ProtoOutputStream; import android.view.Choreographer; import android.view.ContextThemeWrapper; Loading Loading @@ -6078,6 +6079,10 @@ public final class ActivityThread extends ClientTransactionHandler { AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } // Let the util.*Array classes maintain "undefined" for apps targeting Pie or earlier. UtilConfig.setThrowExceptionForUpperArrayOutOfBounds( data.appInfo.targetSdkVersion >= Build.VERSION_CODES.Q); Message.updateCheckRecycle(data.appInfo.targetSdkVersion); // Prior to P, internal calls to decode Bitmaps used BitmapFactory, Loading
core/java/android/util/ArrayMap.java +28 −4 Original line number Diff line number Diff line Loading @@ -449,11 +449,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Return the key at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the key stored at the given index. */ public K keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -462,11 +468,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Return the value at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value stored at the given index. */ public V valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -475,12 +487,18 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Set the value at a given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @param value The new value to store at this index. * @return Returns the previous value at the given index. */ public V setValueAt(int index, V value) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -673,11 +691,17 @@ public final class ArrayMap<K, V> implements Map<K, V> { /** * Remove the key/value mapping at the given index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value that was stored at this index. */ public V removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading
core/java/android/util/ArraySet.java +14 −2 Original line number Diff line number Diff line Loading @@ -356,11 +356,17 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { /** * Return the value at the given index in the array. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value stored at the given index. */ public E valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -527,11 +533,17 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { /** * Remove the key/value mapping at the given index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> * * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value that was stored at this index. */ public E removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading
core/java/android/util/LongSparseArray.java +24 −4 Original line number Diff line number Diff line Loading @@ -142,9 +142,14 @@ public class LongSparseArray<E> implements Cloneable { /** * Removes the mapping at the specified index. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public void removeAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading Loading @@ -235,9 +240,14 @@ public class LongSparseArray<E> implements Cloneable { * be in ascending order, e.g., <code>keyAt(0)</code> will return the * smallest key and <code>keyAt(size()-1)</code> will return the largest * key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -258,10 +268,15 @@ public class LongSparseArray<E> implements Cloneable { * <code>valueAt(0)</code> will return the value associated with the * smallest key and <code>valueAt(size()-1)</code> will return the value * associated with the largest key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ @SuppressWarnings("unchecked") public E valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -276,9 +291,14 @@ public class LongSparseArray<E> implements Cloneable { * Given an index in the range <code>0...size()-1</code>, sets a new * value for the <code>index</code>th key-value mapping that this * LongSparseArray stores. * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public void setValueAt(int index, E value) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading
core/java/android/util/LongSparseLongArray.java +12 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,14 @@ public class LongSparseLongArray implements Cloneable { * be in ascending order, e.g., <code>keyAt(0)</code> will return the * smallest key and <code>keyAt(size()-1)</code> will return the largest * key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long keyAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading @@ -189,9 +194,14 @@ public class LongSparseLongArray implements Cloneable { * <code>valueAt(0)</code> will return the value associated with the * smallest key and <code>valueAt(size()-1)</code> will return the value * associated with the largest key.</p> * * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting * {@link android.os.Build.VERSION_CODES#Q} and later.</p> */ public long valueAt(int index) { if (index >= mSize) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. throw new ArrayIndexOutOfBoundsException(index); } Loading