From 0feac17b74b57cd486f33fbc10d81034e378bc18 Mon Sep 17 00:00:00 2001 From: Mikkel Ravn Date: Wed, 28 Feb 2018 09:58:22 +0100 Subject: [PATCH 1/2] Make deprecated API unavailable after grace period --- .../flutter/app/FlutterActivityDelegate.java | 12 ++++---- .../io/flutter/app/FlutterActivityEvents.java | 2 -- .../io/flutter/app/FlutterPluginRegistry.java | 29 ++++++++----------- .../flutter/plugin/common/PluginRegistry.java | 26 ++++++++--------- 4 files changed, 30 insertions(+), 39 deletions(-) diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index b136dd377bc30..7250bfb1eb100 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -125,12 +125,12 @@ public boolean onRequestPermissionsResult( return flutterView.getPluginRegistry().onRequestPermissionsResult(requestCode, permissions, grantResults); } - @Override - @Deprecated - public boolean onRequestPermissionResult( - int requestCode, String[] permissions, int[] grantResults) { - return onRequestPermissionsResult(requestCode, permissions, grantResults); - } + /* + * Method onRequestPermissionResult(int, String[], int[]) was made + * unavailable on 2018-02-28, following deprecation. This comment is left as + * a temporary tombstone for reference, to be removed on 2018-03-28 (or at + * least four weeks after release of unavailability). + */ @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { diff --git a/shell/platform/android/io/flutter/app/FlutterActivityEvents.java b/shell/platform/android/io/flutter/app/FlutterActivityEvents.java index cc62327ba3e89..98a3a1016c85f 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityEvents.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityEvents.java @@ -8,7 +8,6 @@ import android.content.Intent; import android.os.Bundle; import io.flutter.plugin.common.PluginRegistry.ActivityResultListener; -import io.flutter.plugin.common.PluginRegistry.RequestPermissionResultListener; import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener; /** @@ -24,7 +23,6 @@ public interface FlutterActivityEvents extends ComponentCallbacks2, ActivityResultListener, - RequestPermissionResultListener, RequestPermissionsResultListener { /** * @see android.app.Activity#onCreate(android.os.Bundle) diff --git a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 9991d98d27774..223105167616c 100644 --- a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -20,7 +20,6 @@ public class FlutterPluginRegistry implements PluginRegistry, - PluginRegistry.RequestPermissionResultListener, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, @@ -118,17 +117,12 @@ public Registrar publish(Object value) { return this; } - @Override - @Deprecated - public Registrar addRequestPermissionResultListener( - final RequestPermissionResultListener listener) { - return addRequestPermissionsResultListener(new RequestPermissionsResultListener() { - @Override - public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - return listener.onRequestPermissionResult(requestCode, permissions, grantResults); - } - }); - } + /* + * Method addRequestPermissionResultListener(RequestPermissionResultListener) + * was made unavailable on 2018-02-28, following deprecation. + * This comment is left as a temporary tombstone for reference, to be removed + * on 2018-03-28 (or at least four weeks after release of unavailability). + */ @Override public Registrar addRequestPermissionsResultListener( @@ -172,11 +166,12 @@ public boolean onRequestPermissionsResult(int requestCode, String[] permissions, return false; } - @Deprecated - @Override - public boolean onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) { - return onRequestPermissionsResult(requestCode, permissions, grantResults); - } + /* + * Method onRequestPermissionResult(int, String[], int[]) was made + * unavailable on 2018-02-28, following deprecation. This comment is left as + * a temporary tombstone for reference, to be removed on 2018-03-28 (or at + * least four weeks after release of unavailability). + */ @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { diff --git a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index c580f563bc8f7..c697dc3628cfe 100644 --- a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -132,7 +132,12 @@ interface Registrar { */ Registrar addRequestPermissionsResultListener(RequestPermissionsResultListener listener); - /** + /* + * Method addRequestPermissionResultListener(RequestPermissionResultListener listener) + * was made unavailable on 2018-02-28, leaving this comment as a temporary + * tombstone for reference. This comment will be removed on 2018-03-28 + * (or at least four weeks after the unavailability is released). + * * Adds a callback allowing the plugin to take part in handling incoming * calls to {@code Activity#onRequestPermissionsResult(int, String[], int[])} * or {@code android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int, String[], int[])}. @@ -144,8 +149,6 @@ interface Registrar { * on 2018-02-06 (or at least four weeks after the deprecation is released). Use * {@link #addRequestPermissionsResultListener(RequestPermissionsResultListener)} instead. */ - @Deprecated - Registrar addRequestPermissionResultListener(RequestPermissionResultListener listener); /** * Adds a callback allowing the plugin to take part in handling incoming @@ -195,7 +198,12 @@ interface RequestPermissionsResultListener { boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults); } - /** + /* + * interface RequestPermissionResultListener was made unavailable on + * 2018-02-28, leaving this comment as a temporary tombstone for reference. + * This comment will be removed on 2018-03-28 (or at least four weeks after + * the unavailability is released). + * * Delegate interface for handling result of permissions requests on * behalf of the main {@link Activity}. * @@ -203,16 +211,6 @@ interface RequestPermissionsResultListener { * unavailable on 2018-02-06 (or at least four weeks after the deprecation is released). * Use {@link RequestPermissionsResultListener} instead. */ - interface RequestPermissionResultListener { - /** - * @return true if the result has been handled. - * @deprecated on 2018-01-02 because of misspelling. This method will be made - * unavailable on 2018-02-06 (or at least four weeks after the deprecation is released). - * Use {@link RequestPermissionsResultListener} instead. - */ - @Deprecated - boolean onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults); - } /** * Delegate interface for handling activity results on behalf of the main From d459201e490627baf5e90e63c6abc8ec9f1970f3 Mon Sep 17 00:00:00 2001 From: Mikkel Ravn Date: Wed, 28 Feb 2018 10:11:04 +0100 Subject: [PATCH 2/2] Add reference to changelog entry --- .../android/io/flutter/app/FlutterActivityDelegate.java | 2 ++ .../android/io/flutter/app/FlutterPluginRegistry.java | 4 ++++ .../android/io/flutter/plugin/common/PluginRegistry.java | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 7250bfb1eb100..9de35c4b480a7 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -130,6 +130,8 @@ public boolean onRequestPermissionsResult( * unavailable on 2018-02-28, following deprecation. This comment is left as * a temporary tombstone for reference, to be removed on 2018-03-28 (or at * least four weeks after release of unavailability). + * + * https://github.com/flutter/flutter/wiki/Changelog#typo-fixed-in-flutter-engine-android-api */ @Override diff --git a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 223105167616c..67b6cbab44c68 100644 --- a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -122,6 +122,8 @@ public Registrar publish(Object value) { * was made unavailable on 2018-02-28, following deprecation. * This comment is left as a temporary tombstone for reference, to be removed * on 2018-03-28 (or at least four weeks after release of unavailability). + * + * https://github.com/flutter/flutter/wiki/Changelog#typo-fixed-in-flutter-engine-android-api */ @Override @@ -171,6 +173,8 @@ public boolean onRequestPermissionsResult(int requestCode, String[] permissions, * unavailable on 2018-02-28, following deprecation. This comment is left as * a temporary tombstone for reference, to be removed on 2018-03-28 (or at * least four weeks after release of unavailability). + * + * https://github.com/flutter/flutter/wiki/Changelog#typo-fixed-in-flutter-engine-android-api */ @Override diff --git a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index c697dc3628cfe..b7eeba40a6005 100644 --- a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -138,6 +138,8 @@ interface Registrar { * tombstone for reference. This comment will be removed on 2018-03-28 * (or at least four weeks after the unavailability is released). * + * https://github.com/flutter/flutter/wiki/Changelog#typo-fixed-in-flutter-engine-android-api + * * Adds a callback allowing the plugin to take part in handling incoming * calls to {@code Activity#onRequestPermissionsResult(int, String[], int[])} * or {@code android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int, String[], int[])}. @@ -204,6 +206,8 @@ interface RequestPermissionsResultListener { * This comment will be removed on 2018-03-28 (or at least four weeks after * the unavailability is released). * + * https://github.com/flutter/flutter/wiki/Changelog#typo-fixed-in-flutter-engine-android-api + * * Delegate interface for handling result of permissions requests on * behalf of the main {@link Activity}. *