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

Commit a281fb3a authored by narinder Rana's avatar narinder Rana
Browse files

to manage OperationManagerService

parent ab9e75ce
Loading
Loading
Loading
Loading
Loading
+27 −7
Original line number Diff line number Diff line
@@ -131,12 +131,20 @@ public class ObserverService extends Service implements OnRemoteOperationListene
        //Check this service isn't already working
        if (isWorking) {
            Log.w(TAG, "ObserverService is already working");
            return super.onStartCommand(intent, flags, startId);
            getApplicationContext().stopService(new Intent(getApplicationContext(), ObserverService.class));
           // return super.onStartCommand(intent, flags, startId);
            startService(new Intent(this, ObserverService.class));
        }

        //check OperationManagerService isn't working
        if (prefs.getBoolean(AppConstants.KEY_OMS_IS_WORKING, false)) {
            Log.w(TAG, "OperationManagerService is still performing some operation");

            getApplicationContext().stopService(new Intent(getApplicationContext(), OperationManagerService.class));
            if (operationsForIntent != null && !operationsForIntent.isEmpty()) {
                startOperationManagerService();
            }

        }

        //Check a minimum delay has been respected between two start.
@@ -338,13 +346,15 @@ public class ObserverService extends Service implements OnRemoteOperationListene

            //After everything has been scanned. Send Intent to OperationmanagerService with data in bundle
            if (operationsForIntent != null && !operationsForIntent.isEmpty()) {
                Intent OMSIntent = new Intent(this, OperationManagerService.class);
                for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
                    OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
                }
//                Intent OMSIntent = new Intent(this, OperationManagerService.class);
//                for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
//                    OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
//                }
//
//                OMSIntent.putExtra("account", mAccount);
//                startService(OMSIntent);

                OMSIntent.putExtra("account", mAccount);
                startService(OMSIntent);
                startOperationManagerService();



@@ -380,6 +390,16 @@ public class ObserverService extends Service implements OnRemoteOperationListene
        return result;
    }

    private void startOperationManagerService() {
        Intent OMSIntent = new Intent(this, OperationManagerService.class);
        for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
            OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
        }

        OMSIntent.putExtra("account", mAccount);
        startService(OMSIntent);
    }

    /* methods related to Server Scanning */

    /**