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

fix generation of multiple file

parent 55960ca1
...@@ -66,8 +66,11 @@ public class InitializerService extends Service implements OnRemoteOperationList ...@@ -66,8 +66,11 @@ public class InitializerService extends Service implements OnRemoteOperationList
public int onStartCommand( Intent intent, int flags, int startId ) { public int onStartCommand( Intent intent, int flags, int startId ) {
Log.i(TAG, "onStartCommand(...)"); Log.i(TAG, "onStartCommand(...)");
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this)); if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){
Log.d("ObserverService", "ServiceExceptionHandler already set!");
}else{
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this));
}
//Get account //Get account
SharedPreferences prefs = this.getSharedPreferences( AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE ); SharedPreferences prefs = this.getSharedPreferences( AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE );
......
...@@ -80,8 +80,11 @@ public class ObserverService extends Service implements OnRemoteOperationListene ...@@ -80,8 +80,11 @@ public class ObserverService extends Service implements OnRemoteOperationListene
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "onStartCommand("+startId+")"); Log.i(TAG, "onStartCommand("+startId+")");
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this)); if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){
Log.d("ObserverService", "ServiceExceptionHandler already set!");
}else{
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this));
}
SharedPreferences prefs = this.getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); SharedPreferences prefs = this.getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
String accountName = prefs.getString(AccountManager.KEY_ACCOUNT_NAME, ""); String accountName = prefs.getString(AccountManager.KEY_ACCOUNT_NAME, "");
String accountType = prefs.getString(AccountManager.KEY_ACCOUNT_TYPE, ""); String accountType = prefs.getString(AccountManager.KEY_ACCOUNT_TYPE, "");
...@@ -142,7 +145,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene ...@@ -142,7 +145,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
return super.onStartCommand( intent, flags, startId ); return super.onStartCommand( intent, flags, startId );
} }
/* Common methods */ //Common methods
/** /**
* Start to bind this service to OperationManagerService or start scan if binding is already set. * Start to bind this service to OperationManagerService or start scan if binding is already set.
* Method to factorise code that is called from different place * Method to factorise code that is called from different place
...@@ -198,7 +201,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene ...@@ -198,7 +201,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene
} }
Log.d(TAG, logFolderList.toString()); Log.d(TAG, logFolderList.toString());
if (remote) { if (remote) {
OwnCloudClient client = DavClientProvider.getInstance().getClientInstance(mAccount, getApplicationContext()); OwnCloudClient client = DavClientProvider.getInstance().getClientInstance(mAccount, getApplicationContext());
if (client != null) { if (client != null) {
...@@ -246,6 +248,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene ...@@ -246,6 +248,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
@Override @Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result ) { public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result ) {
Log.i( TAG, "onRemoteOperationFinish()" ); Log.i( TAG, "onRemoteOperationFinish()" );
if( operation instanceof ListFileRemoteOperation){ if( operation instanceof ListFileRemoteOperation){
if( result.isSuccess() ){ if( result.isSuccess() ){
List<Object> resultDatas = result.getData(); List<Object> resultDatas = result.getData();
......
...@@ -13,13 +13,11 @@ import android.app.PendingIntent; ...@@ -13,13 +13,11 @@ import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Message; import android.os.Message;
import android.os.Parcelable; import android.os.Parcelable;
import android.preference.Preference;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.OwnCloudClient;
...@@ -27,7 +25,6 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; ...@@ -27,7 +25,6 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import org.apache.commons.httpclient.util.DateUtil;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Hashtable; import java.util.Hashtable;
...@@ -61,16 +58,6 @@ public class OperationManagerService extends Service implements OnRemoteOperatio ...@@ -61,16 +58,6 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
@Override @Override
public void onDestroy() { public void onDestroy() {
Log.i(TAG, "onDestroy()"); Log.i(TAG, "onDestroy()");
/*this.mOperationsQueue.clear();
for(int i =-1, size = mThreadPool.length;++i < size;){
try{
if(mThreadPool[i] != null)
mThreadPool[i].interrupt();}
catch(Exception e){
Log.e(TAG, e.toString());
}
}*/
super.onDestroy(); super.onDestroy();
} }
...@@ -240,8 +227,11 @@ public class OperationManagerService extends Service implements OnRemoteOperatio ...@@ -240,8 +227,11 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "onStartCommand()"); Log.i(TAG, "onStartCommand()");
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this)); if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){
Log.d("ObserverService", "ServiceExceptionHandler already set!");
}else{
Thread.setDefaultUncaughtExceptionHandler(new ServiceExceptionHandler(this));
}
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
Log.d(TAG, "OperationManagerService recieved "+(extras == null ? "null extras": extras.size()+" operations to perform") ); Log.d(TAG, "OperationManagerService recieved "+(extras == null ? "null extras": extras.size()+" operations to perform") );
......
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