From ff4e1cc751f66f87de0b9277a8aa1ffacc68809c Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 5 Jun 2019 14:24:16 -0700 Subject: [PATCH] Switch PlatformViewsController from Activity ref to Application ref. (flutter/engine#9193) --- .../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 d146db360f9..5a9e7360502 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, flutterView, flutterView.getDartExecutor()); + mPlatformViewsController.attach(activity.getApplicationContext(), 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 18c45df9862..f9f8612d75b 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, flutterEngine.getRenderer(), flutterEngine.getDartExecutor()); + platformViewsController.attach(activity.getApplicationContext(), 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 2e2b621c7bf..a3dd131f1f0 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 context of the Activity hosting the Flutter application. + * This should be the {@code Application} {@code Context}. * @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; + this.context = context.getApplicationContext(); this.textureRegistry = textureRegistry; platformViewsChannel = new PlatformViewsChannel(dartExecutor); platformViewsChannel.setPlatformViewsHandler(channelHandler);