Commit 27965c3
authored
[fix] target device selector updates (flutter#8891)
In flutter#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 from `DeviceSelectorAction.updateActions()` and
`DeviceService.refreshDeviceDaemon()`, invoking a newly extracted
`updateComponent` method in `DeviceSelectorAction` instead. 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.DeviceSelectorActionTest` still passes.
Fixes flutter#8853
---
Review the contribution guidelines below:
- [x] I’ve reviewed the contributor guide and applied the relevant
portions to this PR.
- [x] I've included the required information in the description above.
- [x] My up-to-date information is in the `AUTHORS` file.
- [x] I've updated `CHANGELOG.md` if appropriate.
<details>
<summary>Contribution guidelines:</summary><br>
- See
our [contributor guide](../CONTRIBUTING.md) and
the [Flutter organization contributor
guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md)
for general expectations for PRs.
- Larger or significant changes should be discussed in an issue before
creating a PR.
- Dart contributions to our repos should follow the [Dart style
guide](https://dart.dev/guides/language/effective-dart) and use
`dart format`.
- Java and Kotlin contributions should strive to follow Java and Kotlin
best
practices
([discussion](flutter#8098)).
</details>1 parent 2352bc0 commit 27965c3
2 files changed
Lines changed: 28 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
384 | 388 | | |
385 | 389 | | |
386 | 390 | | |
387 | 391 | | |
388 | 392 | | |
389 | | - | |
| 393 | + | |
390 | 394 | | |
391 | 395 | | |
| 396 | + | |
392 | 397 | | |
393 | 398 | | |
394 | 399 | | |
| |||
398 | 403 | | |
399 | 404 | | |
400 | 405 | | |
| 406 | + | |
401 | 407 | | |
402 | 408 | | |
403 | 409 | | |
| |||
412 | 418 | | |
413 | 419 | | |
414 | 420 | | |
415 | | - | |
416 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
417 | 424 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
| 425 | + | |
| 426 | + | |
430 | 427 | | |
431 | | - | |
432 | | - | |
433 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
434 | 442 | | |
435 | 443 | | |
436 | 444 | | |
| |||
447 | 455 | | |
448 | 456 | | |
449 | 457 | | |
| 458 | + | |
450 | 459 | | |
451 | 460 | | |
452 | 461 | | |
| |||
531 | 540 | | |
532 | 541 | | |
533 | 542 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | 543 | | |
540 | 544 | | |
541 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
| |||
0 commit comments