Commit ca038a23 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

Fix issue 64 and 65 for nougat

parent 0f4b60c3
Pipeline #16741 passed with stage
in 2 minutes and 24 seconds
......@@ -130,7 +130,7 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
*/
private synchronized void startWork( int threadIndex ){
Log.i(TAG, "startWork("+threadIndex+")" );
if( !mThreadWorkingState[threadIndex] || CommonUtils.haveNetworkConnexion( getApplicationContext() ) ) { //check if the thread corresponding to threadIndex isn't already working
if( !mThreadWorkingState[threadIndex] && CommonUtils.haveNetworkConnexion( getApplicationContext() ) ) { //check if the thread corresponding to threadIndex isn't already working
ComparableOperation operation = this.mOperationsQueue.poll(); //return null if deque is empty
if (operation != null) {
......@@ -152,18 +152,6 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
} //else : thread is already running or no network connexion
}
/**
* Tell if there is at least one thread which can get new task to do
* @return boolean true if there is a free thread place else return false
*/
private boolean isThereAFreeThread(){
for(int i =-1; ++i < workerAmount;){
if( !mThreadWorkingState[i] )
return true;
}
return false;
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
......@@ -326,7 +314,7 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
}
mOperationsQueue.add(operation);
Log.d(TAG, "OperationQueue: "+mOperationsQueue.size());
if( isThereAFreeThread() ) startAllThreads();
startAllThreads();
}
/**
......
Supports Markdown
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