diff options
| author | Felipe Leme <felipeal@google.com> | 2016-06-30 16:09:13 -0700 |
|---|---|---|
| committer | Felipe Leme <felipeal@google.com> | 2016-06-30 23:19:08 +0000 |
| commit | 7709041c99a213af4209fba08f6cb5acc3387307 (patch) | |
| tree | 57fda8cc0664c67f55899c427b7c71b2c1e86b0f /core/java/android/util/ArraySet.java | |
| parent | 4b736ea56d5301381838c80b2333a05df1eb499e (diff) | |
Removed warning when objects are added on wrong order.
append() is used to optimized insertions in the array, but it must
preserve the order of the hashcode array; when it doesn't, it falls back
to append(), but it should not log a warning message
In particular, PendingIntentRecords might have different hashcodes
across different processes.
Fixes: 29912192
Change-Id: I0ab566249829ddb934fd51cf21399b68cb286bd5
Diffstat (limited to 'core/java/android/util/ArraySet.java')
| -rw-r--r-- | core/java/android/util/ArraySet.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/java/android/util/ArraySet.java b/core/java/android/util/ArraySet.java index d39e91fd98b2..1e765b62e131 100644 --- a/core/java/android/util/ArraySet.java +++ b/core/java/android/util/ArraySet.java @@ -402,11 +402,14 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { throw new IllegalStateException("Array is full"); } if (index > 0 && mHashes[index - 1] > hash) { - RuntimeException e = new RuntimeException("here"); - e.fillInStackTrace(); - Log.w(TAG, "New hash " + hash - + " is before end of array hash " + mHashes[index - 1] - + " at index " + index, e); + // Cannot optimize since it would break the sorted order - fallback to add() + if (DEBUG) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "New hash " + hash + + " is before end of array hash " + mHashes[index - 1] + + " at index " + index, e); + } add(value); return; } |
