From 77f3e752b26b58e8ccbe2a40cb8ff0bb44b66628 Mon Sep 17 00:00:00 2001 From: Austin Tankiang Date: Fri, 7 Feb 2025 06:36:40 +0000 Subject: Add functions to Jobs to retrieve current progress There is no change in behaviour as this patch just adds functions. Due to limitations in the current job implementations, there are a few shortcominings: * Failure reasons aren't exposed. * Transfers of zero bytes (e.g. folder only or empty file) show as indeterminate progress. * In cases where file size can't be determined, the job keeps track via files processed, but these will show as indeterminate progress. Bug: 385841721 Test: atest -c 'DocumentsUIGoogleTests:com.android.documentsui.services' Flag: com.android.documentsui.flags.visual_signals Change-Id: I7b0d863bf7b974090c0e1a17f06c0f7160c59699 --- tests/common/com/android/documentsui/services/TestJob.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/common/com/android/documentsui/services/TestJob.java b/tests/common/com/android/documentsui/services/TestJob.java index 10addebd9..426cb9575 100644 --- a/tests/common/com/android/documentsui/services/TestJob.java +++ b/tests/common/com/android/documentsui/services/TestJob.java @@ -23,11 +23,11 @@ import android.app.Notification; import android.app.Notification.Builder; import android.content.Context; -import com.android.documentsui.base.Features; -import com.android.documentsui.clipping.UrisSupplier; import com.android.documentsui.R; import com.android.documentsui.base.DocumentInfo; import com.android.documentsui.base.DocumentStack; +import com.android.documentsui.base.Features; +import com.android.documentsui.clipping.UrisSupplier; import com.android.documentsui.services.FileOperationService.OpType; import java.text.NumberFormat; @@ -97,6 +97,10 @@ public class TestJob extends Job { throw new UnsupportedOperationException(); } + JobProgress getJobProgress() { + return new JobProgress(id, getState(), "test job", false); + } + @Override Builder createProgressBuilder() { ++mNumOfNotifications; -- cgit v1.2.3-59-g8ed1b