From 1d254f2e75e146ff1fd2e019a296bf430a064041 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Fri, 20 Mar 2020 17:38:19 -0700 Subject: [PATCH] Correct debugging of accountsForUser binder cache Bug: 140788621 Replaced the default result comparison so that two results can be compared for value equality. This code is only exercised with VERIFY is set true in PropertyInvalidatedCache (this is a compile-time flag). Test: Created a special build that sets VERIFY to true; verified that the binder cache does not detect any inconsistent results. Further modified the build to generate inconsistencies; verified that the new code does, in fact, detect true inconsistencies. Change-Id: I48080cd3109b96159f711bd2d84a69530450c2c8 --- core/java/android/accounts/AccountManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index cee7cd145d5e6..a45c573ddc411 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -388,6 +388,16 @@ public class AccountManager { throw e.rethrowFromSystemServer(); } } + @Override + protected boolean debugCompareQueryResults(Account[] l, Account[] r) { + if (l == r) { + return true; + } else if (l == null || r == null) { + return false; + } else { + return Arrays.equals(l, r); + } + } }; /**