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

Commit 2d934c9c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix unnecessary sync waiting on Filter notifications" into main

parents e3882704 93145c5d
Loading
Loading
Loading
Loading
+25 −21
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.util.Log;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.NullPointerException;
import java.util.concurrent.Executor;

/**
@@ -270,15 +269,19 @@ public class Filter implements AutoCloseable {
        synchronized (mCallbackLock) {
            if (mCallback != null && mExecutor != null) {
                mExecutor.execute(() -> {
                    FilterCallback callback;
                    synchronized (mCallbackLock) {
                        if (mCallback != null) {
                            try {
                                mCallback.onFilterStatusChanged(this, status);
                        callback = mCallback;
                    }
                            catch (NullPointerException e) {
                    if (callback != null) {
                        try {
                            callback.onFilterStatusChanged(this, status);
                        } catch (NullPointerException e) {
                            Log.d(TAG, "catch exception:" + e);
                        }
                    }
                    if (callback != null) {
                        callback.onFilterStatusChanged(this, status);
                    }
                });
            }
@@ -289,12 +292,14 @@ public class Filter implements AutoCloseable {
        synchronized (mCallbackLock) {
            if (mCallback != null && mExecutor != null) {
                mExecutor.execute(() -> {
                    FilterCallback callback;
                    synchronized (mCallbackLock) {
                        if (mCallback != null) {
                            try {
                                mCallback.onFilterEvent(this, events);
                        callback = mCallback;
                    }
                            catch (NullPointerException e) {
                    if (callback != null) {
                        try {
                            callback.onFilterEvent(this, events);
                        } catch (NullPointerException e) {
                            Log.d(TAG, "catch exception:" + e);
                        }
                    } else {
@@ -304,7 +309,6 @@ public class Filter implements AutoCloseable {
                            }
                        }
                    }
                    }
                });
            } else {
                for (FilterEvent event : events) {