From a7c1f0c283fda54233f8f6937b0573f345ec6e47 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Thu, 6 Jun 2019 09:29:10 -0700 Subject: [PATCH] Revert "Switch PlatformViewsController from Activity ref to Application ref. (#9193)" (flutter/engine#9211) This reverts commit ff4e1cc751f66f87de0b9277a8aa1ffacc68809c. --- .../android/io/flutter/app/FlutterPluginRegistry.java | 2 +- .../embedding/engine/plugins/shim/ShimPluginRegistry.java | 2 +- .../io/flutter/plugin/platform/PlatformViewsController.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 5a9e7360502..d146db360f9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -80,7 +80,7 @@ public class FlutterPluginRegistry public void attach(FlutterView flutterView, Activity activity) { mFlutterView = flutterView; mActivity = activity; - mPlatformViewsController.attach(activity.getApplicationContext(), flutterView, flutterView.getDartExecutor()); + mPlatformViewsController.attach(activity, flutterView, flutterView.getDartExecutor()); } public void detach() { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java index f9f8612d75b..18c45df9862 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java @@ -75,7 +75,7 @@ public class ShimPluginRegistry implements PluginRegistry { //----- From FlutterPluginRegistry that aren't in the PluginRegistry interface ----// public void attach(FlutterView flutterView, Activity activity) { - platformViewsController.attach(activity.getApplicationContext(), flutterEngine.getRenderer(), flutterEngine.getDartExecutor()); + platformViewsController.attach(activity, flutterEngine.getRenderer(), flutterEngine.getDartExecutor()); } public void detach() { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index a3dd131f1f0..2e2b621c7bf 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -227,7 +227,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * Attaches this platform views controller to its input and output channels. * * @param context The base context that will be passed to embedded views created by this controller. - * This should be the {@code Application} {@code Context}. + * This should be the context of the Activity hosting the Flutter application. * @param textureRegistry The texture registry which provides the output textures into which the embedded views * will be rendered. * @param dartExecutor The dart execution context, which is used to setup a system channel. @@ -239,7 +239,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega "attach was called while the PlatformViewsController was already attached." ); } - this.context = context.getApplicationContext(); + this.context = context; this.textureRegistry = textureRegistry; platformViewsChannel = new PlatformViewsChannel(dartExecutor); platformViewsChannel.setPlatformViewsHandler(channelHandler);