Fix: An attempt to reduce ANRs in the Tab switcher#7774
Merged
Conversation
Contributor
GerardPaligot
left a comment
There was a problem hiding this comment.
Nice improvement, I wasn't able to reproduce the crash myself, but I "load-tested" the application and the tab switcher screen to verify your changes under stress. I've also posted a few comments with some minor suggestions and questions.
| oldItem: TabSwitcherItem, | ||
| newItem: TabSwitcherItem, | ||
| ): Bundle { | ||
| ): Any { |
Contributor
There was a problem hiding this comment.
Suggestion: I'm pretty sure we can keep Bundle here.
| updateData(swapped) | ||
| val swapped = pendingList.swap(from, to) | ||
| pendingList = swapped | ||
| differ.submitList(swapped) |
Contributor
There was a problem hiding this comment.
Suggestion: reuse updateData function to avoid any future error.
updateData(pendingList.swap(from, to))
Member
Author
|
Thanks for the review, @GerardPaligot. I've addressed all comments, ready for another round! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Task/Issue URL: https://app.asana.com/1/137249556945/project/1207418217763355/task/1213195941245227?focus=true
Description
This PR adds a couple of optimizations to attempt to reduce ANRs in the Tab switcher:
Steps to test this PR
Note
Medium Risk
Changes RecyclerView diffing and async image-loading lifecycle in the tab switcher, which can affect item updates, scrolling behavior, and potential visual inconsistencies if cancellation/state is mishandled.
Overview
Reduces main-thread work in the tab switcher by switching from manual
DiffUtil.calculateDifftoAsyncListDifferwith a newDiffUtil.ItemCallback-basedTabSwitcherItemDiffCallback(including a dynamicisDragging()alpha payload for the tracker info tile).Adds per-ViewHolder coroutine job tracking/cancellation and explicit
onViewRecycledcleanup to stop favicon/preview loading when items are recycled, and updates favicon loading to allow Glide caching by removingDiskCacheStrategy.NONE/skipMemoryCache(true)inFaviconImageView.Written by Cursor Bugbot for commit 5f13c2a. This will update automatically on new commits. Configure here.