Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 0e27dc2

Browse files
authored
Add deprecation suppression for plugins marked with -Werror (#3072)
1 parent 5a183ac commit 0e27dc2

File tree

109 files changed

+264
-141
lines changed

Some content is hidden

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

109 files changed

+264
-141
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+
## 0.4.5+14
2+
3+
* Keep handling deprecated Android v1 classes for backward compatibility.
4+
15
## 0.4.5+13
26

37
* Android Code Inspection and Clean up.

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import android.util.Log;
1414
import androidx.core.app.AlarmManagerCompat;
1515
import androidx.core.app.JobIntentService;
16-
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
1716
import java.util.Collections;
1817
import java.util.HashMap;
1918
import java.util.HashSet;
@@ -91,15 +90,18 @@ public static void setCallbackDispatcher(Context context, long callbackHandle) {
9190
}
9291

9392
/**
94-
* Sets the {@link PluginRegistrantCallback} used to register the plugins used by an application
95-
* with the newly spawned background isolate.
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.
9695
*
9796
* <p>This should be invoked in {@link Application.onCreate} with {@link
9897
* GeneratedPluginRegistrant} in applications using the V1 embedding API in order to use other
9998
* plugins in the background isolate. For applications using the V2 embedding API, it is not
100-
* necessary to set a {@link PluginRegistrantCallback} as plugins are registered automatically.
99+
* necessary to set a {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} as
100+
* plugins are registered automatically.
101101
*/
102-
public static void setPluginRegistrant(PluginRegistrantCallback callback) {
102+
@SuppressWarnings("deprecation")
103+
public static void setPluginRegistrant(
104+
io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) {
103105
// Indirectly set in FlutterBackgroundExecutor for backwards compatibility.
104106
FlutterBackgroundExecutor.setPluginRegistrant(callback);
105107
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
import android.content.Context;
88
import android.util.Log;
9+
import io.flutter.embedding.engine.FlutterEngine;
910
import io.flutter.embedding.engine.plugins.FlutterPlugin;
1011
import io.flutter.plugin.common.BinaryMessenger;
1112
import io.flutter.plugin.common.JSONMethodCodec;
1213
import io.flutter.plugin.common.MethodCall;
1314
import io.flutter.plugin.common.MethodChannel;
1415
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
1516
import io.flutter.plugin.common.MethodChannel.Result;
16-
import io.flutter.plugin.common.PluginRegistry.Registrar;
17-
import io.flutter.view.FlutterNativeView;
1817
import org.json.JSONArray;
1918
import org.json.JSONException;
2019

@@ -28,8 +27,8 @@
2827
* <li>The Dart side of this plugin sends the Android side a "AlarmService.start" message, along
2928
* with a Dart callback handle for a Dart callback that should be immediately invoked by a
3029
* background Dart isolate.
31-
* <li>The Android side of this plugin spins up a background {@link FlutterNativeView}, which
32-
* includes a background Dart isolate.
30+
* <li>The Android side of this plugin spins up a background {@link FlutterEngine}, which includes
31+
* a background Dart isolate.
3332
* <li>The Android side of this plugin instructs the new background Dart isolate to execute the
3433
* callback that was received in the "AlarmService.start" message.
3534
* <li>The Dart side of this plugin, running within the new background isolate, executes the
@@ -49,12 +48,13 @@ public class AndroidAlarmManagerPlugin implements FlutterPlugin, MethodCallHandl
4948

5049
/**
5150
* Registers this plugin with an associated Flutter execution context, represented by the given
52-
* {@link Registrar}.
51+
* {@link io.flutter.plugin.common.PluginRegistry.Registrar}.
5352
*
5453
* <p>Once this method is executed, an instance of {@code AndroidAlarmManagerPlugin} will be
5554
* connected to, and running against, the associated Flutter execution context.
5655
*/
57-
public static void registerWith(Registrar registrar) {
56+
@SuppressWarnings("deprecation")
57+
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
5858
if (instance == null) {
5959
instance = new AndroidAlarmManagerPlugin();
6060
}

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
import io.flutter.plugin.common.MethodChannel;
2020
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
2121
import io.flutter.plugin.common.MethodChannel.Result;
22-
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
2322
import io.flutter.view.FlutterCallbackInformation;
24-
import io.flutter.view.FlutterMain;
2523
import java.util.concurrent.CountDownLatch;
2624
import java.util.concurrent.atomic.AtomicBoolean;
2725

@@ -32,7 +30,10 @@
3230
public class FlutterBackgroundExecutor implements MethodCallHandler {
3331
private static final String TAG = "FlutterBackgroundExecutor";
3432
private static final String CALLBACK_HANDLE_KEY = "callback_handle";
35-
private static PluginRegistrantCallback pluginRegistrantCallback;
33+
34+
@SuppressWarnings("deprecation")
35+
private static io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
36+
pluginRegistrantCallback;
3637

3738
/**
3839
* The {@link MethodChannel} that connects the Android side of this plugin with the background
@@ -45,14 +46,16 @@ public class FlutterBackgroundExecutor implements MethodCallHandler {
4546
private AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false);
4647

4748
/**
48-
* Sets the {@code PluginRegistrantCallback} used to register plugins with the newly spawned
49-
* isolate.
49+
* Sets the {@code io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to
50+
* register plugins with the newly spawned isolate.
5051
*
5152
* <p>Note: this is only necessary for applications using the V1 engine embedding API as plugins
5253
* are automatically registered via reflection in the V2 engine embedding API. If not set, alarm
5354
* callbacks will not be able to utilize functionality from other plugins.
5455
*/
55-
public static void setPluginRegistrant(PluginRegistrantCallback callback) {
56+
@SuppressWarnings("deprecation")
57+
public static void setPluginRegistrant(
58+
io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) {
5659
pluginRegistrantCallback = callback;
5760
}
5861

@@ -101,7 +104,7 @@ public void onMethodCall(MethodCall call, Result result) {
101104
* <p>The isolate is configured as follows:
102105
*
103106
* <ul>
104-
* <li>Bundle Path: {@code FlutterMain.findAppBundlePath(context)}.
107+
* <li>Bundle Path: {@code io.flutter.view.FlutterMain.findAppBundlePath(context)}.
105108
* <li>Entrypoint: The Dart method used the last time this plugin was initialized in the
106109
* foreground.
107110
* <li>Run args: none.
@@ -130,7 +133,7 @@ public void startBackgroundIsolate(Context context) {
130133
* <p>The isolate is configured as follows:
131134
*
132135
* <ul>
133-
* <li>Bundle Path: {@code FlutterMain.findAppBundlePath(context)}.
136+
* <li>Bundle Path: {@code io.flutter.view.FlutterMain.findAppBundlePath(context)}.
134137
* <li>Entrypoint: The Dart method represented by {@code callbackHandle}.
135138
* <li>Run args: none.
136139
* </ul>
@@ -151,7 +154,8 @@ public void startBackgroundIsolate(Context context, long callbackHandle) {
151154
}
152155

153156
Log.i(TAG, "Starting AlarmService...");
154-
String appBundlePath = FlutterMain.findAppBundlePath();
157+
@SuppressWarnings("deprecation")
158+
String appBundlePath = io.flutter.view.FlutterMain.findAppBundlePath();
155159
AssetManager assets = context.getAssets();
156160
if (!isRunning()) {
157161
backgroundFlutterEngine = new FlutterEngine(context);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package io.flutter.plugins.androidalarmmanagerexample;
22

33
import io.flutter.app.FlutterApplication;
4-
import io.flutter.plugin.common.PluginRegistry;
5-
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
64
import io.flutter.plugins.androidalarmmanager.AlarmService;
75
import io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin;
86

9-
public class Application extends FlutterApplication implements PluginRegistrantCallback {
7+
@SuppressWarnings("deprecation")
8+
public class Application extends FlutterApplication
9+
implements io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback {
1010
@Override
1111
public void onCreate() {
1212
super.onCreate();
1313
AlarmService.setPluginRegistrant(this);
1414
}
1515

1616
@Override
17-
public void registerWith(PluginRegistry registry) {
17+
@SuppressWarnings("deprecation")
18+
public void registerWith(io.flutter.plugin.common.PluginRegistry registry) {
1819
AndroidAlarmManagerPlugin.registerWith(
1920
registry.registrarFor("io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin"));
2021
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
package io.flutter.plugins.androidalarmmanagerexample;
66

77
import android.os.Bundle;
8-
import io.flutter.app.FlutterActivity;
98
import io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin;
109

11-
public class EmbeddingV1Activity extends FlutterActivity {
10+
@SuppressWarnings("deprecation")
11+
public class EmbeddingV1Activity extends io.flutter.app.FlutterActivity {
1212
public static final String TAG = "AlarmExampleMainActivity";
1313

1414
@Override

packages/android_alarm_manager/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Flutter plugin for accessing the Android AlarmManager service, and
44
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
55
# the version to 2.0.0.
66
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7-
version: 0.4.5+13
7+
version: 0.4.5+14
88
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager
99

1010
dependencies:

packages/android_intent/CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.7+4
2+
3+
* Keep handling deprecated Android v1 classes for backward compatibility.
4+
15
## 0.3.7+3
26

37
* Update the `platform` package dependency to resolve the conflict with the latest flutter.
@@ -12,8 +16,8 @@
1216

1317
## 0.3.7
1418

15-
* Add a `Future<bool> canResolveActivity` method to the AndroidIntent class. It
16-
can be used to determine whether a device supports a particular intent or has
19+
* Add a `Future<bool> canResolveActivity` method to the AndroidIntent class. It
20+
can be used to determine whether a device supports a particular intent or has
1721
an app installed that can resolve it. It is based on PackageManager
1822
[resolveActivity](https://developer.android.com/reference/android/content/pm/PackageManager#resolveActivity(android.content.Intent,%20int)).
1923

@@ -36,7 +40,7 @@
3640

3741
## 0.3.5
3842

39-
* Add support for [setType](https://developer.android.com/reference/android/content/Intent.html#setType(java.lang.String)) and [setDataAndType](https://developer.android.com/reference/android/content/Intent.html#setDataAndType(android.net.Uri,%20java.lang.String)) parameters.
43+
* Add support for [setType](https://developer.android.com/reference/android/content/Intent.html#setType(java.lang.String)) and [setDataAndType](https://developer.android.com/reference/android/content/Intent.html#setDataAndType(android.net.Uri,%20java.lang.String)) parameters.
4044

4145
## 0.3.4+8
4246

packages/android_intent/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import io.flutter.embedding.engine.plugins.FlutterPlugin;
55
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
66
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
7-
import io.flutter.plugin.common.PluginRegistry.Registrar;
87

98
/**
109
* Plugin implementation that uses the new {@code io.flutter.embedding} package.
@@ -32,7 +31,8 @@ public AndroidIntentPlugin() {
3231
* <p>Calling this automatically initializes the plugin. However plugins initialized this way
3332
* won't react to changes in activity or context, unlike {@link AndroidIntentPlugin}.
3433
*/
35-
public static void registerWith(Registrar registrar) {
34+
@SuppressWarnings("deprecation")
35+
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
3636
IntentSender sender = new IntentSender(registrar.activity(), registrar.context());
3737
MethodCallHandlerImpl impl = new MethodCallHandlerImpl(sender);
3838
impl.startListening(registrar.messenger());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
package io.flutter.plugins.androidintentexample;
66

77
import android.os.Bundle;
8-
import io.flutter.app.FlutterActivity;
98
import io.flutter.plugins.androidintent.AndroidIntentPlugin;
109

11-
public class EmbeddingV1Activity extends FlutterActivity {
10+
@SuppressWarnings("deprecation")
11+
public class EmbeddingV1Activity extends io.flutter.app.FlutterActivity {
1212
@Override
1313
protected void onCreate(Bundle savedInstanceState) {
1414
super.onCreate(savedInstanceState);

0 commit comments

Comments
 (0)