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

Commit 4c6243db authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

implement new process for ObserverService

parent 04377086
Loading
Loading
Loading
Loading
Loading

android-nc-lib @ 7e1c148e

Original line number Diff line number Diff line
Subproject commit b3eeceed4088c3daca5a98a24d808c8ddba69a7b
Subproject commit 7e1c148eea56ba0b078d41e08002de4cf7d2e084
+9 −2
Original line number Diff line number Diff line
@@ -56,9 +56,16 @@ http://www.gnu.org/licenses/gpl.html
        <service android:name=".jobs.ScannerJob"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <service android:name=".services.ObserverService"
            android:enabled="true"
            android:exported="true">
            android:enabled="true">
        </service>


        <service android:name=".services.ObserverServiceV2"
            android:enabled="true">
        </service>



        <service android:name=".services.OperationManagerService"/>
        <receiver android:name=".receivers.BatteryStateReceiver" android:enabled="true">
            <intent-filter>
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import android.util.Log;

import io.eelo.drive.receivers.ScreenOffReceiver;
import io.eelo.drive.services.ObserverService;
import io.eelo.drive.services.ObserverServiceV2;
import io.eelo.drive.utils.CommonUtils;

/**
@@ -33,7 +34,7 @@ public class ScannerJob extends JobService {
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        getApplicationContext().registerReceiver(ScreenOffReceiver.getInstance(), filter);

        Intent observerServiceIntent = new Intent(this, ObserverService.class);
        Intent observerServiceIntent = new Intent(this, ObserverServiceV2.class);
        this.startService(observerServiceIntent);
        jobFinished(params, false);
        return true;
+26 −3
Original line number Diff line number Diff line
@@ -3,20 +3,43 @@ package io.eelo.drive.models;
import com.owncloud.android.lib.resources.files.model.ISynchronizableContent;

public class Operation{
    public final static int OPERATION_DOWNLOAD =0;
    public final static int OPERATION_UPLOAD = 1;
    public final static int OPERATION_REMOVE_REMOTE = 2;
    public final static int OPERATION_REMOVE_LOCAL = 3;
    public final static int OPERATION_MKCOL =4;
    public final static int OPERATION_CREATE_FOLDER_LOCAL = 5;


    private ISynchronizableContent file;
    private String operationCode;
    private int operationCode;
    private String resultHash;
    private boolean isSuccess;

    public Operation(ISynchronizableContent file, String operationCode){
    public Operation(ISynchronizableContent file, int operationCode){
        this.file = file;
        this.operationCode = operationCode;
        this.isSuccess = false;
    }

    public Operation(int operationCode, boolean isSuccess, String resultHash){
        this.operationCode = operationCode;
        this.isSuccess = isSuccess;
        this.resultHash = resultHash;
    }

    public ISynchronizableContent getFile(){
        return this.file;
    }

    public String getOperationCode(){
    public int getOperationCode(){
        return this.operationCode;
    }

    public boolean isSuccess(){return  this.isSuccess;}

    public String getResultHash(){
        return this.resultHash;
    }

}
+1 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.LightReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;

import java.io.File;
@@ -88,7 +87,7 @@ public class ListRemoteFileOperation extends RemoteOperation {

                        if(dataSize > 1){ //There is at least one subfiles. Note: data[0] contains the folder.
                            RemoteFile directory = (RemoteFile) datas.get(0);
                            if(!directory.getEtag().equals(syncedFolder.getLastEtag() )){ //if etag differs
                            if( !( directory.getEtag().equals( syncedFolder.getLastEtag() ) ) ){ //if etag differs

                                //loop through subelements
                                for (int i = 0; ++i < dataSize; ){
Loading