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

Commit 05063d8a authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Android (Google) Code Review
Browse files

Merge "StrictMode fingerprinting / hashCode improvements."

parents 39154dfb f3d86be6
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -987,7 +987,7 @@ public final class StrictMode {
            }

            // Not perfect, but fast and good enough for dup suppression.
            Integer crashFingerprint = info.crashInfo.stackTrace.hashCode();
            Integer crashFingerprint = info.hashCode();
            long lastViolationTime = 0;
            if (mLastViolationTime.containsKey(crashFingerprint)) {
                lastViolationTime = mLastViolationTime.get(crashFingerprint);
@@ -1550,6 +1550,24 @@ public final class StrictMode {
            }
        }

        @Override
        public int hashCode() {
            int result = 17;
            result = 37 * result + crashInfo.stackTrace.hashCode();
            if (numAnimationsRunning != 0) {
                result *= 37;
            }
            if (broadcastIntentAction != null) {
                result = 37 * result + broadcastIntentAction.hashCode();
            }
            if (tags != null) {
                for (String tag : tags) {
                    result = 37 * result + tag.hashCode();
                }
            }
            return result;
        }

        /**
         * Create an instance of ViolationInfo initialized from a Parcel.
         */
+2 −2
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            = new HashMap<PendingIntentRecord.Key, WeakReference<PendingIntentRecord>>();
    /**
     * Fingerprints (String.hashCode()) of stack traces that we've
     * Fingerprints (hashCode()) of stack traces that we've
     * already logged DropBox entries for.  Guarded by itself.  If
     * something (rogue user app) forces this over
     * MAX_DUP_SUPPRESSED_STACKS entries, the contents are cleared.
@@ -6671,7 +6671,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        ProcessRecord r = findAppProcess(app);
        if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
            Integer stackFingerprint = info.crashInfo.stackTrace.hashCode();
            Integer stackFingerprint = info.hashCode();
            boolean logIt = true;
            synchronized (mAlreadyLoggedViolatedStacks) {
                if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {