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

Commit 8d26fdfc authored by François Degros's avatar François Degros
Browse files

Implement Job.getWarningNotification()

Put a default implementation of getWarningNotification() in the Job base
class. This removes the duplicated implementations of this method from
DeleteJob and TestJob. This will also simplify the implementation of the
upcoming UnpackJob class.

Bug: 406328303
Flag: EXEMPT refactoring without any functional change
Test: atest DocumentsUIGoogleTests:com.android.documentsui.services
Change-Id: I74ecc6e9d8247ad6f32f139a371ef9dbb7ed4229
parent 9f34e751
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -97,11 +97,6 @@ final class DeleteJob extends ResolvedResourcesJob {
                R.plurals.delete_error_notification_title, R.drawable.ic_menu_delete);
    }

    @Override
    Notification getWarningNotification() {
        throw new UnsupportedOperationException();
    }

    private String getProgressMessage() {
        switch (getState()) {
            case Job.STATE_SET_UP:
+4 −1
Original line number Diff line number Diff line
@@ -188,7 +188,10 @@ abstract public class Job implements Runnable {
    abstract Notification getProgressNotification();
    abstract Notification getFailureNotification();

    abstract Notification getWarningNotification();
    /** Must be implemented if hasWarnings() can return true. */
    Notification getWarningNotification() {
        throw new UnsupportedOperationException();
    }

    abstract JobProgress getJobProgress();

+0 −5
Original line number Diff line number Diff line
@@ -92,11 +92,6 @@ public class TestJob extends Job {
                R.plurals.copy_error_notification_title, R.drawable.ic_menu_copy);
    }

    @Override
    Notification getWarningNotification() {
        throw new UnsupportedOperationException();
    }

    JobProgress getJobProgress() {
        return new JobProgress(id, getState(), "test job", false);
    }