Skip to content

Conversation

@vashworth
Copy link
Contributor

@vashworth vashworth commented Feb 23, 2023

This change introduces to devices the concept of isConnected and connectionInterface (DeviceConnectionInterface). As it stands in this PR, all devices will have isConnected be true and connectionInterface be DeviceConnectionInterface.attached.

This PR also changed the way target devices are filtered so it's more flexible to use and encapsulated. To accommodate these changes, I also updated some function names and made a getter into a function.

Lastly, this PR also fixes a potential race situation related to populating the device cache.

No user experience is changed in this PR.

Part 1 in breakdown of #121262.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

…face, update device filtering to use a class, update some function names
@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 23, 2023
@vashworth vashworth marked this pull request as ready for review February 23, 2023 21:35
this.mustBeSupportedByFlutter = false,
this.mustBeSupportedForProject = false,
this.mustBeSupportedForAll = false,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In previous PR, @jmagman asked:

How about includeDevicesSupportedByFlutter, includeDevicesSupportedByProject, includeUnsupportedDevices or similar.

To which I responded:

Yeah I had a hard time picking variable names for this. So by default (if you don't set anything) it will include all devices and none will be filtered out. So I thought that using the word include was a bit confusing. For example, if everything is already included, what does includeDevicesSupportedByFlutter really mean? It really means exclude everything that's not supported by flutter. What do you think of excludeDevicesNotSupportedByFlutter, excludeDevicesNotSupportedByProject, excludeDevicesNotSupportedByAll?

Do the exclude names make more sense / more inline with our naming conventions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to @jmagman on this one, I'm horrible at naming :)

class DeviceDiscoverySupportFilter {
DeviceDiscoverySupportFilter({
required this.flutterProject,
this.mustBeSupportedByFlutter = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever false? It looks like it's always true in #121262.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's unnecessary, removed it.

/// If [mustBeSupportedForAll] is true, only devices supported by Flutter,
/// supported for the provided [flutterProject], and supported for
/// `--device all` will be included.
class DeviceDiscoverySupportFilter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These filter classes seem like they push a lot up to the call sites. It seems confusing that you could do excludeDevicesNotSupportedByProject: false, excludeDevicesNotSupportedByFlutter: true, what would you get? It's also not enforcing that flutterProject is nonnull if excludeDevicesNotSupportedByProject is true. I think we can be more defensive about not letting the caller shoot themselves in the foot?

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, though I'll leave final approval to Jenn

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 3, 2023
@auto-submit auto-submit bot merged commit cc26a1a into flutter:master Mar 3, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
@vashworth vashworth deleted the wireless_device_discovery_part_1 branch September 27, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants