Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d97332a2 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge branch 'e1-i73-removeOMSisWorkingfromPreferences' into '1-epic-refactoring-p1'

remove any references and usage of OMS_IS_WORKING preferences

See merge request !96
parents f8e1ea16 f6cc492b
Loading
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -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
     */
+0 −7
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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();
        }
+1 −4
Original line number Diff line number Diff line
@@ -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){
+0 −6
Original line number Diff line number Diff line
@@ -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);
    }


}
Loading