Fixed cancelling quit

pull/177/head
M66B 5 years ago
parent 0859a88ee4
commit 206d6e353c

@ -382,19 +382,20 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
} }
private void quit(final Integer startId) { private void quit(final Integer startId) {
if (startId != null && lastOperations > 0)
return;
if (lastQuitId != null && lastQuitId.equals(startId)) if (lastQuitId != null && lastQuitId.equals(startId))
return; return;
lastQuitId = startId; lastQuitId = startId;
EntityLog.log(ServiceSynchronize.this, EntityLog.log(ServiceSynchronize.this, "Service quit startId=" + startId);
"Service quit startId=" + startId + " ops=" + lastOperations);
queue.submit(new Runnable() { queue.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
Log.i("### quit startId=" + startId + "/" + lastQuitId + " ops=" + lastOperations); Log.i("### quit startId=" + startId);
if (lastOperations != 0)
return;
if (startId == null) { if (startId == null) {
// Service destroy // Service destroy
@ -411,9 +412,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
} }
// Stop service // Stop service
boolean stopped = (lastOperations == 0 && stopSelfResult(startId)); boolean stopped = stopSelfResult(startId);
EntityLog.log(ServiceSynchronize.this, "Service quited=" + stopped + EntityLog.log(ServiceSynchronize.this,
" startId=" + startId + "/" + lastQuitId + " ops=" + lastOperations); "Service quited=" + stopped + " startId=" + startId);
} }
} }
}); });

Loading…
Cancel
Save