mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-23 10:25:54 +00:00
Remove SyncthingService#mDestroyScheduled
This commit is contained in:
parent
a30163ea1e
commit
976d4e05c2
1 changed files with 2 additions and 29 deletions
|
@ -195,12 +195,6 @@ public class SyncthingService extends Service {
|
||||||
*/
|
*/
|
||||||
private boolean mLastDeterminedShouldRun = false;
|
private boolean mLastDeterminedShouldRun = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* True if a service {@link #onDestroy} was requested while syncthing is starting,
|
|
||||||
* in that case, perform stop in {@link #onApiAvailable}.
|
|
||||||
*/
|
|
||||||
private boolean mDestroyScheduled = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the user granted the storage permission.
|
* True if the user granted the storage permission.
|
||||||
*/
|
*/
|
||||||
|
@ -594,17 +588,6 @@ public class SyncthingService extends Service {
|
||||||
mRestApi.applyCustomRunConditions(mRunConditionMonitor);
|
mRestApi.applyCustomRunConditions(mRunConditionMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If the service instance got an onDestroy() event while being in
|
|
||||||
* State.STARTING we'll trigger the service onDestroy() now. this
|
|
||||||
* allows the syncthing binary to get gracefully stopped.
|
|
||||||
*/
|
|
||||||
if (mDestroyScheduled) {
|
|
||||||
mDestroyScheduled = false;
|
|
||||||
stopSelf();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mEventProcessor == null) {
|
if (mEventProcessor == null) {
|
||||||
mEventProcessor = new EventProcessor(SyncthingService.this, mRestApi);
|
mEventProcessor = new EventProcessor(SyncthingService.this, mRestApi);
|
||||||
mEventProcessor.start();
|
mEventProcessor.start();
|
||||||
|
@ -633,22 +616,12 @@ public class SyncthingService extends Service {
|
||||||
if (mNotificationHandler != null) {
|
if (mNotificationHandler != null) {
|
||||||
mNotificationHandler.setAppShutdownInProgress(true);
|
mNotificationHandler.setAppShutdownInProgress(true);
|
||||||
}
|
}
|
||||||
if (mStoragePermissionGranted) {
|
if (!mStoragePermissionGranted) {
|
||||||
synchronized (mStateLock) {
|
|
||||||
if (mCurrentState == State.STARTING) {
|
|
||||||
Log.i(TAG, "Delay shutting down syncthing binary until initialisation finished");
|
|
||||||
mDestroyScheduled = true;
|
|
||||||
} else {
|
|
||||||
Log.i(TAG, "Shutting down syncthing binary immediately");
|
|
||||||
shutdown(State.DISABLED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If the storage permission got revoked, we did not start the binary and
|
// If the storage permission got revoked, we did not start the binary and
|
||||||
// are in State.INIT requiring an immediate shutdown of this service class.
|
// are in State.INIT requiring an immediate shutdown of this service class.
|
||||||
Log.i(TAG, "Shutting down syncthing binary due to missing storage permission.");
|
Log.i(TAG, "Shutting down syncthing binary due to missing storage permission.");
|
||||||
shutdown(State.DISABLED);
|
|
||||||
}
|
}
|
||||||
|
shutdown(State.DISABLED);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue