diff --git a/app/src/main/java/foundation/e/drive/EdriveApplication.java b/app/src/main/java/foundation/e/drive/EdriveApplication.java index e36b57528dcb30de291936473c4e7b321beab0a0..fcb1a0f8627d968ae1361904069c5ac8f1aa2750 100644 --- a/app/src/main/java/foundation/e/drive/EdriveApplication.java +++ b/app/src/main/java/foundation/e/drive/EdriveApplication.java @@ -38,7 +38,6 @@ public class EdriveApplication extends Application { super.onCreate(); fileEventListener = new FileEventListener(getApplicationContext()); Log.i(TAG, "Starting"); - resetOperationManagerSetting(); final String pathForObserver = Environment.getExternalStorageDirectory().getAbsolutePath(); mFileObserver = new RecursiveFileObserver(getApplicationContext(), pathForObserver, fileEventListener); @@ -65,13 +64,6 @@ public class EdriveApplication extends Application { } } - private void resetOperationManagerSetting() { - getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit() - .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false) - .apply(); - } - - /** * Start Recursive FileObserver if not already watching */ diff --git a/app/src/main/java/foundation/e/drive/services/ObserverService.java b/app/src/main/java/foundation/e/drive/services/ObserverService.java index 943a15d77ec52b72454e4aac6c1b55c68bbac6e5..cdcbe8d5cfe031ae976a6001157fa5a20ef1174e 100644 --- a/app/src/main/java/foundation/e/drive/services/ObserverService.java +++ b/app/src/main/java/foundation/e/drive/services/ObserverService.java @@ -121,12 +121,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene return super.onStartCommand(intent,flags,startId); } - //check OperationManagerService isn't working - if (prefs.getBoolean(AppConstants.KEY_OMS_IS_WORKING, false)){ - Log.w(TAG, "OperationManagerService is still performing some operation"); - return super.onStartCommand(intent,flags, startId); - } - //Check a minimum delay has been respected between two start. long lastSyncTime = prefs.getLong(AppConstants.KEY_LAST_SYNC_TIME, 0L); long currentTime = System.currentTimeMillis(); @@ -310,7 +304,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE) .edit() .putLong(AppConstants.KEY_LAST_SYNC_TIME, System.currentTimeMillis()) - .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false) .apply(); } this.isWorking = false; diff --git a/app/src/main/java/foundation/e/drive/services/ResetService.java b/app/src/main/java/foundation/e/drive/services/ResetService.java index 395e2acb43dc7291bb47a4136710ffaa325d62f2..a9eb6e3ff6fb8576616b08cdb4bd83c226019077 100644 --- a/app/src/main/java/foundation/e/drive/services/ResetService.java +++ b/app/src/main/java/foundation/e/drive/services/ResetService.java @@ -89,7 +89,6 @@ public class ResetService extends Service { .remove(AccountManager.KEY_ACCOUNT_TYPE) .putBoolean(INITIALIZATION_HAS_BEEN_DONE, false) .remove(INITIALFOLDERS_NUMBER) - .remove(AppConstants.KEY_OMS_IS_WORKING) .remove(AppConstants.KEY_LAST_SYNC_TIME) .apply(); } diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index 43fd4861298503da2a156575433a6b7ef315e05f..aad4927034c9ef4244deefb11fe0ad1ade18f041 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -95,10 +95,7 @@ public class SynchronizationService extends Service implements OnRemoteOperation @Override public void onLowMemory() { - Log.w(TAG, "System is low on memory. Service might get killed. Setting KEY_OMS_IS_WORKING to false"); - getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit() - .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false) - .apply(); + Log.w(TAG, "System is low on memory. Service might get killed."); } public boolean queueOperation(SyncRequest request){ diff --git a/app/src/main/java/foundation/e/drive/utils/AppConstants.java b/app/src/main/java/foundation/e/drive/utils/AppConstants.java index 7506a525ee466e117113fcc3f5e778712f6ba2d7..4c3be31dfbda204e1c01852ba2cbcf0799c0b767 100644 --- a/app/src/main/java/foundation/e/drive/utils/AppConstants.java +++ b/app/src/main/java/foundation/e/drive/utils/AppConstants.java @@ -8,7 +8,6 @@ package foundation.e.drive.utils; - import android.os.Build; import foundation.e.drive.BuildConfig; @@ -17,11 +16,9 @@ import java.util.Locale; import foundation.e.drive.BuildConfig; - /** * @author Vincent Bourgmayer */ -//Contains some constant value public abstract class AppConstants { public static final String MEDIASYNC_PROVIDER_AUTHORITY ="foundation.e.drive.providers.MediasSyncProvider"; @@ -33,7 +30,6 @@ public abstract class AppConstants { public static final String APPLICATIONS_LIST_FILE_NAME_TMP = "tmp_packages_list.csv"; public static final String SHARED_PREFERENCE_NAME ="preferences"; public static final String KEY_LAST_SYNC_TIME = "lastSyncTimestamp"; - public static final String KEY_OMS_IS_WORKING = "OMS_is_working"; public static final String[] MEDIA_SYNCABLE_CATEGORIES = new String[]{"Images", "Movies", "Music", "Ringtones", "Documents", "Podcasts"}; public static final String[] SETTINGS_SYNCABLE_CATEGORIES = new String[] {"Rom settings"}; @@ -53,6 +49,4 @@ public abstract class AppConstants { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); return sdf.format(ts); } - - } diff --git a/app/src/test/java/foundation/e/drive/services/AbstractServiceIT.java b/app/src/test/java/foundation/e/drive/services/AbstractServiceIT.java index 810a7640c7ffd828cc734fa02aab028dddfa6079..27519cb0b452a4d3b71ea3ee59a324c230455f43 100644 --- a/app/src/test/java/foundation/e/drive/services/AbstractServiceIT.java +++ b/app/src/test/java/foundation/e/drive/services/AbstractServiceIT.java @@ -111,7 +111,6 @@ public abstract class AbstractServiceIT { */ protected void registerSharedPref(){ sharedPreferences.edit().putBoolean( AppConstants.INITIALIZATION_HAS_BEEN_DONE, init_done) - .putBoolean(AppConstants.KEY_OMS_IS_WORKING, oms_running) .putString(AccountManager.KEY_ACCOUNT_NAME, TEST_ACCOUNT_NAME) .putString(AccountManager.KEY_ACCOUNT_TYPE, TEST_ACCOUNT_TYPE) .putInt(AppConstants.INITIALFOLDERS_NUMBER, initial_folder_number)