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

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

Merge "Refactored to ensure thread safety"

parents 182cd692 b546aadd
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -51,13 +51,14 @@ public class MyContentCaptureService extends ContentCaptureService {
        sServiceWatcher = null;
    }

    public static void clearServiceWatcher() {
        if (sServiceWatcher != null) {
            if (sServiceWatcher.mReadyToClear) {
                sServiceWatcher.mService = null;
    private static void clearServiceWatcher() {
        final ServiceWatcher sw = sServiceWatcher;
        if (sw != null) {
            if (sw.mReadyToClear) {
                sw.mService = null;
                sServiceWatcher = null;
            } else {
                sServiceWatcher.mReadyToClear = true;
                sw.mReadyToClear = true;
            }
        }
    }