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

Commit e4d06ae4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "StrictMode: fix race condition in onVmPolicyViolation" into main am:...

Merge "StrictMode: fix race condition in onVmPolicyViolation" into main am: c49b89ef am: 4569f000 am: b0e0c87d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2796661



Change-Id: Ib7138a78bff8d72e29c2fedd6464cd6799ca2ba1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b47e56c2 b0e0c87d
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -2435,11 +2435,12 @@ public final class StrictMode {

    /** @hide */
    public static void onVmPolicyViolation(Violation violation, boolean forceDeath) {
        final boolean penaltyDropbox = (sVmPolicy.mask & PENALTY_DROPBOX) != 0;
        final boolean penaltyDeath = ((sVmPolicy.mask & PENALTY_DEATH) != 0) || forceDeath;
        final boolean penaltyLog = (sVmPolicy.mask & PENALTY_LOG) != 0;
        final VmPolicy vmPolicy = getVmPolicy();
        final boolean penaltyDropbox = (vmPolicy.mask & PENALTY_DROPBOX) != 0;
        final boolean penaltyDeath = ((vmPolicy.mask & PENALTY_DEATH) != 0) || forceDeath;
        final boolean penaltyLog = (vmPolicy.mask & PENALTY_LOG) != 0;

        final int penaltyMask = (sVmPolicy.mask & PENALTY_ALL);
        final int penaltyMask = (vmPolicy.mask & PENALTY_ALL);
        final ViolationInfo info = new ViolationInfo(violation, penaltyMask);

        // Erase stuff not relevant for process-wide violations
@@ -2492,10 +2493,10 @@ public final class StrictMode {

        // If penaltyDeath, we can't guarantee this callback finishes before the process dies for
        // all executors. penaltyDeath supersedes penaltyCallback.
        if (sVmPolicy.mListener != null && sVmPolicy.mCallbackExecutor != null) {
            final OnVmViolationListener listener = sVmPolicy.mListener;
        if (vmPolicy.mListener != null && vmPolicy.mCallbackExecutor != null) {
            final OnVmViolationListener listener = vmPolicy.mListener;
            try {
                sVmPolicy.mCallbackExecutor.execute(
                vmPolicy.mCallbackExecutor.execute(
                        () -> {
                            // Lift violated policy to prevent infinite recursion.
                            VmPolicy oldPolicy = allowVmViolations();