Skip to content

Commit b16a7e3

Browse files
authored
[many] Remove references to v1 embedding (flutter#6494)
I have a WIP effort to remove the v1 embedding entirely (flutter#146523 is the latest pr). `registerWith` references the v1 embedding, which has been deprecated for many years, so this PR removes it from all plugins. Also removes some additional references, see in particular these three commits: 1. Modifies private `ActivityState` class to remove `PluginRegistry.Registrar` member in `image_picker`: flutter/packages@c2e4c87 2. Replaces `FlutterMain.getLookupKeyForAsset()` with `FlutterLoader.getLookupKeyForAsset()` in `google_maps` plugin: flutter/packages@73c3de3 3. Removes deprecated `RegistrarFlutterAssetManager` class in `webview_flutter`: flutter/packages@cc842c6 Fixes flutter#70923
1 parent b4d134e commit b16a7e3

File tree

61 files changed

+140
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+140
-435
lines changed

packages/camera/camera_android/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 0.10.9+3
22

3-
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
45

56
## 0.10.9+2
67

packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*
2020
* <p>Instantiate this in an add to app scenario to gracefully handle activity and context changes.
2121
* See {@code io.flutter.plugins.camera.MainActivity} for an example.
22-
*
23-
* <p>Call {@link #registerWith(io.flutter.plugin.common.PluginRegistry.Registrar)} to register an
24-
* implementation of this that uses the stable {@code io.flutter.plugin.common} package.
2522
*/
2623
public final class CameraPlugin implements FlutterPlugin, ActivityAware {
2724

@@ -36,24 +33,6 @@ public final class CameraPlugin implements FlutterPlugin, ActivityAware {
3633
*/
3734
public CameraPlugin() {}
3835

39-
/**
40-
* Registers a plugin implementation that uses the stable {@code io.flutter.plugin.common}
41-
* package.
42-
*
43-
* <p>Calling this automatically initializes the plugin. However plugins initialized this way
44-
* won't react to changes in activity or context, unlike {@link CameraPlugin}.
45-
*/
46-
@SuppressWarnings("deprecation")
47-
public static void registerWith(
48-
@NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
49-
CameraPlugin plugin = new CameraPlugin();
50-
plugin.maybeStartListening(
51-
registrar.activity(),
52-
registrar.messenger(),
53-
registrar::addRequestPermissionsResultListener,
54-
registrar.view());
55-
}
56-
5736
@Override
5837
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
5938
this.flutterPluginBinding = binding;

packages/camera/camera_android/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Demonstrates how to use the camera plugin.
33
publish_to: none
44

55
environment:
6-
sdk: ^3.2.0
7-
flutter: ">=3.16.0"
6+
sdk: ^3.4.0
7+
flutter: ">=3.22.0"
88

99
dependencies:
1010
camera_android:

packages/camera/camera_android/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ description: Android implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
55

6-
version: 0.10.9+2
6+
version: 0.10.9+3
77

88
environment:
9-
sdk: ^3.2.0
10-
flutter: ">=3.16.0"
9+
sdk: ^3.4.0
10+
flutter: ">=3.22.0"
1111

1212
flutter:
1313
plugin:

packages/espresso/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 0.3.0+9
22

3-
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
45

56
## 0.3.0+8
67

packages/espresso/android/src/main/java/com/example/espresso/EspressoPlugin.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBindin
2020
channel.setMethodCallHandler(new EspressoPlugin());
2121
}
2222

23-
// This static function is optional and equivalent to onAttachedToEngine. It supports the old
24-
// pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
25-
// plugin registration via this function while apps migrate to use the new Android APIs
26-
// post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
27-
//
28-
// It is encouraged to share logic between onAttachedToEngine and registerWith to keep
29-
// them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
30-
// depending on the user's project. onAttachedToEngine or registerWith must both be defined
31-
// in the same class.
32-
@SuppressWarnings("deprecation")
33-
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
34-
final MethodChannel channel = new MethodChannel(registrar.messenger(), "espresso");
35-
channel.setMethodCallHandler(new EspressoPlugin());
36-
}
37-
3823
@Override
3924
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
4025
if (call.method.equals("getPlatformVersion")) {

packages/espresso/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Demonstrates how to use the espresso plugin.
33
publish_to: none
44

55
environment:
6-
sdk: ^3.2.0
7-
flutter: ">=3.16.0"
6+
sdk: ^3.4.0
7+
flutter: ">=3.22.0"
88

99
dependencies:
1010
flutter:

packages/espresso/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ description: Java classes for testing Flutter apps using Espresso.
33
Allows driving Flutter widgets from a native Espresso test.
44
repository: https://github.com/flutter/packages/tree/main/packages/espresso
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+espresso%22
6-
version: 0.3.0+8
6+
version: 0.3.0+9
77

88
environment:
9-
sdk: ^3.2.0
10-
flutter: ">=3.16.0"
9+
sdk: ^3.4.0
10+
flutter: ">=3.22.0"
1111

1212
flutter:
1313
plugin:

packages/flutter_plugin_android_lifecycle/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 2.0.20
22

3-
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
45

56
## 2.0.19
67

packages/flutter_plugin_android_lifecycle/android/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle/FlutterAndroidLifecyclePlugin.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
* <p><strong>DO NOT USE THIS CLASS.</strong>
1515
*/
1616
public class FlutterAndroidLifecyclePlugin implements FlutterPlugin {
17-
@SuppressWarnings("deprecation")
18-
public static void registerWith(
19-
@NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
20-
// no-op
21-
}
2217

2318
@Override
2419
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {

packages/flutter_plugin_android_lifecycle/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Demonstrates how to use the flutter_plugin_android_lifecycle plugin
33
publish_to: none
44

55
environment:
6-
sdk: ^3.2.0
7-
flutter: ">=3.16.0"
6+
sdk: ^3.4.0
7+
flutter: ">=3.22.0"
88

99
dependencies:
1010
flutter:

packages/flutter_plugin_android_lifecycle/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: flutter_plugin_android_lifecycle
22
description: Flutter plugin for accessing an Android Lifecycle within other plugins.
33
repository: https://github.com/flutter/packages/tree/main/packages/flutter_plugin_android_lifecycle
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_plugin_android_lifecycle%22
5-
version: 2.0.19
5+
version: 2.0.20
66

77
environment:
8-
sdk: ^3.2.0
9-
flutter: ">=3.16.0"
8+
sdk: ^3.4.0
9+
flutter: ">=3.22.0"
1010

1111
flutter:
1212
plugin:

packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 2.8.1
22

3-
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
45

56
## 2.8.0
67

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.google.android.gms.maps.model.SquareCap;
2727
import com.google.android.gms.maps.model.Tile;
2828
import com.google.maps.android.clustering.Cluster;
29+
import io.flutter.FlutterInjector;
2930
import java.util.ArrayList;
3031
import java.util.Arrays;
3132
import java.util.HashMap;
@@ -36,9 +37,6 @@
3637
/** Conversions between JSON-like values and GoogleMaps data types. */
3738
class Convert {
3839

39-
// TODO(hamdikahloun): FlutterMain has been deprecated and should be replaced with FlutterLoader
40-
// when it's available in Stable channel: https://github.com/flutter/flutter/issues/70923.
41-
@SuppressWarnings("deprecation")
4240
private static BitmapDescriptor toBitmapDescriptor(Object o) {
4341
final List<?> data = toList(o);
4442
switch (toString(data.get(0))) {
@@ -51,16 +49,21 @@ private static BitmapDescriptor toBitmapDescriptor(Object o) {
5149
case "fromAsset":
5250
if (data.size() == 2) {
5351
return BitmapDescriptorFactory.fromAsset(
54-
io.flutter.view.FlutterMain.getLookupKeyForAsset(toString(data.get(1))));
52+
FlutterInjector.instance()
53+
.flutterLoader()
54+
.getLookupKeyForAsset(toString(data.get(1))));
5555
} else {
5656
return BitmapDescriptorFactory.fromAsset(
57-
io.flutter.view.FlutterMain.getLookupKeyForAsset(
58-
toString(data.get(1)), toString(data.get(2))));
57+
FlutterInjector.instance()
58+
.flutterLoader()
59+
.getLookupKeyForAsset(toString(data.get(1)), toString(data.get(2))));
5960
}
6061
case "fromAssetImage":
6162
if (data.size() == 3) {
6263
return BitmapDescriptorFactory.fromAsset(
63-
io.flutter.view.FlutterMain.getLookupKeyForAsset(toString(data.get(1))));
64+
FlutterInjector.instance()
65+
.flutterLoader()
66+
.getLookupKeyForAsset(toString(data.get(1))));
6467
} else {
6568
throw new IllegalArgumentException(
6669
"'fromAssetImage' Expected exactly 3 arguments, got: " + data.size());

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,41 +30,6 @@ public class GoogleMapsPlugin implements FlutterPlugin, ActivityAware {
3030

3131
private static final String VIEW_TYPE = "plugins.flutter.dev/google_maps_android";
3232

33-
@SuppressWarnings("deprecation")
34-
public static void registerWith(
35-
@NonNull final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
36-
final Activity activity = registrar.activity();
37-
if (activity == null) {
38-
// When a background flutter view tries to register the plugin, the registrar has no activity.
39-
// We stop the registration process as this plugin is foreground only.
40-
return;
41-
}
42-
if (activity instanceof LifecycleOwner) {
43-
registrar
44-
.platformViewRegistry()
45-
.registerViewFactory(
46-
VIEW_TYPE,
47-
new GoogleMapFactory(
48-
registrar.messenger(),
49-
registrar.context(),
50-
new LifecycleProvider() {
51-
@Override
52-
public Lifecycle getLifecycle() {
53-
return ((LifecycleOwner) activity).getLifecycle();
54-
}
55-
}));
56-
} else {
57-
registrar
58-
.platformViewRegistry()
59-
.registerViewFactory(
60-
VIEW_TYPE,
61-
new GoogleMapFactory(
62-
registrar.messenger(),
63-
registrar.context(),
64-
new ProxyLifecycleProvider(activity)));
65-
}
66-
}
67-
6833
public GoogleMapsPlugin() {}
6934

7035
// FlutterPlugin

packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Demonstrates how to use the google_maps_flutter plugin.
33
publish_to: none
44

55
environment:
6-
sdk: ^3.2.0
7-
flutter: ">=3.16.0"
6+
sdk: ^3.4.0
7+
flutter: ">=3.22.0"
88

99
dependencies:
1010
cupertino_icons: ^1.0.5

packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: google_maps_flutter_android
22
description: Android implementation of the google_maps_flutter plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
5-
version: 2.8.0
5+
version: 2.8.1
66

77
environment:
8-
sdk: ^3.2.0
9-
flutter: ">=3.16.0"
8+
sdk: ^3.4.0
9+
flutter: ">=3.22.0"
1010

1111
flutter:
1212
plugin:

packages/google_sign_in/google_sign_in_android/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 6.1.24
22

3-
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
45

56
## 6.1.23
67

packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ public class GoogleSignInPlugin implements FlutterPlugin, ActivityAware {
4949
private @Nullable BinaryMessenger messenger;
5050
private ActivityPluginBinding activityPluginBinding;
5151

52-
@SuppressWarnings("deprecation")
53-
public static void registerWith(
54-
@NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
55-
GoogleSignInPlugin instance = new GoogleSignInPlugin();
56-
instance.initInstance(registrar.messenger(), registrar.context(), new GoogleSignInWrapper());
57-
instance.setUpRegistrar(registrar);
58-
}
59-
6052
@VisibleForTesting
6153
public void initInstance(
6254
@NonNull BinaryMessenger messenger,

packages/google_sign_in/google_sign_in_android/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Example of Google Sign-In plugin.
33
publish_to: none
44

55
environment:
6-
sdk: ^3.2.0
7-
flutter: ">=3.16.0"
6+
sdk: ^3.4.0
7+
flutter: ">=3.22.0"
88

99
dependencies:
1010
flutter:

packages/google_sign_in/google_sign_in_android/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: google_sign_in_android
22
description: Android implementation of the google_sign_in plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
5-
version: 6.1.23
5+
version: 6.1.24
66

77
environment:
8-
sdk: ^3.2.0
9-
flutter: ">=3.16.0"
8+
sdk: ^3.4.0
9+
flutter: ">=3.22.0"
1010

1111
flutter:
1212
plugin:

packages/image_picker/image_picker_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.8.12+2
2+
3+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Removes support for apps using the v1 Android embedding.
5+
16
## 0.8.12+1
27

38
* Fixes another app crash case on Android 12+, and refactors getting of paths from intents.

0 commit comments

Comments
 (0)