Merge "Refactored to ensure thread safety"
This commit is contained in:
committed by
Android (Google) Code Review
commit
dbab9ed622
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user