Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Android implementation of 'firebase_messaging' to use 'BundleCompat.getSerializable' for safely retrieving metadata from the manifest, improving compatibility across different Android SDK versions. To support this change, the 'androidx.core:core:1.13.1' dependency was added to 'build.gradle', and several test cases in 'FlutterFirebaseMessagingBackgroundGateTest.java' were updated with '@config(sdk = {28, 33, 34})' annotations. There are no review comments, and I have no additional feedback to provide.
| implementation 'com.google.firebase:firebase-messaging' | ||
| implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' | ||
| implementation 'androidx.annotation:annotation:1.7.1' | ||
| implementation 'androidx.core:core:1.13.1' |
There was a problem hiding this comment.
I tried this in a Flutter app (3.44.6, the plugin needs >=3.44.0) with the plugin as a path dependency. With this line removed, :firebase_messaging:compileDebugJavaWithJavac still succeeds. dependencyInsight shows androidx.core:core:1.13.1 coming from io.flutter:flutter_embedding_debug, so BundleCompat is already on the classpath. The 1.2.0 resolution only happens in a Gradle host that doesn't have the Flutter embedding.
The plugin also already imports androidx.core on main (ActivityCompat, NotificationManagerCompat) without declaring it. So I think we can drop this line.
There was a problem hiding this comment.
Thanks, you're right: the earlier isolated Gradle host used the Flutter JAR directly and omitted the embedding's Maven dependency graph. Removed the explicit Core dependency in a5ee59f and rechecked with the local plugins as path dependencies in a real Flutter Android app (3.51.0-1.0.pre-31, framework fffd8c22ae). dependencyInsight confirms Core 1.13.1 comes from io.flutter:flutter_embedding_debug. Java compilation and all 40 Android unit tests pass (compile SDK 36). Updated the description to reflect this validation.
AI assistance: OpenCode (gpt-6.1-sol); commands executed by the agent.
| } | ||
|
|
||
| @Test | ||
| @Config(sdk = {28, 33, 34}) |
There was a problem hiding this comment.
nit: in core 1.13.1, BundleCompat.getSerializable only uses the typed platform getter from API 34, so 33 goes through the same branch as 28. {28, 34} covers both sides (same for the two tests below).
There was a problem hiding this comment.
Updated all three manifest scenarios to {28, 34} in a5ee59f to cover the two BundleCompat branches without repeating API 33. All 40 remaining Android unit-test executions passed, including these scenarios on both API levels.
AI assistance: OpenCode (gpt-6.1-sol).
Description
Read background-handler manifest metadata with AndroidX
BundleCompat.getSerializableinstead of deprecatedBaseBundle.get(String). The accepted Boolean/String values and absent/invalid/true/false behavior are unchanged.Use the AndroidX Core dependency already supplied by Flutter embedding. The receiver-level manifest scenarios cover API 28 and 34, the two branches used by Core 1.13.1. No token API changes are included; #18780 handles that migration.
Validation
a5ee59fwith the checked-outfirebase_coreandfirebase_messagingas path dependencies in a generated Flutter Android app (Flutter3.51.0-1.0.pre-31, frameworkfffd8c22ae, Java 17). Native plugin compile SDK was set to 36 by an external Gradle init script for compatibility with Robolectric 4.14.1.:firebase_messaging:dependencyInsight --dependency androidx.core:core --configuration debugCompileClasspathconfirms Core 1.13.1 is provided byio.flutter:flutter_embedding_debug, without the removed declaration.:firebase_messaging:compileDebugJavaWithJavacand:firebase_messaging:testDebugUnitTestpassed: 40 tests, 0 failures, 0 errors, 0 skipped across all five Android suites. The three removed executions are the duplicate API 33 manifest scenarios. Gradle result:BUILD SUCCESSFUL in 3m 4s.AI assistance: OpenCode (gpt-6.1-sol); validation commands were executed by the agent.