Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_maps_flutter] Moves Java->Dart calls to Pigeon #7040

Merged

Conversation

stuartmorgan
Copy link
Contributor

Converts all of the Java->Dart calls from raw method channels to Pigeon. This finishes conversion of all of the invocations in google_maps_flutter_android

Part of flutter/flutter#117907

Pre-launch Checklist


@Override
public void error(@NonNull Throwable error) {}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are because we don't currently have a way in Pigeon to ignore responses. Longer term I think we'll want to convert this over to event channels though; I'm not sure why maps wasn't written using them in the first place, since a stream of one-way calls without responses are the use cases event channels were written for IIUC.

(I'm not doing that conversion as part of this because we don't have event channel support for Pigeon yet; probably in Q3 sometime.)

Copy link
Contributor

Choose a reason for hiding this comment

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

I didnt know event channels existed so maybe the author didnt either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I think of it, I'm not sure when event channels were added, so this code may just predate them.

return data;
}

static Map<String, Object> tileOverlayArgumentsToJson(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change this to stay here and do a Pigeon build if you prefer, but since we have to pass all the arguments individually anyway (vs passing a single object to convert) it seemed easier to just inline it.

@@ -464,36 439,6 @@ static LatLng latLngFromPigeon(Messages.PlatformLatLng latLng) {
return new LatLng(latLng.getLatitude(), latLng.getLongitude());
}

static Object clusterToJson(String clusterManagerId, Cluster<MarkerBuilder> cluster) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is pure removal because the Pigeon version (just below) was added in a previous PR.

@@ -182,10 190,6 @@ void init() {
mapView.getMapAsync(this);
}

private CameraPosition getCameraPosition() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opportunistic cleanup; the IDE flagged that this was unused.

@@ -66,37 65,43 @@ Tile getTile() {
return TileProvider.NO_TILE;
}
try {
return Convert.interpretTile(result);
if (result == null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opportunistic safety fix; the IDE was flagging that we weren't handling null result here.

expect((await markerDragEndStream.next).value.value, equals(dragEndId));
});

test('markers send tap events to correct stream', () async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Longer because I added a bunch of missing test coverage.


@Override
public void error(@NonNull Throwable error) {}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I didnt know event channels existed so maybe the author didnt either.

public void success() {}

@Override
public void error(@NonNull Throwable error) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

I struggle with our guidance to only log actionable errors. My gut is always to log because otherwise you are left guessing if you hit an error condition.
No action needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main reason I didn't add it in this PR is that I know we have a class of issues around lifetime mismatch between native and Dart in Google Maps, and I worry that just adding logging here without deeply investigating those first would cause a bunch of spam where the call fails only because the instance has been eliminated on the Dart side, in which case silently dropping them is better than logging.

}
@SuppressWarnings("unchecked")
final Map<String, ?> tileJson = (Map<String, ?>) result.getJson();
return Convert.interpretTile(tileJson);
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This pr is not the right place but I think we should prefer a more tightly caught exception since this reads like it is catching json exceptions.

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 6, 2024
@auto-submit auto-submit bot merged commit 0b57eca into flutter:main Jul 6, 2024
74 checks passed
@stuartmorgan stuartmorgan deleted the maps-pigeon-android-flutter-api branch July 7, 2024 01:25
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 8, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 8, 2024
flutter/packages@97bad7e...14341d1

2024-07-08 49699333 dependabot[bot]@users.noreply.github.com [sign_in]: Bump com.android.tools.build:gradle from 7.2.1 to 8.5.0 in /packages/google_sign_in/google_sign_in_android/android (flutter/packages#7070)
2024-07-08 49699333 dependabot[bot]@users.noreply.github.com [path_provider]: Bump com.android.tools.build:gradle from 7.3.1 to 8.5.0 in /packages/path_provider/path_provider_android/android (flutter/packages#7068)
2024-07-07 [email protected] Roll Flutter from af913a7 to fafd67d (41 revisions) (flutter/packages#7062)
2024-07-06 [email protected] [rfw] Update goldens. (flutter/packages#6941)
2024-07-06 [email protected] [google_maps_flutter] Moves Java->Dart calls to Pigeon (flutter/packages#7040)

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-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

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

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
…r#151417)

flutter/packages@97bad7e...14341d1

2024-07-08 49699333 dependabot[bot]@users.noreply.github.com [sign_in]: Bump com.android.tools.build:gradle from 7.2.1 to 8.5.0 in /packages/google_sign_in/google_sign_in_android/android (flutter/packages#7070)
2024-07-08 49699333 dependabot[bot]@users.noreply.github.com [path_provider]: Bump com.android.tools.build:gradle from 7.3.1 to 8.5.0 in /packages/path_provider/path_provider_android/android (flutter/packages#7068)
2024-07-07 [email protected] Roll Flutter from af913a7 to fafd67d (41 revisions) (flutter/packages#7062)
2024-07-06 [email protected] [rfw] Update goldens. (flutter/packages#6941)
2024-07-06 [email protected] [google_maps_flutter] Moves Java->Dart calls to Pigeon (flutter/packages#7040)

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-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

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

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Jul 9, 2024
Converts all of the Obj-C->Dart calls from raw method channels to Pigeon. This finishes conversion of all of the invocations in `google_maps_flutter_ios`

This is the iOS equivalent of #7040, and much of the Dart code is based on that PR.

Part of flutter/flutter#117907
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 p: google_maps_flutter platform-android
Projects
None yet
3 participants