Loading app/src/main/java/foundation/e/drive/EdriveApplication.java +1 −9 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import android.util.Log; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; /** * Class representing the eDrive application. Loading @@ -36,7 +35,7 @@ public class EdriveApplication extends Application { SharedPreferences prefs = getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); if (prefs.getString(AccountManager.KEY_ACCOUNT_NAME, null) != null) { scheduleScannerJob(); Log.d(TAG, "Account already registered"); } else { Account mAccount = CommonUtils.getAccount(getString(R.string.eelo_account_type), AccountManager.get(this)); if (mAccount != null) { Loading @@ -47,17 +46,10 @@ public class EdriveApplication extends Application { .putString(AccountManager.KEY_ACCOUNT_TYPE, accountType) .apply(); scheduleScannerJob(); } } } private void scheduleScannerJob() { if (!JobUtils.isScannerJobRegistered(this)) { JobUtils.scheduleScannerJob(this); } } private void resetOperationManagerSetting() { getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit() .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false) Loading app/src/main/java/foundation/e/drive/receivers/BatteryStateReceiver.java +1 −3 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import foundation.e.drive.utils.JobUtils; /** * @author Vincent Bourgmayer Loading @@ -28,9 +27,8 @@ public class BatteryStateReceiver extends BroadcastReceiver { if(intentAction == null) { Log.e(TAG, "intent Action is null"); } else if ( intentAction.equals(Intent.ACTION_BATTERY_OKAY) ) { JobUtils.scheduleScannerJob(context); Log.d(TAG, "BATTERY is Okay. Synchronization job isn't reschedule anymore. Expected behaviour"); }else if(intentAction.equals(Intent.ACTION_BATTERY_LOW)){ JobUtils.stopScheduledJob(context, JobUtils.ScannerJobId); try { context.unregisterReceiver(ScreenOffReceiver.getInstance()); }catch(Exception e){ Loading app/src/main/java/foundation/e/drive/services/InitializerService.java +1 −4 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import foundation.e.drive.operations.CreateInitialFolderRemoteOperation; import foundation.e.drive.receivers.ScreenOffReceiver; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; import foundation.e.drive.utils.ServiceExceptionHandler; import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR; Loading Loading @@ -75,7 +74,6 @@ public class InitializerService extends Service implements OnRemoteOperationList SharedPreferences prefs = this.getSharedPreferences( AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE ); if( prefs.getBoolean( AppConstants.INITIALIZATION_HAS_BEEN_DONE, false ) ) { JobUtils.scheduleScannerJob(this); Log.w(TAG, "Initializer has already been run"); }else{ String accountName = prefs.getString( AccountManager.KEY_ACCOUNT_NAME, "" ); Loading Loading @@ -285,8 +283,7 @@ public class InitializerService extends Service implements OnRemoteOperationList .apply(); //all folder have been created //JobUtils.stopScheduledJob(appContext, JobUtils.InitializerJobId); JobUtils.scheduleScannerJob(appContext); Log.d(TAG, "RegisterReceiver: screenOffReceiver"); IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); Loading app/src/main/java/foundation/e/drive/services/ObserverService.java +0 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import foundation.e.drive.receivers.ForceSyncReceiver; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.JobUtils; import foundation.e.drive.utils.ServiceExceptionHandler; import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR; Loading Loading @@ -95,7 +94,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene // Check if account is invalid if(this.mAccount == null){ Log.w(TAG, "No account registered"); JobUtils.stopScheduledJob(this, JobUtils.ScannerJobId); //If no account return super.onStartCommand(intent, flags, startId); } Loading app/src/main/java/foundation/e/drive/services/ResetService.java +1 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import java.io.File; import foundation.e.drive.database.DbHelper; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; import static foundation.e.drive.utils.AppConstants.INITIALFOLDERS_NUMBER; import static foundation.e.drive.utils.AppConstants.INITIALIZATION_HAS_BEEN_DONE; Loading Loading @@ -64,9 +63,7 @@ public class ResetService extends Service { result = getApplicationContext().stopService( stopperIntent ); Log.d(TAG, "stop OperationManagerService: "+result); //2. Stop the scheduledJob JobUtils.stopScheduledJob(this, JobUtils.ScannerJobId); //JobUtils.stopScheduledJob(this, JobUtils.InitializerJobId); //3. delete DB result = this.deleteDatabase(DbHelper.DATABASE_NAME); Log.d(TAG, "Remove Database: "+result); Loading Loading
app/src/main/java/foundation/e/drive/EdriveApplication.java +1 −9 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import android.util.Log; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; /** * Class representing the eDrive application. Loading @@ -36,7 +35,7 @@ public class EdriveApplication extends Application { SharedPreferences prefs = getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); if (prefs.getString(AccountManager.KEY_ACCOUNT_NAME, null) != null) { scheduleScannerJob(); Log.d(TAG, "Account already registered"); } else { Account mAccount = CommonUtils.getAccount(getString(R.string.eelo_account_type), AccountManager.get(this)); if (mAccount != null) { Loading @@ -47,17 +46,10 @@ public class EdriveApplication extends Application { .putString(AccountManager.KEY_ACCOUNT_TYPE, accountType) .apply(); scheduleScannerJob(); } } } private void scheduleScannerJob() { if (!JobUtils.isScannerJobRegistered(this)) { JobUtils.scheduleScannerJob(this); } } private void resetOperationManagerSetting() { getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit() .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false) Loading
app/src/main/java/foundation/e/drive/receivers/BatteryStateReceiver.java +1 −3 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import foundation.e.drive.utils.JobUtils; /** * @author Vincent Bourgmayer Loading @@ -28,9 +27,8 @@ public class BatteryStateReceiver extends BroadcastReceiver { if(intentAction == null) { Log.e(TAG, "intent Action is null"); } else if ( intentAction.equals(Intent.ACTION_BATTERY_OKAY) ) { JobUtils.scheduleScannerJob(context); Log.d(TAG, "BATTERY is Okay. Synchronization job isn't reschedule anymore. Expected behaviour"); }else if(intentAction.equals(Intent.ACTION_BATTERY_LOW)){ JobUtils.stopScheduledJob(context, JobUtils.ScannerJobId); try { context.unregisterReceiver(ScreenOffReceiver.getInstance()); }catch(Exception e){ Loading
app/src/main/java/foundation/e/drive/services/InitializerService.java +1 −4 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import foundation.e.drive.operations.CreateInitialFolderRemoteOperation; import foundation.e.drive.receivers.ScreenOffReceiver; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; import foundation.e.drive.utils.ServiceExceptionHandler; import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR; Loading Loading @@ -75,7 +74,6 @@ public class InitializerService extends Service implements OnRemoteOperationList SharedPreferences prefs = this.getSharedPreferences( AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE ); if( prefs.getBoolean( AppConstants.INITIALIZATION_HAS_BEEN_DONE, false ) ) { JobUtils.scheduleScannerJob(this); Log.w(TAG, "Initializer has already been run"); }else{ String accountName = prefs.getString( AccountManager.KEY_ACCOUNT_NAME, "" ); Loading Loading @@ -285,8 +283,7 @@ public class InitializerService extends Service implements OnRemoteOperationList .apply(); //all folder have been created //JobUtils.stopScheduledJob(appContext, JobUtils.InitializerJobId); JobUtils.scheduleScannerJob(appContext); Log.d(TAG, "RegisterReceiver: screenOffReceiver"); IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); Loading
app/src/main/java/foundation/e/drive/services/ObserverService.java +0 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import foundation.e.drive.receivers.ForceSyncReceiver; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.JobUtils; import foundation.e.drive.utils.ServiceExceptionHandler; import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR; Loading Loading @@ -95,7 +94,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene // Check if account is invalid if(this.mAccount == null){ Log.w(TAG, "No account registered"); JobUtils.stopScheduledJob(this, JobUtils.ScannerJobId); //If no account return super.onStartCommand(intent, flags, startId); } Loading
app/src/main/java/foundation/e/drive/services/ResetService.java +1 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import java.io.File; import foundation.e.drive.database.DbHelper; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; import foundation.e.drive.utils.JobUtils; import static foundation.e.drive.utils.AppConstants.INITIALFOLDERS_NUMBER; import static foundation.e.drive.utils.AppConstants.INITIALIZATION_HAS_BEEN_DONE; Loading Loading @@ -64,9 +63,7 @@ public class ResetService extends Service { result = getApplicationContext().stopService( stopperIntent ); Log.d(TAG, "stop OperationManagerService: "+result); //2. Stop the scheduledJob JobUtils.stopScheduledJob(this, JobUtils.ScannerJobId); //JobUtils.stopScheduledJob(this, JobUtils.InitializerJobId); //3. delete DB result = this.deleteDatabase(DbHelper.DATABASE_NAME); Log.d(TAG, "Remove Database: "+result); Loading