commit | 17d08f474c31fcb5f230121b3a34a1f48b7ae449 | [log] [tgz] |
---|---|---|
author | Rubin Xu <rubinxu@google.com> | Wed May 15 17:39:46 2019 +0100 |
committer | Rubin Xu <rubinxu@google.com> | Wed May 15 17:39:46 2019 +0100 |
tree | 7ee1bbb631f58e1de8030822ee809d6d0849582b | |
parent | 9ff409c7260f09a862ec64fb4a0c25e86bc14dc0 [diff] |
Do not compare ID when deduplicating SecurityEvent Two SecurityEvents should be considered identical as long as their event content equals, disregarding the id field. Test: manual Change-Id: I811f9a104ed3a0d9e02991aeb9e3653c5c02efc3 Fix: 132367517
diff --git a/core/java/android/app/admin/SecurityLog.java b/core/java/android/app/admin/SecurityLog.java index 19f4335..9727621 100644 --- a/core/java/android/app/admin/SecurityLog.java +++ b/core/java/android/app/admin/SecurityLog.java
@@ -636,6 +636,11 @@ public int hashCode() { return Objects.hash(mEvent, mId); } + + /** @hide */ + public boolean eventEquals(SecurityEvent other) { + return other != null && mEvent.equals(other.mEvent); + } } /** * Retrieve all security logs and return immediately.
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java index fb34913..1ab3b98 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java
@@ -349,7 +349,7 @@ lastPos++; } else { // Two events have the same timestamp, check if they are the same. - if (lastEvent.equals(curEvent)) { + if (lastEvent.eventEquals(curEvent)) { // Actual overlap, just skip the event. if (DEBUG) Slog.d(TAG, "Skipped dup event with timestamp: " + lastNanos); } else {