Clean up ResolverListAdapter::rebuildList().
Behaviorally, this is *almost* a pure refactoring. It does make one very minor logic change(*) that could hypothetically fix a race condition, although no particular bugs have ever been observed as a result (nor do they seem especially probable), and it's unknown what the severity would be if they ever were to occur. Additionally, this change clarifies existing comments and adds more inline documentation to help understand the rebuildList() flow. Code cleanup identifies a few areas where the current design seems a little clumsy, noted with new "TODO" comments in the code. There's room for more improvement, but this function plays an important role in preparing Sharesheet targets, so it's good to bring attention to these thorny requirements. For justifications of behavioral equivalence and other metacognitive notes, see comments in the code review. (*) The one behavior change is called out in code review comments; briefly, the line of code that sends a synchronous "results pending" event used to follow the line that started the async flow that would result in a "results complete" event. This could hypothetically race if the async work finished and sent "results complete" before we got to the "results pending" line. Bug: 227486788 Test: `atest ChooserActivityTest` (no behavior changes expected) Change-Id: I2e74d68579be8b34716ba2202ac2a08361008400
Loading
Please register or sign in to comment