Run copyTo and remove methods in a background thread #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue description
Due to many issues reported that the application hangs during fetching live update, by running the app on a low-end device HUWAIE-GR5 found that the
copyTo
method blocks the main UI thread for 128 seconds, by checking the implementation found that the method runs on the foreground not in a background thread. So, in a result the skip button is not enabled after exactly 30 seconds and the user screen just hangs.Solution
The solution was to run the
copyTo
andremove
methods in a background thread to avoid blocking the main UI thread and the user can skip live update if it takes more than 30 secondsNote
before merging this PR, I should make it clear on some low-end devices the live update most probably it will always take more than 30 seconds so are we sure that it's okay to allow the user to skip the update after 30 seconds have passed as this will always be the case
Before and after videos
In the after video you can see that the skip button is enabled after exactly 30 seconds as the UI thread is not blocked