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

Commit 01ae192b authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Add new foundation.e.drive.work.FullScanWorker.java

- Add new class FullScanWorker.java to be used as replacement of jobs.ScannerJob
parent 5a537ca0
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
/*
 * Copyright © Vincent Bourgmayer (/e/ foundation).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

package foundation.e.drive.work;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

import foundation.e.drive.services.ObserverService;

/**
 * As a first step, this class must replace foundation.e.drive.jobs.ScannerJob
 * in order to allow to use Jetpack Work API
 *
 * In further development it will be a part of Workers that will replace ObserverService
 * I will update this header accordingly
 * 
 * @author Vincent Bourgmayer
 */
public class FullScanWorker extends Worker {
    final private static String TAG = FullScanWorker.class.getSimpleName();

    public FullScanWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
        super(context, workerParams);
    }

    @NonNull
    @Override
    public Result doWork() {
        Log.d(TAG, "doWork(): going to send intent to ObserverService");
        Intent observerServiceIntent = new Intent(this.getApplicationContext(), ObserverService.class);
        this.getApplicationContext().startService(observerServiceIntent);
        return Result.success();
    }
}