From f6cc492b520ff18a66179ee6a12d2d5ab5207f45 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 24 Mar 2022 14:49:29 +0100 Subject: [PATCH] remove any references and usage of OMS_IS_WORKING preferences --- .../main/java/foundation/e/drive/EdriveApplication.java | 8 -------- .../java/foundation/e/drive/services/ObserverService.java | 7 ------- .../java/foundation/e/drive/services/ResetService.java | 1 - .../e/drive/services/SynchronizationService.java | 5 +---- .../main/java/foundation/e/drive/utils/AppConstants.java | 6 ------ .../foundation/e/drive/services/AbstractServiceIT.java | 1 - 6 files changed, 1 insertion(+), 27 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/EdriveApplication.java b/app/src/main/java/foundation/e/drive/EdriveApplication.java index e36b5752..fcb1a0f8 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 943a15d7..cdcbe8d5 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 395e2acb..a9eb6e3f 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 43fd4861..aad49270 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 7506a525..4c3be31d 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 810a7640..27519cb0 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) -- GitLab