Commit 1f10d3ff authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

use method from commonUtils to set the UEH

parent dbcfd22f
Pipeline #33939 passed with stage
in 2 minutes and 28 seconds
...@@ -66,11 +66,7 @@ public class InitializerService extends Service implements OnRemoteOperationList ...@@ -66,11 +66,7 @@ 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(...)");
if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){ CommonUtils.setServiceUnCaughtExceptionHandler(this);
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,11 +80,8 @@ public class ObserverService extends Service implements OnRemoteOperationListene ...@@ -80,11 +80,8 @@ 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+")");
if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){ CommonUtils.setServiceUnCaughtExceptionHandler(this);
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, "");
......
...@@ -227,11 +227,9 @@ public class OperationManagerService extends Service implements OnRemoteOperatio ...@@ -227,11 +227,9 @@ 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()");
if(Thread.getDefaultUncaughtExceptionHandler().getClass().getSimpleName().equals(ServiceExceptionHandler.class.getSimpleName())){
Log.d("ObserverService", "ServiceExceptionHandler already set!"); CommonUtils.setServiceUnCaughtExceptionHandler(this);
}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") );
...@@ -284,11 +282,9 @@ public class OperationManagerService extends Service implements OnRemoteOperatio ...@@ -284,11 +282,9 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
}else{ }else{
Log.w(TAG, "Intent's extras is null."); Log.w(TAG, "Intent's extras is null.");
} }
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} }
@Nullable @Nullable
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
......
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