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

Commit e2e3fa14 authored by vincent's avatar vincent
Browse files

re add registering of scannerJob in initializerservice. Still need to handle...

re add registering of scannerJob in initializerservice. Still need to handle already existing folder in initializer
parent 77d679cf
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
      </value>
    </option>
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/build/classes" />
  </component>
  <component name="ProjectType">
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ http://www.gnu.org/licenses/gpl.html
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="drive.services.InitializerService" /> <!-- @TODO replace initializer by Initializer and ask Nihar to report the change to accountManager -->
                <action android:name="drive.services.InitializerService" />
            </intent-filter>
        </service>

+3 −4
Original line number Diff line number Diff line
@@ -74,9 +74,9 @@ public class InitializerService extends Service implements OnRemoteOperationList
        SharedPreferences prefs = this.getSharedPreferences( AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE );

        if( prefs.getBoolean( AppConstants.INITIALIZATION_HAS_BEEN_DONE, false ) ) {
            //JobUtils.scheduleScannerJob(this, 120000);
            JobUtils.scheduleScannerJob(this, 120000);
            Log.w(TAG, "Initializer has already been run");
            stopSelf(); //@TODO, do not keep it when you'll enable initializer job because, it will kill running process at the same time.
            //stopSelf(); //@TODO, do not keep it when you'll enable initializer job because, it will kill running process at the same time.
        }else{
            String accountName = prefs.getString( AccountManager.KEY_ACCOUNT_NAME, "" );
            String accountType = prefs.getString( AccountManager.KEY_ACCOUNT_TYPE, "" );
@@ -127,8 +127,6 @@ public class InitializerService extends Service implements OnRemoteOperationList
            stopSelf();
        }

        Log.d(TAG, mCloudClient.getBaseUri().toString());

        //Get categories of element to sync
        List<String> mSyncCategories = new ArrayList<>();

@@ -290,6 +288,7 @@ public class InitializerService extends Service implements OnRemoteOperationList

        //all folder have been created
        //JobUtils.stopScheduledJob(appContext, JobUtils.InitializerJobId);
        JobUtils.scheduleScannerJob(getApplicationContext(), JobUtils.ScannerJobId);
        stopSelf();

    }
+1 −2
Original line number Diff line number Diff line
@@ -42,9 +42,8 @@ public abstract class JobUtils {
                .build();

        JobScheduler jobScheduler = context.getSystemService( JobScheduler.class );
        int result = jobScheduler.schedule( job );

        if ( result == JobScheduler.RESULT_SUCCESS ) {
        if ( jobScheduler.schedule( job ) == JobScheduler.RESULT_SUCCESS ) {
            Log.d(TAG, "Scheduled job created");
        } else {
            Log.e(TAG, "Scheduled job not created");