diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 47eedb6860..07d5f500f2 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -1283,81 +1283,6 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC textInputPlugin.autofill(values); } - /** - * Render modes for a {@link FlutterView}. - * - *
Deprecated - please use {@link io.flutter.embedding.android.RenderMode} instead. - */ - @Deprecated() - public enum RenderMode { - /** - * {@code RenderMode}, which paints a Flutter UI to a {@link android.view.SurfaceView}. This - * mode has the best performance, but a {@code FlutterView} in this mode cannot be positioned - * between 2 other Android {@code View}s in the z-index, nor can it be animated/transformed. - * Unless the special capabilities of a {@link android.graphics.SurfaceTexture} are required, - * developers should strongly prefer this render mode. - */ - surface, - /** - * {@code RenderMode}, which paints a Flutter UI to a {@link android.graphics.SurfaceTexture}. - * This mode is not as performant as {@link RenderMode#surface}, but a {@code FlutterView} in - * this mode can be animated and transformed, as well as positioned in the z-index between 2+ - * other Android {@code Views}. Unless the special capabilities of a {@link - * android.graphics.SurfaceTexture} are required, developers should strongly prefer the {@link - * RenderMode#surface} render mode. - */ - texture, - /** - * {@code RenderMode}, which paints Paints a Flutter UI provided by an {@link - * android.media.ImageReader} onto a {@link android.graphics.Canvas}. This mode is not as - * performant as {@link RenderMode#surface}, but a {@code FlutterView} in this mode can handle - * full interactivity with a {@link io.flutter.plugin.platform.PlatformView}. Unless {@link - * io.flutter.plugin.platform.PlatformView}s are required developers should strongly prefer the - * {@link RenderMode#surface} render mode. - */ - image - } - - /** - * Transparency mode for a {@code FlutterView}. - * - *
Deprecated - please use {@link io.flutter.embedding.android.TransparencyMode} instead. - * - *
{@code TransparencyMode} impacts the visual behavior and performance of a {@link - * FlutterSurfaceView}, which is displayed when a {@code FlutterView} uses {@link - * RenderMode#surface}. - * - *
{@code TransparencyMode} does not impact {@link FlutterTextureView}, which is displayed when - * a {@code FlutterView} uses {@link RenderMode#texture}, because a {@link FlutterTextureView} - * automatically comes with transparency. - */ - @Deprecated - public enum TransparencyMode { - /** - * Renders a {@code FlutterView} without any transparency. This affects {@code FlutterView}s in - * {@link io.flutter.embedding.android.RenderMode#surface} by introducing a base color of black, - * and places the {@link FlutterSurfaceView}'s {@code Window} behind all other content. - * - *
In {@link io.flutter.embedding.android.RenderMode#surface}, this mode is the most - * performant and is a good choice for fullscreen Flutter UIs that will not undergo {@code - * Fragment} transactions. If this mode is used within a {@code Fragment}, and that {@code - * Fragment} is replaced by another one, a brief black flicker may be visible during the switch. - */ - opaque, - /** - * Renders a {@code FlutterView} with transparency. This affects {@code FlutterView}s in {@link - * io.flutter.embedding.android.RenderMode#surface} by allowing background transparency, and - * places the {@link FlutterSurfaceView}'s {@code Window} on top of all other content. - * - *
In {@link io.flutter.embedding.android.RenderMode#surface}, this mode is less performant
- * than {@link #opaque}, but this mode avoids the black flicker problem that {@link #opaque} has
- * when going through {@code Fragment} transactions. Consider using this {@code
- * TransparencyMode} if you intend to switch {@code Fragment}s at runtime that contain a Flutter
- * UI.
- */
- transparent
- }
-
/**
* Listener that is notified when a {@link io.flutter.embedding.engine.FlutterEngine} is attached
* to/detached from a given {@code FlutterView}.
diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java
index 9f23b2e732..98d0047162 100644
--- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java
+++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java
@@ -65,8 +65,6 @@ import java.util.Set;
private final Map The returned instance loads Flutter native libraries in the standard way. A singleton object
- * is used instead of static methods to facilitate testing without actually running native library
- * linking.
- *
- * @return The Flutter loader.
- * @deprecated Use the {@link io.flutter.FlutterInjector} instead.
- */
- @Deprecated
- @NonNull
- public static FlutterLoader getInstance() {
- if (instance == null) {
- instance = new FlutterLoader();
- }
- return instance;
- }
-
/**
* Creates a {@code FlutterLoader} that uses a default constructed {@link FlutterJNI} and {@link
* ExecutorService}.
diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java
index 7e1e8812f9..5ceab71ef4 100644
--- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java
+++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java
@@ -50,25 +50,6 @@ import io.flutter.embedding.android.ExclusiveAppComponent;
* io.flutter.embedding.engine.FlutterEngine}.
*/
public interface ActivityControlSurface {
- /**
- * Call this method from the {@link android.app.Activity} that is displaying the visual content of
- * the {@link io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code
- * ActivityControlSurface}.
- *
- * Once an {@link android.app.Activity} is created, and its associated {@link
- * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link
- * android.app.Activity} should invoke this method. At that point the {@link
- * io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link
- * android.app.Activity} and all {@link ActivityAware} plugins are given access to the {@link
- * android.app.Activity}.
- *
- * @deprecated Prefer using the {@link #attachToActivity(ExclusiveAppComponent, Lifecycle)} API to
- * avoid situations where multiple activities are driving the FlutterEngine simultaneously.
- * See https://github.com/flutter/flutter/issues/66192.
- */
- @Deprecated
- void attachToActivity(@NonNull Activity activity, @NonNull Lifecycle lifecycle);
-
/**
* Call this method from the {@link ExclusiveAppComponent} that is displaying the visual content
* of the {@link io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code
@@ -80,10 +61,6 @@ public interface ActivityControlSurface {
* io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link
* ExclusiveAppComponent} and all {@link ActivityAware} plugins are given access to the {@link
* ExclusiveAppComponent}'s {@link android.app.Activity}.
- *
- * This method differs from {@link #attachToActivity(Activity, Lifecycle)} in that it calls
- * back the existing {@link ExclusiveAppComponent} to give it a chance to cleanly detach before a
- * new {@link ExclusiveAppComponent} is attached.
*/
void attachToActivity(
@NonNull ExclusiveAppComponent Sets it on top of its window. The background color still needs to be controlled from within
- * the Flutter UI itself.
- *
- * @deprecated FlutterView in the v1 embedding is always a SurfaceView and will cover
- * accessibility highlights when transparent. Consider migrating to the v2 Android embedding,
- * using {@link io.flutter.embedding.android.FlutterView.RenderMode#texture}, and setting
- * {@link io.flutter.embedding.android.FlutterView.TransparencyMode#transparent}. See also
- * https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects.
- */
- @Deprecated
- public void enableTransparentBackground() {
- Log.w(
- TAG,
- "FlutterView in the v1 embedding is always a SurfaceView and will cover accessibility highlights when transparent. Consider migrating to the v2 Android embedding. https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects");
- setZOrderOnTop(true);
- getHolder().setFormat(PixelFormat.TRANSPARENT);
- }
-
/**
* Reverts this back to the {@link SurfaceView} defaults, at the back of its window and opaque.
*/
diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
index 869dabc6ab..17607e1c32 100644
--- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
+++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
@@ -409,7 +409,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// Verify that the ActivityControlSurface was NOT told to attach or detach to an Activity.
verify(mockFlutterEngine.getActivityControlSurface(), never())
- .attachToActivity(any(Activity.class), any(Lifecycle.class));
+ .attachToActivity(any(ExclusiveAppComponent.class), any(Lifecycle.class));
verify(mockFlutterEngine.getActivityControlSurface(), never()).detachFromActivity();
}
diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterEngineConnectionRegistryTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterEngineConnectionRegistryTest.java
index 957b73969f..33f2cc66b7 100644
--- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterEngineConnectionRegistryTest.java
+++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterEngineConnectionRegistryTest.java
@@ -11,6 +11,7 @@ import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
+import io.flutter.embedding.android.ExclusiveAppComponent;
import io.flutter.embedding.engine.loader.FlutterLoader;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
@@ -74,7 +75,11 @@ public class FlutterEngineConnectionRegistryTest {
when(flutterEngine.getPlatformViewsController()).thenReturn(platformViewsController);
FlutterLoader flutterLoader = mock(FlutterLoader.class);
+
+ ExclusiveAppComponent appComponent = mock(ExclusiveAppComponent.class);
Activity activity = mock(Activity.class);
+ when(appComponent.getAppComponent()).thenReturn(activity);
+
Lifecycle lifecycle = mock(Lifecycle.class);
Intent intent = mock(Intent.class);
AtomicBoolean isFirstCall = new AtomicBoolean(true);
@@ -84,7 +89,7 @@ public class FlutterEngineConnectionRegistryTest {
new FlutterEngineConnectionRegistry(context, flutterEngine, flutterLoader);
FakeActivityAwareFlutterPlugin fakePlugin = new FakeActivityAwareFlutterPlugin();
registry.add(fakePlugin);
- registry.attachToActivity(activity, lifecycle);
+ registry.attachToActivity(appComponent, lifecycle);
// The binding is now available via `fakePlugin.binding`: Create and add the listeners
FakeActivityResultListener listener1 =
diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java
index 87d5e7a021..21c392879d 100644
--- a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java
+++ b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java
@@ -19,6 +19,7 @@ import android.widget.FrameLayout.LayoutParams;
import io.flutter.embedding.android.FlutterImageView;
import io.flutter.embedding.android.FlutterView;
import io.flutter.embedding.android.MotionEventTracker;
+import io.flutter.embedding.android.RenderMode;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.FlutterJNI;
import io.flutter.embedding.engine.FlutterOverlaySurface;
@@ -874,7 +875,7 @@ public class PlatformViewsControllerTest {
platformViewsController.attach(context, registry, executor);
final FlutterView view =
- new FlutterView(context, FlutterView.RenderMode.surface) {
+ new FlutterView(context, RenderMode.surface) {
@Override
public FlutterImageView createImageView() {
final FlutterImageView view = mock(FlutterImageView.class);