Commit 61a6b18e authored by narinder Rana's avatar narinder Rana
Browse files

stop OperationManagerService and relaunch it

parent 7e1ae97b
Pipeline #147554 passed with stage
in 1 minute and 22 seconds
......@@ -137,6 +137,12 @@ public class ObserverService extends Service implements OnRemoteOperationListene
//check OperationManagerService isn't working
if (prefs.getBoolean(AppConstants.KEY_OMS_IS_WORKING, false)) {
Log.w(TAG, "OperationManagerService is still performing some operation");
getApplicationContext().stopService(new Intent(getApplicationContext(), OperationManagerService.class));
startOperationManagerService();
return super.onStartCommand(intent, flags, startId);
}
......@@ -339,13 +345,10 @@ public class ObserverService extends Service implements OnRemoteOperationListene
//After everything has been scanned. Send Intent to OperationmanagerService with data in bundle
if (operationsForIntent != null && !operationsForIntent.isEmpty()) {
Intent OMSIntent = new Intent(this, OperationManagerService.class);
for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
}
OMSIntent.putExtra("account", mAccount);
startService(OMSIntent);
startOperationManagerService();
} else {
Log.w(TAG, "There is no file to sync.");
getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE)
......@@ -360,6 +363,16 @@ public class ObserverService extends Service implements OnRemoteOperationListene
}
}
private void startOperationManagerService() {
Intent OMSIntent = new Intent(this, OperationManagerService.class);
for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
}
OMSIntent.putExtra("account", mAccount);
startService(OMSIntent);
}
/**
* Method to get Id of SyncedFolder to scan
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment