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

Commit 163bd07e authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

make first synchro start immediately after initializer has end

parent ca038a23
Loading
Loading
Loading
Loading
Loading

.idea/codeStyles/Project.xml

deleted100644 → 0
+0 −29
Original line number Diff line number Diff line
<component name="ProjectCodeStyleConfiguration">
  <code_scheme name="Project" version="173">
    <Objective-C-extensions>
      <file>
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
      </file>
      <class>
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
      </class>
      <extensions>
        <pair source="cpp" header="h" fileNamingConvention="NONE" />
        <pair source="c" header="h" fileNamingConvention="NONE" />
      </extensions>
    </Objective-C-extensions>
  </code_scheme>
</component>
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import android.util.Log;
import foundation.e.drive.utils.JobUtils;



/**
 * @author Vincent Bourgmayer
 */
@@ -30,7 +31,8 @@ public class BatteryStateReceiver extends BroadcastReceiver {
        String intentAction = intent.getAction();
        if(intentAction == null) {
            Log.e(TAG, "intent Action is null");
        } else if ( intentAction.equals(Intent.ACTION_BATTERY_OKAY) ) {
        }
        else if ( intentAction.equals(Intent.ACTION_BATTERY_OKAY) && !JobUtils.isScannerJobScheduled(context) ) {
                JobUtils.scheduleScannerJob(context);
            //Note: ScreenOffReciever is register in ScannerJob. So no need to register it here.
        }else if(intentAction.equals(Intent.ACTION_BATTERY_LOW)){
+3 −2
Original line number Diff line number Diff line
@@ -282,8 +282,9 @@ public class InitializerService extends Service implements OnRemoteOperationList
                .apply();

        //all folder have been created
        JobUtils.scheduleScannerJob(this);

        //JobUtils.scheduleScannerJob(this);
        Intent intent = new Intent(this, ObserverService.class);
        startService(intent);
        //JobUtils.stopScheduledJob(appContext, JobUtils.InitializerJobId);
        stopSelf();

+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public class ObserverService extends Service implements OnRemoteOperationListene
            this.mAccount = CommonUtils.getAccount(accountName, accountType, AccountManager.get(this));

            if (this.mAccount != null ){

                JobUtils.scheduleScannerJob(this); //It should restart counter so we are sure that a synchro will ever happen between now and 30 minutes
                if ( CommonUtils.isMediaSyncEnabled(this.mAccount) || CommonUtils.isSettingsSyncEnabled(this.mAccount) ) {
                    if (mClient == null) //background task
                        CommonUtils.getOwnCloudClient(this.mAccount, getApplicationContext(), this);
+5 −0
Original line number Diff line number Diff line
@@ -57,4 +57,9 @@ public abstract class JobUtils {
    public static void stopScheduledJob(Context context, int jobId){
        context.getSystemService( JobScheduler.class ).cancel(jobId);
    }

    public static boolean isScannerJobScheduled(Context context){
        return ( (JobScheduler) context.getSystemService( Context.JOB_SCHEDULER_SERVICE ) )
                .getPendingJob(ScannerJobId) != null ;
    }
}