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

Add deprecation suppression for plugins marked with -Werror #3072

Merged
merged 4 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/android_alarm_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5+14

* Keep handling deprecated Android v1 classes for backward compatibility.

## 0.4.5+13

* Android Code Inspection and Clean up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.util.Log;
import androidx.core.app.AlarmManagerCompat;
import androidx.core.app.JobIntentService;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -91,15 +90,18 @@ public static void setCallbackDispatcher(Context context, long callbackHandle) {
}

/**
* Sets the {@link PluginRegistrantCallback} used to register the plugins used by an application
* with the newly spawned background isolate.
* Sets the {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to
* register the plugins used by an application with the newly spawned background isolate.
*
* <p>This should be invoked in {@link Application.onCreate} with {@link
* GeneratedPluginRegistrant} in applications using the V1 embedding API in order to use other
* plugins in the background isolate. For applications using the V2 embedding API, it is not
* necessary to set a {@link PluginRegistrantCallback} as plugins are registered automatically.
* necessary to set a {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} as
* plugins are registered automatically.
*/
public static void setPluginRegistrant(PluginRegistrantCallback callback) {
@SuppressWarnings("deprecation")
public static void setPluginRegistrant(
io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) {
// Indirectly set in FlutterBackgroundExecutor for backwards compatibility.
FlutterBackgroundExecutor.setPluginRegistrant(callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

import android.content.Context;
import android.util.Log;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.JSONMethodCodec;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.view.FlutterNativeView;
import org.json.JSONArray;
import org.json.JSONException;

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

/**
* Registers this plugin with an associated Flutter execution context, represented by the given
* {@link Registrar}.
* {@link io.flutter.plugin.common.PluginRegistry.Registrar}.
*
* <p>Once this method is executed, an instance of {@code AndroidAlarmManagerPlugin} will be
* connected to, and running against, the associated Flutter execution context.
*/
public static void registerWith(Registrar registrar) {
@SuppressWarnings("deprecation")
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
if (instance == null) {
instance = new AndroidAlarmManagerPlugin();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.view.FlutterCallbackInformation;
import io.flutter.view.FlutterMain;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -32,7 +30,10 @@
public class FlutterBackgroundExecutor implements MethodCallHandler {
private static final String TAG = "FlutterBackgroundExecutor";
private static final String CALLBACK_HANDLE_KEY = "callback_handle";
private static PluginRegistrantCallback pluginRegistrantCallback;

@SuppressWarnings("deprecation")
private static io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
pluginRegistrantCallback;

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

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

Expand Down Expand Up @@ -101,7 +104,7 @@ public void onMethodCall(MethodCall call, Result result) {
* <p>The isolate is configured as follows:
*
* <ul>
* <li>Bundle Path: {@code FlutterMain.findAppBundlePath(context)}.
* <li>Bundle Path: {@code io.flutter.view.FlutterMain.findAppBundlePath(context)}.
* <li>Entrypoint: The Dart method used the last time this plugin was initialized in the
* foreground.
* <li>Run args: none.
Expand Down Expand Up @@ -130,7 +133,7 @@ public void startBackgroundIsolate(Context context) {
* <p>The isolate is configured as follows:
*
* <ul>
* <li>Bundle Path: {@code FlutterMain.findAppBundlePath(context)}.
* <li>Bundle Path: {@code io.flutter.view.FlutterMain.findAppBundlePath(context)}.
* <li>Entrypoint: The Dart method represented by {@code callbackHandle}.
* <li>Run args: none.
* </ul>
Expand All @@ -151,7 +154,8 @@ public void startBackgroundIsolate(Context context, long callbackHandle) {
}

Log.i(TAG, "Starting AlarmService...");
String appBundlePath = FlutterMain.findAppBundlePath();
@SuppressWarnings("deprecation")
String appBundlePath = io.flutter.view.FlutterMain.findAppBundlePath();
AssetManager assets = context.getAssets();
if (!isRunning()) {
backgroundFlutterEngine = new FlutterEngine(context);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package io.flutter.plugins.androidalarmmanagerexample;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.androidalarmmanager.AlarmService;
import io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin;

public class Application extends FlutterApplication implements PluginRegistrantCallback {
@SuppressWarnings("deprecation")
public class Application extends FlutterApplication
implements io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
AlarmService.setPluginRegistrant(this);
}

@Override
public void registerWith(PluginRegistry registry) {
@SuppressWarnings("deprecation")
public void registerWith(io.flutter.plugin.common.PluginRegistry registry) {
AndroidAlarmManagerPlugin.registerWith(
registry.registrarFor("io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
package io.flutter.plugins.androidalarmmanagerexample;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.androidalarmmanager.AndroidAlarmManagerPlugin;

public class EmbeddingV1Activity extends FlutterActivity {
@SuppressWarnings("deprecation")
public class EmbeddingV1Activity extends io.flutter.app.FlutterActivity {
public static final String TAG = "AlarmExampleMainActivity";

@Override
Expand Down
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for accessing the Android AlarmManager service, and
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.4.5+13
version: 0.4.5+14
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager

dependencies:
Expand Down
10 changes: 7 additions & 3 deletions packages/android_intent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.7+4

* Keep handling deprecated Android v1 classes for backward compatibility.

## 0.3.7+3

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

## 0.3.7

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

Expand All @@ -36,7 +40,7 @@

## 0.3.5

* 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.
* 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.

## 0.3.4+8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/**
* Plugin implementation that uses the new {@code io.flutter.embedding} package.
Expand Down Expand Up @@ -32,7 +31,8 @@ public AndroidIntentPlugin() {
* <p>Calling this automatically initializes the plugin. However plugins initialized this way
* won't react to changes in activity or context, unlike {@link AndroidIntentPlugin}.
*/
public static void registerWith(Registrar registrar) {
@SuppressWarnings("deprecation")
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
IntentSender sender = new IntentSender(registrar.activity(), registrar.context());
MethodCallHandlerImpl impl = new MethodCallHandlerImpl(sender);
impl.startListening(registrar.messenger());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
package io.flutter.plugins.androidintentexample;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.androidintent.AndroidIntentPlugin;

public class EmbeddingV1Activity extends FlutterActivity {
@SuppressWarnings("deprecation")
public class EmbeddingV1Activity extends io.flutter.app.FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
2 changes: 1 addition & 1 deletion packages/android_intent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
# 0.3.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.3.7+3
version: 0.3.7+4

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/battery/battery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.6

* Keep handling deprecated Android v1 classes for backward compatibility.

## 1.0.5

* Ported to use platform interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;

/** BatteryPlugin */
public class BatteryPlugin implements MethodCallHandler, StreamHandler, FlutterPlugin {
Expand All @@ -32,7 +31,8 @@ public class BatteryPlugin implements MethodCallHandler, StreamHandler, FlutterP
private EventChannel eventChannel;

/** Plugin registration. */
public static void registerWith(PluginRegistry.Registrar registrar) {
@SuppressWarnings("deprecation")
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
final BatteryPlugin instance = new BatteryPlugin();
instance.onAttachedToEngine(registrar.context(), registrar.messenger());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/battery/battery/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: battery
description: Flutter plugin for accessing information about the battery state
(full, charging, discharging) on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/battery/battery
version: 1.0.5
version: 1.0.6

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.8+7

* Keep handling deprecated Android v1 classes for backward compatibility.

## 0.5.8+6

* Avoiding uses or overrides a deprecated API in CameraPlugin.java.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import androidx.annotation.VisibleForTesting;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener;

final class CameraPermissions {
interface PermissionsRegistry {
void addListener(RequestPermissionsResultListener handler);
@SuppressWarnings("deprecation")
void addListener(
io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener handler);
}

interface ResultCallback {
Expand Down Expand Up @@ -61,8 +61,9 @@ private boolean hasAudioPermission(Activity activity) {
}

@VisibleForTesting
@SuppressWarnings("deprecation")
static final class CameraRequestPermissionsListener
implements PluginRegistry.RequestPermissionsResultListener {
implements io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener {

// There's no way to unregister permission listeners in the v1 embedding, so we'll be called
// duplicate times in cases where the user denies and then grants a permission. Keep track of if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugins.camera.CameraPermissions.PermissionsRegistry;
import io.flutter.view.TextureRegistry;

Expand All @@ -22,8 +21,8 @@
* <p>Instantiate this in an add to app scenario to gracefully handle activity and context changes.
* See {@code io.flutter.plugins.camera.MainActivity} for an example.
*
* <p>Call {@link #registerWith(Registrar)} to register an implementation of this that uses the
* stable {@code io.flutter.plugin.common} package.
* <p>Call {@link #registerWith(io.flutter.plugin.common.PluginRegistry.Registrar)} to register an
* implementation of this that uses the stable {@code io.flutter.plugin.common} package.
*/
public final class CameraPlugin implements FlutterPlugin, ActivityAware {

Expand All @@ -45,7 +44,8 @@ public CameraPlugin() {}
* <p>Calling this automatically initializes the plugin. However plugins initialized this way
* won't react to changes in activity or context, unlike {@link CameraPlugin}.
*/
public static void registerWith(Registrar registrar) {
@SuppressWarnings("deprecation")
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
CameraPlugin plugin = new CameraPlugin();
plugin.maybeStartListening(
registrar.activity(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.junit.runner.RunWith;

@RunWith(FlutterTestRunner.class)
@SuppressWarnings("deprecation")
public class EmbeddingV1ActivityTest {
@Rule
public ActivityTestRule<EmbeddingV1Activity> rule =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import android.os.Bundle;
import dev.flutter.plugins.integration_test.IntegrationTestPlugin;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.camera.CameraPlugin;
import io.flutter.plugins.pathprovider.PathProviderPlugin;
import io.flutter.plugins.videoplayer.VideoPlayerPlugin;

public class EmbeddingV1Activity extends FlutterActivity {
@SuppressWarnings("deprecation")
public class EmbeddingV1Activity extends io.flutter.app.FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.5.8+6
version: 0.5.8+7

homepage: https://github.com/flutter/plugins/tree/master/packages/camera

Expand Down
Loading