Skip to content

Conversation

@gmackall
Copy link
Member

@gmackall gmackall commented Aug 11, 2023

Fixes #89683.

The changes to getFlutterView in FlutterDeviceScreenshot are the fix that was required, everything else was done to get tests running (such as re-generating some lockfiles and modifying the android manifest).

The code was all currently not unit tested, and there were no other easy examples to base these java unit tests off in flutter/flutter, so let me know if this approach to testing is wrong.

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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: integration_test The flutter/packages/integration_test plugin labels Aug 11, 2023
@gmackall gmackall marked this pull request as ready for review August 17, 2023 17:16
@gmackall gmackall requested a review from a team August 17, 2023 19:59
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

Looks good!

return (FlutterView)activity.findViewById(FlutterActivity.FLUTTER_VIEW_ID);
@VisibleForTesting
public static FlutterView getFlutterView(@NonNull Activity activity) {
if (activity instanceof FlutterActivity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be ...

Suggested change
if (activity instanceof FlutterActivity) {
if (activity instanceof FlutterActivity ||| activity instanceOf FlutterFragmentActivity) {

Is it possible to avoid the instance of check at all?
go/UnhealthyIdioms#awkward-inheritance-hierarchy

Copy link
Member Author

Choose a reason for hiding this comment

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

Should this be ...

No, note that the cases are indeed different here:
findViewById(FlutterActivity.FLUTTER_VIEW_ID) vs findViewById(FlutterFragment.FLUTTER_VIEW_ID) (notably, Flutter Activity vs Flutter Fragment

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not aware of a better way to do this without instanceof (I try to avoid it in general). Open to ideas if I'm missing something though.

We could just do something like (pseudo code)

if (<findbyviewid isn't null for FlutterActivity.FLUTTER_VIEW_ID>)
<return that>
if (<findbyviewid isn't null for FlutterFragmentFLUTTER_VIEW_ID>)
<return that>
<return null>

But if for whatever reason we are actually dealing with a FlutterFragmentActivity, and there is a view registered with the FlutterActivity.FLUTTER_VIEW_ID, then we would return the wrong view.

Copy link
Contributor

Choose a reason for hiding this comment

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

After some further consideration if you want to move on feel free to file a follow-up ticket and merge this as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

auto-submit bot pushed a commit that referenced this pull request Aug 21, 2023
…132967)

The `generate_gradle_lockfiles.dart` script was generating the gradle wrapper by building a flavor that didn't exist. In the time since the script was written, the `--config-only` flag was created and should be used instead.

Context #132406 (comment)
@gmackall gmackall requested a review from reidbaker August 23, 2023 18:03
@gmackall gmackall added the platform-android Android applications specifically label Aug 31, 2023
@gmackall gmackall added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 7, 2023
@auto-submit auto-submit bot merged commit 827b5df into flutter:master Sep 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 8, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 8, 2023
flutter/flutter@aea4552...da676f7

2023-09-08 [email protected] Marks Linux_android very_long_picture_scrolling_perf__e2e_summary to be unflaky (flutter/flutter#134116)
2023-09-08 [email protected] Make `CupertinoTextField` at least as tall as its first line of placeholder (flutter/flutter#134198)
2023-09-08 [email protected] Roll Flutter Engine from f09a139101c3 to 6d6b44886175 (3 revisions) (flutter/flutter#134306)
2023-09-08 [email protected] Update links to iOS embedder docs to point to new Doxygen docs (flutter/flutter#134246)
2023-09-08 [email protected] Roll Packages from 22d4754 to aaae5ef (7 revisions) (flutter/flutter#134301)
2023-09-08 [email protected] Roll Flutter Engine from c38feb382e96 to f09a139101c3 (1 revision) (flutter/flutter#134299)
2023-09-08 [email protected] Roll Flutter Engine from f146d4bf244b to c38feb382e96 (1 revision) (flutter/flutter#134293)
2023-09-08 [email protected] Roll Flutter Engine from a140ab4a4ec6 to f146d4bf244b (1 revision) (flutter/flutter#134290)
2023-09-08 [email protected] Roll Flutter Engine from ea1d0d28e26f to a140ab4a4ec6 (5 revisions) (flutter/flutter#134288)
2023-09-08 [email protected] fix a Scrollbar example crash (flutter/flutter#127925)
2023-09-08 [email protected] Fix `Drawer` examples are missing `dartpad` tag (flutter/flutter#134219)
2023-09-08 [email protected] Roll Flutter Engine from 4ac4429a206b to ea1d0d28e26f (1 revision) (flutter/flutter#134270)
2023-09-08 [email protected] Roll Flutter Engine from df3965a55fd8 to 4ac4429a206b (1 revision) (flutter/flutter#134267)
2023-09-08 [email protected] Roll Flutter Engine from 505ef3c33102 to df3965a55fd8 (1 revision) (flutter/flutter#134263)
2023-09-08 [email protected] _TabBarViewState should dispose created instances of PageController. (flutter/flutter#134091)
2023-09-08 [email protected] Remove non needed controllers in SegmentedButton. (flutter/flutter#134064)
2023-09-08 [email protected] EditableTextState should dispose cursorVisibilityNotifier. (flutter/flutter#133858)
2023-09-08 [email protected] TestWidgetsFlutterBinding should dispose old RestorationManager on reset. (flutter/flutter#133999)
2023-09-08 [email protected] Roll Flutter Engine from 65f6fb841c7a to 505ef3c33102 (4 revisions) (flutter/flutter#134260)
2023-09-07 [email protected] CupertinoAlertDialog should not create ScrollController on every build, if null values are passed in constructor. (flutter/flutter#134075)
2023-09-07 [email protected] Roll Flutter Engine from a828c26e7e97 to 65f6fb841c7a (1 revision) (flutter/flutter#134254)
2023-09-07 [email protected] _SearchBarState should dispose FocusNode, if it created it. (flutter/flutter#134076)
2023-09-07 [email protected] Roll Flutter Engine from 2dba8ceca824 to a828c26e7e97 (8 revisions) (flutter/flutter#134249)
2023-09-07 [email protected] [integration_test] Allow capture of screenshots for `FlutterFragmentActivity`s (flutter/flutter#132406)
2023-09-07 [email protected] Roll Flutter Engine from 8d07c2947e60 to 2dba8ceca824 (2 revisions) (flutter/flutter#134243)
2023-09-07 [email protected] Fix `ExpansionTile` properties cannot be updated with `setState` (flutter/flutter#134218)
2023-09-07 [email protected] [Windows Arm64] Remove device_type property (flutter/flutter#134181)
2023-09-07 [email protected] Roll Flutter Engine from f0b718e28779 to 8d07c2947e60 (3 revisions) (flutter/flutter#134240)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: integration_test The flutter/packages/integration_test plugin framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

integration_test screenshot Android - FlutterFragmentActivity - PlatformException(Could not copy the pixels, FlutterView is null)

3 participants