Loading core/java/android/app/usage/TimeSparseArray.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -81,13 +81,18 @@ public class TimeSparseArray<E> extends LongSparseArray<E> { @Override @Override public void put(long key, E value) { public void put(long key, E value) { final long origKey = key; final long origKey = key; while (indexOfKey(key) >= 0) { int keyIndex = indexOfKey(key); if (keyIndex >= 0) { final long sz = size(); while (keyIndex < sz && keyAt(keyIndex) == key) { key++; key++; keyIndex++; } } if (origKey != key) { if (key >= origKey + 10) { Slog.w(TAG, "Value " + value + " supposed to be inserted at " + origKey Slog.w(TAG, "Value " + value + " supposed to be inserted at " + origKey + " displaced to " + key); + " displaced to " + key); } } } super.put(key, value); super.put(key, value); } } Loading Loading
core/java/android/app/usage/TimeSparseArray.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -81,13 +81,18 @@ public class TimeSparseArray<E> extends LongSparseArray<E> { @Override @Override public void put(long key, E value) { public void put(long key, E value) { final long origKey = key; final long origKey = key; while (indexOfKey(key) >= 0) { int keyIndex = indexOfKey(key); if (keyIndex >= 0) { final long sz = size(); while (keyIndex < sz && keyAt(keyIndex) == key) { key++; key++; keyIndex++; } } if (origKey != key) { if (key >= origKey + 10) { Slog.w(TAG, "Value " + value + " supposed to be inserted at " + origKey Slog.w(TAG, "Value " + value + " supposed to be inserted at " + origKey + " displaced to " + key); + " displaced to " + key); } } } super.put(key, value); super.put(key, value); } } Loading