[fix] target device selector updates#8891
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the device selection logic by extracting UI update logic into a dedicated updateComponent method and removing manual ActivityTracker increments. The review identified critical threading violations where UI-related operations in updateComponent are executed on a background thread instead of the Event Dispatch Thread (EDT). Additionally, a redundant call to updateComponent was found that should be removed to avoid unnecessary processing.
pq
commented
Apr 8, 2026
jwren
approved these changes
Apr 8, 2026
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.
In #8853, users are reporting an exception in Android Studio thanks to excessive toolbar updates. This is caused by the Flutter plugin triggering frequent global toolbar updates via a call to
ActivityTracker.getInstance().inc()whenever the device or emulator lists change.The Fix. To reduce update frequency, this change makes the updates targeted, removing the (global)
ActivityTracker.getInstance().inc()calls fromDeviceSelectorAction.updateActions()andDeviceService.refreshDeviceDaemon(), invoking a newly extractedupdateComponentmethod inDeviceSelectorActioninstead. This ensures that the Flutter device selector UI still updates immediately when devices are connected or disconnected, but without forcing a global re-query of all actions on the toolbar.Verification. Verified manually and
io.flutter.actions.DeviceSelectorActionTeststill passes.Fixes #8853
Review the contribution guidelines below:
AUTHORSfile.CHANGELOG.mdif appropriate.Contribution guidelines:
our contributor guide and
the Flutter organization contributor guide
for general expectations for PRs.
dart format.practices (discussion).