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

Commit 85ba182a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not synchronize on IPCs and callbacks"

parents 7469bbce 175fc99c
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -61,12 +61,15 @@ public class DejankUtils {
                        || !isMainThread() || sTemporarilyIgnoreStrictMode) {
                    return null;
                }
            }

            try {
                String description = binder.getInterfaceDescriptor();
                synchronized (sLock) {
                    if (sWhitelistedFrameworkClasses.contains(description)) {
                        return null;
                    }
                }
            } catch (RemoteException e) {
                e.printStackTrace();
            }
@@ -74,7 +77,6 @@ public class DejankUtils {
            StrictMode.noteSlowCall("IPC detected on critical path: " + sBlockingIpcs.peek());
            return null;
        }
        }

        @Override
        public Object onTransactStarted(IBinder binder, int transactionCode) {
@@ -126,9 +128,11 @@ public class DejankUtils {
        if (STRICT_MODE_ENABLED && sBlockingIpcs.empty()) {
            synchronized (sLock) {
                sBlockingIpcs.push("detectBlockingIpcs");
            }
            try {
                runnable.run();
            } finally {
                synchronized (sLock) {
                    sBlockingIpcs.pop();
                }
            }
@@ -177,9 +181,11 @@ public class DejankUtils {
        if (STRICT_MODE_ENABLED && !sTemporarilyIgnoreStrictMode) {
            synchronized (sLock) {
                sTemporarilyIgnoreStrictMode = true;
            }
            try {
                runnable.run();
            } finally {
                synchronized (sLock) {
                    sTemporarilyIgnoreStrictMode = false;
                }
            }
@@ -196,14 +202,16 @@ public class DejankUtils {
        if (STRICT_MODE_ENABLED && !sTemporarilyIgnoreStrictMode) {
            synchronized (sLock) {
                sTemporarilyIgnoreStrictMode = true;
            }
            final T val;
            try {
                val = supplier.get();
            } finally {
                synchronized (sLock) {
                    sTemporarilyIgnoreStrictMode = false;
                }
                return val;
            }
            return val;
        } else {
            return supplier.get();
        }