Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c960e2e authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Modify PropertyInvalidatedCache debugging"

parents 17be5953 a316900c
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -296,12 +296,14 @@ public abstract class PropertyInvalidatedCache<Query, Result> {
        for (;;) {
            if (currentNonce == NONCE_DISABLED || currentNonce == NONCE_UNSET) {
                if (DEBUG) {
                    Log.d(TAG,
                            String.format("cache %s %s for %s",
                    if (!mDisabled) {
                        Log.d(TAG, String.format(
                            "cache %s %s for %s",
                            cacheName(),
                            currentNonce == NONCE_DISABLED ? "disabled" : "unset",
                            queryToString(query)));
                    }
                }
                return recompute(query);
            }
            final Result cachedResult;
@@ -450,8 +452,12 @@ public abstract class PropertyInvalidatedCache<Query, Result> {
            Result resultToCompare = recompute(query);
            boolean nonceChanged = (getCurrentNonce() != mLastSeenNonce);
            if (!nonceChanged && !debugCompareQueryResults(proposedResult, resultToCompare)) {
                throw new AssertionError("cache returned out of date response for " + query);
                Log.e(TAG, String.format(
                    "cache %s inconsistent for %s",
                    cacheName(), queryToString(query)));
            }
            // Always return the "true" result in verification mode.
            return resultToCompare;
        }
        return proposedResult;
    }