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

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

Merge "Refactor to ensure thread safety"

parents cf52e1a2 a6861d86
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -84,18 +84,18 @@ public class MyContentCaptureService extends ContentCaptureService {

    @Override
    public void onDisconnected() {
        Log.i(TAG, "onDisconnected: sServiceWatcher=" + sServiceWatcher);

        if (sServiceWatcher == null) {
        final ServiceWatcher sw = sServiceWatcher;
        Log.i(TAG, "onDisconnected: sServiceWatcher=" + sw);
        if (sw == null) {
            Log.e(TAG, "onDisconnected() without a watcher");
            return;
        }
        if (sServiceWatcher.mService == null) {
            Log.e(TAG, "onDisconnected(): no service on " + sServiceWatcher);
        if (sw.mService == null) {
            Log.e(TAG, "onDisconnected(): no service on " + sw);
            return;
        }

        sServiceWatcher.mDestroyed.countDown();
        sw.mDestroyed.countDown();
        clearServiceWatcher();
    }