From 0a11e4ba794fcb8c749b386ca2eff4593c3a7c9d Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 11:58:03 +0200 Subject: [PATCH 1/7] fix(download): large file Signed-off-by: alperozturk96 --- .../com/owncloud/android/operations/DownloadFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java b/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java index f56e25bd7f1a..4f01b4b00ba2 100644 --- a/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java @@ -200,7 +200,7 @@ protected RemoteOperationResult run(OwnCloudClient client) { String tmpFolder = getTmpFolder(); - downloadOperation = new DownloadFileRemoteOperation(file.getRemotePath(), tmpFolder); + downloadOperation = new DownloadFileRemoteOperation(file.getRemotePath(), tmpFolder, file.getFileLength()); if (downloadType == DownloadType.DOWNLOAD) { dataTransferListeners.forEach(downloadOperation::addProgressListener); From 5106a467e04a5a41eb30866bd7346522469243eb Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 12:11:25 +0200 Subject: [PATCH 2/7] fix(download): large file Signed-off-by: alperozturk96 --- .../download/DownloadNotificationManager.kt | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt b/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt index 9ccb36b67237..7a67ec53e6cb 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt @@ -13,13 +13,13 @@ import android.content.Intent import com.nextcloud.client.jobs.notification.WorkerNotificationManager import com.nextcloud.utils.numberFormatter.NumberFormatter import com.owncloud.android.R +import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.operations.DownloadFileOperation import com.owncloud.android.ui.notifications.NotificationUtils import com.owncloud.android.utils.theme.ViewThemeUtils -import java.io.File import java.security.SecureRandom -@Suppress("TooManyFunctions") +@Suppress("TooManyFunctions", "MagicNumber") class DownloadNotificationManager(id: Int, private val context: Context, viewThemeUtils: ViewThemeUtils) : WorkerNotificationManager( id, @@ -29,11 +29,9 @@ class DownloadNotificationManager(id: Int, private val context: Context, viewThe channelId = NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD ) { - private var lastPercent = -1 - - @Suppress("MagicNumber") fun prepareForStart(operation: DownloadFileOperation) { - currentOperationTitle = File(operation.savePath).name + currentOperationTitle = operation.file.fileName + notificationBuilder.run { setContentTitle(currentOperationTitle) @@ -51,20 +49,13 @@ class DownloadNotificationManager(id: Int, private val context: Context, viewThe .setProgress(0, 0, false) } - @Suppress("MagicNumber") fun updateDownloadProgress(percent: Int, totalToTransfer: Long) { - // If downloads are so fast, no need to notify again. - if (percent == lastPercent) { - return - } - lastPercent = percent - val progressText = NumberFormatter.getPercentageText(percent) setProgress(percent, progressText, totalToTransfer < 0) showNotification() } - @Suppress("MagicNumber") + fun dismissNotification() { dismissNotification(2000) } From c68f1a28171d61d4877cce64f15a6b30069520d8 Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 12:24:36 +0200 Subject: [PATCH 3/7] fix download notification title Signed-off-by: alperozturk96 --- .../jobs/download/FileDownloadWorker.kt | 20 +++++++++---------- .../notification/WorkerNotificationManager.kt | 5 +++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt index d9febd6e48b3..663631cdd1a1 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt @@ -105,8 +105,6 @@ class FileDownloadWorker( @Suppress("ReturnCount") override suspend fun doWork(): Result { - trySetForeground() - return try { setUser() val remotePath = inputData.keyValueMap[FILE_REMOTE_PATH] as? String? ?: return Result.failure() @@ -144,20 +142,21 @@ class FileDownloadWorker( ) } - private suspend fun trySetForeground() { + private suspend fun trySetForeground(filename: String) { try { - val foregroundInfo = createWorkerForegroundInfo() + val foregroundInfo = createWorkerForegroundInfo(filename) setForeground(foregroundInfo) } catch (e: Exception) { Log_OC.w(TAG, "⚠️ Could not set foreground service: ${e.message}") } } - private fun createWorkerForegroundInfo(): ForegroundInfo = ForegroundServiceHelper.createWorkerForegroundInfo( - notificationManager.getId(), - notificationManager.getNotification(), - ForegroundServiceType.DataSync - ) + private fun createWorkerForegroundInfo(filename: String): ForegroundInfo = + ForegroundServiceHelper.createWorkerForegroundInfo( + notificationManager.getId(), + notificationManager.getNotification(filename), + ForegroundServiceType.DataSync + ) private fun removePendingDownload(accountName: String?) { pendingDownloads.remove(accountName) @@ -246,7 +245,7 @@ class FileDownloadWorker( } @Suppress("TooGenericExceptionCaught", "DEPRECATION") - private fun downloadFile(downloadKey: String) { + private suspend fun downloadFile(downloadKey: String) { currentDownload = pendingDownloads.get(downloadKey) if (currentDownload == null) { @@ -262,6 +261,7 @@ class FileDownloadWorker( } lastPercent = 0 + trySetForeground(currentDownload?.file?.fileName ?: "") notificationManager.run { prepareForStart(currentDownload!!) setContentIntent(intents.detailsIntent(currentDownload!!), PendingIntent.FLAG_IMMUTABLE) diff --git a/app/src/main/java/com/nextcloud/client/jobs/notification/WorkerNotificationManager.kt b/app/src/main/java/com/nextcloud/client/jobs/notification/WorkerNotificationManager.kt index cae7a8cd56b2..6c530a4c5220 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/notification/WorkerNotificationManager.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/notification/WorkerNotificationManager.kt @@ -83,6 +83,11 @@ open class WorkerNotificationManager( fun getNotification(): Notification = notificationBuilder.build() + fun getNotification(title: String): Notification { + notificationBuilder.setContentTitle(title) + return notificationBuilder.build() + } + fun getForegroundInfo(notification: Notification): ForegroundInfo = ForegroundServiceHelper.createWorkerForegroundInfo( id, From 8d0cb4e85d1cade3ec12a532a756dcccf7682a24 Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 12:25:24 +0200 Subject: [PATCH 4/7] wip Signed-off-by: alperozturk96 --- .../client/jobs/download/DownloadNotificationManager.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt b/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt index 7a67ec53e6cb..d9f24de6b305 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/DownloadNotificationManager.kt @@ -13,7 +13,6 @@ import android.content.Intent import com.nextcloud.client.jobs.notification.WorkerNotificationManager import com.nextcloud.utils.numberFormatter.NumberFormatter import com.owncloud.android.R -import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.operations.DownloadFileOperation import com.owncloud.android.ui.notifications.NotificationUtils import com.owncloud.android.utils.theme.ViewThemeUtils @@ -32,7 +31,6 @@ class DownloadNotificationManager(id: Int, private val context: Context, viewThe fun prepareForStart(operation: DownloadFileOperation) { currentOperationTitle = operation.file.fileName - notificationBuilder.run { setContentTitle(currentOperationTitle) setOngoing(false) @@ -55,7 +53,6 @@ class DownloadNotificationManager(id: Int, private val context: Context, viewThe showNotification() } - fun dismissNotification() { dismissNotification(2000) } From 3982935261d8f509b22baf105cc842d199c8e484 Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 13:47:14 +0200 Subject: [PATCH 5/7] fix download progress Signed-off-by: alperozturk96 --- .../com/nextcloud/client/jobs/download/FileDownloadWorker.kt | 4 ++-- .../owncloud/android/operations/DownloadFileOperation.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt index 663631cdd1a1..3daacb5a765e 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt @@ -187,7 +187,6 @@ class FileDownloadWorker( ) operation.addDownloadDataTransferProgressListener(this) - operation.addDownloadDataTransferProgressListener(downloadProgressListener) val (downloadKey, _) = pendingDownloads.putIfAbsent( user?.accountName, file.remotePath, @@ -401,7 +400,7 @@ class FileDownloadWorker( totalToTransfer: Long, filePath: String ) { - val percent: Int = downloadProgressListener.getPercent(totalTransferredSoFar, totalToTransfer) + val percent: Int = getPercent(totalTransferredSoFar, totalToTransfer) val currentTime = System.currentTimeMillis() if (percent != lastPercent && (currentTime - lastUpdateTime) >= minProgressUpdateInterval) { @@ -413,6 +412,7 @@ class FileDownloadWorker( lastPercent = percent EventBusFactory.downloadProgressEventBus.post(FileDownloadProgressEvent(percent)) + downloadProgressListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, filePath) } // CHECK: Is this class still needed after conversion from Foreground Services to Worker? diff --git a/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java b/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java index 4f01b4b00ba2..e3dc77d5ca1f 100644 --- a/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java @@ -209,8 +209,6 @@ protected RemoteOperationResult run(OwnCloudClient client) { NextcloudClient nextcloudClient = OwnCloudClientExtensionsKt.toNextcloudClient(client, operationContext); result = downloadOperation.execute(nextcloudClient); - - if (result.isSuccess()) { modificationTimestamp = downloadOperation.getModificationTimestamp(); etag = downloadOperation.getEtag(); From b31523a7fa7de9c419723412278150ea5ec16b6d Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 13:52:33 +0200 Subject: [PATCH 6/7] wip Signed-off-by: alperozturk96 --- .../com/owncloud/android/files/FileMenuFilterIT.kt | 1 - .../client/jobs/download/FileDownloadWorker.kt | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt b/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt index 5de86fcd652c..a4f61c7325f9 100644 --- a/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt @@ -64,7 +64,6 @@ class FileMenuFilterIT : AbstractIT() { MockKAnnotations.init(this) every { mockFileUploaderBinder.isUploading(any(), any()) } returns false every { mockComponentsGetter.fileUploaderHelper } returns mockFileUploaderBinder - every { mockFileDownloadProgressListener.isDownloading(any(), any()) } returns false every { mockComponentsGetter.fileDownloadProgressListener } returns mockFileDownloadProgressListener every { mockOperationsServiceBinder.isSynchronizing(any(), any()) } returns false every { mockComponentsGetter.operationsServiceBinder } returns mockOperationsServiceBinder diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt index 3daacb5a765e..9882e0980211 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt @@ -1,9 +1,8 @@ /* * Nextcloud - Android Client * - * SPDX-FileCopyrightText: 2023 Alper Ozturk - * SPDX-FileCopyrightText: 2023 Nextcloud GmbH - * SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only + * SPDX-FileCopyrightText: 2026 Alper Ozturk + * SPDX-License-Identifier: AGPL-3.0-or-later */ package com.nextcloud.client.jobs.download @@ -42,6 +41,7 @@ import com.owncloud.android.utils.theme.ViewThemeUtils import java.util.AbstractList import java.util.Optional import java.util.Vector +import java.util.concurrent.ConcurrentHashMap import kotlin.random.Random @Suppress("LongParameterList", "TooManyFunctions", "TooGenericExceptionCaught") @@ -415,11 +415,8 @@ class FileDownloadWorker( downloadProgressListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, filePath) } - // CHECK: Is this class still needed after conversion from Foreground Services to Worker? inner class FileDownloadProgressListener : OnDatatransferProgressListener { - private val boundListeners: MutableMap = HashMap() - - fun isDownloading(user: User?, file: OCFile?): Boolean = FileDownloadHelper.instance().isDownloading(user, file) + private val boundListeners = ConcurrentHashMap() fun addDataTransferProgressListener(listener: OnDatatransferProgressListener?, file: OCFile?) { if (file == null || listener == null) { From da3eca37b2091e81fe768b177a82947ea400e72b Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 11 Jun 2026 13:56:55 +0200 Subject: [PATCH 7/7] wip Signed-off-by: alperozturk96 --- gradle/libs.versions.toml | 2 +- gradle/verification-metadata.xml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5af872bd7ca3..439065e83c27 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ androidCommonLibraryVersion = "0.33.2" androidGifDrawableVersion = "1.2.31" androidImageCropperVersion = "4.7.0" -androidLibraryVersion ="1f476c0ab14fb280172be2aefd70db80e50bb17b" +androidLibraryVersion ="db0b541a73" androidOpensslVersion = "3.5.6" androidPluginVersion = "9.2.1" androidsvgVersion = "1.4" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 9b38429f9e72..7079993f0ca5 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -21902,6 +21902,14 @@ + + + + + + + +