Skip to content

GenericCopyUtil improvements#4577

Open
TranceLove wants to merge 2 commits intoTeamAmaze:release/4.0from
TranceLove:feature/generic-copy-util-improvements
Open

GenericCopyUtil improvements#4577
TranceLove wants to merge 2 commits intoTeamAmaze:release/4.0from
TranceLove:feature/generic-copy-util-improvements

Conversation

@TranceLove
Copy link
Copy Markdown
Collaborator

Description

  • Convert to Kotlin for cleaner code
  • Removed use of deprecated @Theory in tests
  • Not limiting SDK versions, i.e. tests are run on all SDK versions
  • Bigger buffer size (1MB) for copy from/to OTG storage to increase robustness

Automatic tests

  • Added test cases

Manual tests

  • Done

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@TranceLove TranceLove requested a review from Copilot March 1, 2026 16:31
@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from a123ebc to 0cb5abf Compare March 1, 2026 16:33
@TranceLove TranceLove marked this pull request as ready for review March 1, 2026 16:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes GenericCopyUtil by migrating it (and its tests) from Java to Kotlin, while improving copy robustness/performance via larger transfer quanta and batched progress callbacks. It also replaces deprecated JUnit @Theory-based tests with explicit Kotlin test cases and adds new coverage for cancellation and progress batching.

Changes:

  • Replaced GenericCopyUtil Java implementation with a Kotlin version using FileChannel.transferTo for file-to-file copies and batched progress updates.
  • Replaced Java unit/instrumentation tests with Kotlin tests (no deprecated @Theory), adding more scenarios (empty file, cancellation, batching).
  • Increased transfer buffer quantum (1MB) for OTG/DocumentFile paths and channel-based copies.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
app/src/main/java/com/amaze/filemanager/filesystem/files/GenericCopyUtil.kt Kotlin rewrite; adds transferTo fast path + progress batching + 1MB transfer quantum.
app/src/main/java/com/amaze/filemanager/filesystem/files/GenericCopyUtil.java Removes old Java implementation.
app/src/test/java/com/amaze/filemanager/filesystem/files/GenericCopyUtilTest.kt New Robolectric unit tests replacing @Theory, adding batching/cancellation coverage.
app/src/test/java/com/amaze/filemanager/filesystem/files/GenericCopyUtilTest.java Removes old Java unit tests.
app/src/androidTest/java/com/amaze/filemanager/filesystem/files/GenericCopyUtilEspressoTest.kt New instrumented tests in Kotlin, including batching/cancellation scenarios.
app/src/androidTest/java/com/amaze/filemanager/filesystem/files/GenericCopyUtilEspressoTest.java Removes old Java instrumented tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch 5 times, most recently from 0368390 to df0d36d Compare March 4, 2026 04:51
Copy link
Copy Markdown
Member

@EmmanuelMess EmmanuelMess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few !!, please deal with them or provide an explanation for the ones left.

@EmmanuelMess EmmanuelMess marked this pull request as draft March 20, 2026 20:29
@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from df0d36d to cf15948 Compare March 21, 2026 02:27
@TranceLove TranceLove marked this pull request as ready for review March 21, 2026 02:28
@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from cf15948 to db8bbe2 Compare March 21, 2026 03:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from db8bbe2 to c489d0d Compare March 21, 2026 07:38
@TranceLove TranceLove requested a review from Copilot March 21, 2026 08:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from c489d0d to c0b97ce Compare March 21, 2026 09:47
- Convert to Kotlin
- More tests
- Bigger buffer size for copy from/to OTG storage
@TranceLove TranceLove force-pushed the feature/generic-copy-util-improvements branch from c0b97ce to 20b55ac Compare March 21, 2026 15:44
Copy link
Copy Markdown
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@VishnuSanal VishnuSanal added the PR-Awaiting-Final-Review this PR is awaiting a final review/approval label Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Awaiting-Final-Review this PR is awaiting a final review/approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants