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

Commit 945f3372 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

fix an issue in StartCommand of ObserverService and replace some context to use AppContext

parent 997690fe
Loading
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -130,9 +130,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i(TAG, "onStartCommand");



        SharedPreferences prefs = this.getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);

        if (prefs.getBoolean(INITIALIZATION_HAS_BEEN_DONE, false)) {
@@ -150,17 +147,16 @@ public class ObserverService extends Service implements OnRemoteOperationListene
                        CommonUtils.getOwnCloudClient(this.mAccount, getApplicationContext(), this);
                    else
                        begin();
                }else{
                    JobUtils.stopScheduledJob(this, JobUtils.ScannerJobId); //If no account
                }else{ //Neither media nor settings are allowed to be sync
                    this.stopSelf();
                }

            } else {//If initialization not done
                Log.w(TAG, "ContentResolver.getSyncAutomatically(account, '**_PROVIDER_AUTHORITY') return false");
            } else {//If  no account
                JobUtils.stopScheduledJob(getApplicationContext(), JobUtils.ScannerJobId);
                this.stopSelf();
            }
        }else{
            Log.w(TAG, "Server must be initialized before to start");
            Intent initializerIntent = new Intent(this, InitializerService.class);
            Intent initializerIntent = new Intent(getApplicationContext(), InitializerService.class);
            startService(initializerIntent);
            this.stopSelf();
        }
@@ -179,7 +175,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
            //If there is a internet connexion
            if (CommonUtils.haveNetworkConnexion(this)) {
                if (!mBoundToOperationManager) {
                    Intent opMgrSrvIntent = new Intent(this, OperationManagerService.class);
                    Intent opMgrSrvIntent = new Intent(getApplicationContext(), OperationManagerService.class);
                    bindService(opMgrSrvIntent, this.mOperationManagerServiceConnection, Context.BIND_NOT_FOREGROUND);
                } else {
                    clearCachedFile();