Skip to content

Commit e843c03

Browse files
author
Emmanuel Garcia
authored
Remove references to the V1 Android embedding (flutter#4160)
1 parent dd66f34 commit e843c03

File tree

93 files changed

+123
-1084
lines changed

Some content is hidden

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

93 files changed

+123
-1084
lines changed

packages/android_alarm_manager/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Remove support for the V1 Android embedding.
4+
15
## 2.0.2
26

37
* Update README to point to Plus Plugins version.

packages/android_alarm_manager/README.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -74,55 +74,6 @@ will not run in the same isolate as the main application. Unlike threads, isolat
7474
memory and communication between isolates must be done via message passing (see more documentation on
7575
isolates [here](https://api.dart.dev/stable/2.0.0/dart-isolate/dart-isolate-library.html)).
7676

77-
78-
## Using other plugins in alarm callbacks
79-
80-
If alarm callbacks will need access to other Flutter plugins, including the
81-
alarm manager plugin itself, it may be necessary to inform the background service how
82-
to initialize plugins depending on which Flutter Android embedding the application is
83-
using.
84-
85-
### Flutter Android Embedding V1
86-
87-
For the Flutter Android Embedding V1, the background service must be provided a
88-
callback to register plugins with the background isolate. This is done by giving
89-
the `AlarmService` a callback to call the application's `onCreate` method. See the example's
90-
[Application overrides](https://github.com/flutter/plugins/blob/master/packages/android_alarm_manager/example/android/app/src/main/java/io/flutter/plugins/androidalarmmanagerexample/Application.java).
91-
92-
In particular, its `Application` class is as follows:
93-
94-
```java
95-
public class Application extends FlutterApplication implements PluginRegistrantCallback {
96-
@Override
97-
public void onCreate() {
98-
super.onCreate();
99-
AlarmService.setPluginRegistrant(this);
100-
}
101-
102-
@Override
103-
public void registerWith(PluginRegistry registry) {
104-
GeneratedPluginRegistrant.registerWith(registry);
105-
}
106-
}
107-
```
108-
109-
Which must be reflected in the application's `AndroidManifest.xml`. E.g.:
110-
111-
```xml
112-
<application
113-
android:name=".Application"
114-
...
115-
```
116-
117-
**Note:** Not calling `AlarmService.setPluginRegistrant` will result in an exception being
118-
thrown when an alarm eventually fires.
119-
120-
### Flutter Android Embedding V2
121-
122-
For the Flutter Android Embedding V2, plugins are registered with the background
123-
isolate via reflection so `AlarmService.setPluginRegistrant` does not need to be
124-
called.
125-
12677
For help getting started with Flutter, view our online
12778
[documentation](https://flutter.dev/).
12879

packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ public static void enqueueAlarmProcessing(Context context, Intent alarmContext)
4949
* <ul>
5050
* <li>The given {@code callbackHandle} must correspond to a registered Dart callback. If the
5151
* handle does not resolve to a Dart callback then this method does nothing.
52-
* <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
53-
* PluginRegistrantException} will be thrown.
5452
* </ul>
5553
*/
5654
public static void startBackgroundIsolate(Context context, long callbackHandle) {
@@ -89,23 +87,6 @@ public static void setCallbackDispatcher(Context context, long callbackHandle) {
8987
FlutterBackgroundExecutor.setCallbackDispatcher(context, callbackHandle);
9088
}
9189

92-
/**
93-
* Sets the {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to
94-
* register the plugins used by an application with the newly spawned background isolate.
95-
*
96-
* <p>This should be invoked in {@link Application.onCreate} with {@link
97-
* GeneratedPluginRegistrant} in applications using the V1 embedding API in order to use other
98-
* plugins in the background isolate. For applications using the V2 embedding API, it is not
99-
* necessary to set a {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} as
100-
* plugins are registered automatically.
101-
*/
102-
@SuppressWarnings("deprecation")
103-
public static void setPluginRegistrant(
104-
io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) {
105-
// Indirectly set in FlutterBackgroundExecutor for backwards compatibility.
106-
FlutterBackgroundExecutor.setPluginRegistrant(callback);
107-
}
108-
10990
private static void scheduleAlarm(
11091
Context context,
11192
int requestCode,

packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AndroidAlarmManagerPlugin.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ public void onMethodCall(MethodCall call, Result result) {
147147
}
148148
} catch (JSONException e) {
149149
result.error("error", "JSON error: " + e.getMessage(), null);
150-
} catch (PluginRegistrantException e) {
151-
result.error("error", "AlarmManager error: " + e.getMessage(), null);
152150
}
153151
}
154152

packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/FlutterBackgroundExecutor.java

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ public class FlutterBackgroundExecutor implements MethodCallHandler {
4545

4646
private AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false);
4747

48-
/**
49-
* Sets the {@code io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to
50-
* register plugins with the newly spawned isolate.
51-
*
52-
* <p>Note: this is only necessary for applications using the V1 engine embedding API as plugins
53-
* are automatically registered via reflection in the V2 engine embedding API. If not set, alarm
54-
* callbacks will not be able to utilize functionality from other plugins.
55-
*/
56-
@SuppressWarnings("deprecation")
57-
public static void setPluginRegistrant(
58-
io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) {
59-
pluginRegistrantCallback = callback;
60-
}
61-
6248
/**
6349
* Sets the Dart callback handle for the Dart method that is responsible for initializing the
6450
* background Dart isolate, preparing it to receive Dart callback tasks requests.
@@ -81,19 +67,15 @@ private void onInitialized() {
8167
@Override
8268
public void onMethodCall(MethodCall call, Result result) {
8369
String method = call.method;
84-
try {
85-
if (method.equals("AlarmService.initialized")) {
86-
// This message is sent by the background method channel as soon as the background isolate
87-
// is running. From this point forward, the Android side of this plugin can send
88-
// callback handles through the background method channel, and the Dart side will execute
89-
// the Dart methods corresponding to those callback handles.
90-
onInitialized();
91-
result.success(true);
92-
} else {
93-
result.notImplemented();
94-
}
95-
} catch (PluginRegistrantException e) {
96-
result.error("error", "AlarmManager error: " + e.getMessage(), null);
70+
if (method.equals("AlarmService.initialized")) {
71+
// This message is sent by the background method channel as soon as the background isolate
72+
// is running. From this point forward, the Android side of this plugin can send
73+
// callback handles through the background method channel, and the Dart side will execute
74+
// the Dart methods corresponding to those callback handles.
75+
onInitialized();
76+
result.success(true);
77+
} else {
78+
result.notImplemented();
9779
}
9880
}
9981

@@ -115,8 +97,6 @@ public void onMethodCall(MethodCall call, Result result) {
11597
* <ul>
11698
* <li>The given callback must correspond to a registered Dart callback. If the handle does not
11799
* resolve to a Dart callback then this method does nothing.
118-
* <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
119-
* PluginRegistrantException} will be thrown.
120100
* </ul>
121101
*/
122102
public void startBackgroundIsolate(Context context) {
@@ -143,8 +123,6 @@ public void startBackgroundIsolate(Context context) {
143123
* <ul>
144124
* <li>The given {@code callbackHandle} must correspond to a registered Dart callback. If the
145125
* handle does not resolve to a Dart callback then this method does nothing.
146-
* <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
147-
* PluginRegistrantException} will be thrown.
148126
* </ul>
149127
*/
150128
public void startBackgroundIsolate(Context context, long callbackHandle) {

packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/PluginRegistrantException.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/android_alarm_manager/example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,8 @@
66
<uses-permission android:name="android.permission.INTERNET"/>
77

88
<application
9-
android:name=".Application"
109
android:label="android_alarm_manager_example"
1110
android:icon="@mipmap/ic_launcher">
12-
<activity
13-
android:name="io.flutter.plugins.androidalarmmanagerexample.EmbeddingV1Activity"
14-
android:launchMode="singleTop"
15-
android:theme="@style/LaunchTheme"
16-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
17-
android:hardwareAccelerated="true"
18-
android:windowSoftInputMode="adjustResize"
19-
android:exported="true">
20-
</activity>
2111
<activity
2212
android:name="io.flutter.embedding.android.FlutterActivity"
2313
android:launchMode="singleTop"

packages/android_alarm_manager/example/android/app/src/main/java/io/flutter/plugins/androidalarmmanagerexample/Application.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/android_alarm_manager/example/android/app/src/main/java/io/flutter/plugins/androidalarmmanagerexample/EmbeddingV1Activity.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/android_intent/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Remove references to the V1 Android embedding.
4+
15
## 2.0.2
26

37
* Update README to point to Plus Plugins version.

packages/android_intent/example/android/app/src/androidTestDebug/java/io/flutter/plugins/androidintentexample/EmbeddingV1ActivityTest.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/android_intent/example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="io.flutter.plugins.androidintentexample">
3-
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
93
<application
104
android:icon="@mipmap/ic_launcher"
11-
android:label="android_intent_example"
12-
android:name="io.flutter.app.FlutterApplication">
13-
<activity
14-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
15-
android:name=".EmbeddingV1Activity"
16-
android:theme="@android:style/Theme.Black.NoTitleBar"
17-
android:hardwareAccelerated="true"
18-
android:windowSoftInputMode="adjustResize">
19-
</activity>
20-
5+
android:label="android_intent_example">
216
<activity android:name="io.flutter.embedding.android.FlutterActivity"
227
android:theme="@android:style/Theme.Black.NoTitleBar"
238
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"

packages/android_intent/example/android/app/src/main/java/io/flutter/plugins/androidintentexample/EmbeddingV1Activity.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/camera/camera/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
## 0.8.1+6
2+
3+
* Remove references to the Android V1 embedding.
4+
15
## 0.8.1+5
26

3-
* Make sure the `setFocusPoint` and `setExposurePoint` coordinates work correctly in all orientations on iOS (instead of only in portrait mode).
7+
* Make sure the `setFocusPoint` and `setExposurePoint` coordinates work correctly in all orientations on iOS (instead of only in portrait mode).
48

59
## 0.8.1+4
610

packages/camera/camera/example/android/app/src/androidTestDebug/java/io/flutter/plugins/cameraexample/EmbeddingV1ActivityTest.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/camera/camera/example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@
33

44
<application
55
android:icon="@mipmap/ic_launcher"
6-
android:label="camera_example"
7-
android:name="io.flutter.app.FlutterApplication">
8-
<activity
9-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
10-
android:hardwareAccelerated="true"
11-
android:launchMode="singleTop"
12-
android:exported="true"
13-
android:name=".EmbeddingV1Activity"
14-
android:theme="@style/LaunchTheme"
15-
android:windowSoftInputMode="adjustResize">
16-
<meta-data
17-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
18-
android:value="true"/>
19-
</activity>
6+
android:label="camera_example">
207
<activity
218
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
229
android:hardwareAccelerated="true"

0 commit comments

Comments
 (0)