844 lines
43 KiB
Java
844 lines
43 KiB
Java
|
package io.flutter.plugin.platform;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.MutableContextWrapper;
|
||
|
import android.os.Build;
|
||
|
import android.util.SparseArray;
|
||
|
import android.view.MotionEvent;
|
||
|
import android.view.SurfaceView;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import android.widget.FrameLayout;
|
||
|
import io.flutter.Log;
|
||
|
import io.flutter.embedding.android.AndroidTouchProcessor;
|
||
|
import io.flutter.embedding.android.FlutterView;
|
||
|
import io.flutter.embedding.android.MotionEventTracker;
|
||
|
import io.flutter.embedding.engine.FlutterOverlaySurface;
|
||
|
import io.flutter.embedding.engine.dart.DartExecutor;
|
||
|
import io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView;
|
||
|
import io.flutter.embedding.engine.mutatorsstack.FlutterMutatorsStack;
|
||
|
import io.flutter.embedding.engine.renderer.FlutterRenderer;
|
||
|
import io.flutter.embedding.engine.systemchannels.PlatformViewsChannel;
|
||
|
import io.flutter.plugin.editing.TextInputPlugin;
|
||
|
import io.flutter.plugin.platform.PlatformViewsController;
|
||
|
import io.flutter.util.ViewUtils;
|
||
|
import io.flutter.view.AccessibilityBridge;
|
||
|
import io.flutter.view.TextureRegistry;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class PlatformViewsController implements PlatformViewsAccessibilityDelegate {
|
||
|
private static final String TAG = "PlatformViewsController";
|
||
|
private static Class[] VIEW_TYPES_REQUIRE_VIRTUAL_DISPLAY = {SurfaceView.class};
|
||
|
private AndroidTouchProcessor androidTouchProcessor;
|
||
|
private Context context;
|
||
|
private FlutterView flutterView;
|
||
|
private PlatformViewsChannel platformViewsChannel;
|
||
|
private TextInputPlugin textInputPlugin;
|
||
|
private TextureRegistry textureRegistry;
|
||
|
private int nextOverlayLayerId = 0;
|
||
|
private boolean flutterViewConvertedToImageView = false;
|
||
|
private boolean synchronizeToNativeViewHierarchy = true;
|
||
|
private boolean usesSoftwareRendering = false;
|
||
|
private final PlatformViewsChannel.PlatformViewsHandler channelHandler = new AnonymousClass1(this);
|
||
|
private final PlatformViewRegistryImpl registry = new PlatformViewRegistryImpl();
|
||
|
final HashMap<Integer, VirtualDisplayController> vdControllers = new HashMap<>();
|
||
|
private final AccessibilityEventsDelegate accessibilityEventsDelegate = new AccessibilityEventsDelegate();
|
||
|
final HashMap<Context, View> contextToEmbeddedView = new HashMap<>();
|
||
|
private final SparseArray<PlatformOverlayView> overlayLayerViews = new SparseArray<>();
|
||
|
private final HashSet<Integer> currentFrameUsedOverlayLayerIds = new HashSet<>();
|
||
|
private final HashSet<Integer> currentFrameUsedPlatformViewIds = new HashSet<>();
|
||
|
private final SparseArray<PlatformViewWrapper> viewWrappers = new SparseArray<>();
|
||
|
private final SparseArray<PlatformView> platformViews = new SparseArray<>();
|
||
|
private final SparseArray<FlutterMutatorView> platformViewParent = new SparseArray<>();
|
||
|
private final MotionEventTracker motionEventTracker = MotionEventTracker.getInstance();
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public static boolean validateDirection(int i) {
|
||
|
return i == 0 || i == 1;
|
||
|
}
|
||
|
|
||
|
public void attachTextInputPlugin(TextInputPlugin textInputPlugin) {
|
||
|
this.textInputPlugin = textInputPlugin;
|
||
|
}
|
||
|
|
||
|
public void detachTextInputPlugin() {
|
||
|
this.textInputPlugin = null;
|
||
|
}
|
||
|
|
||
|
public PlatformViewRegistry getRegistry() {
|
||
|
return this.registry;
|
||
|
}
|
||
|
|
||
|
public void onAttachedToJNI() {
|
||
|
}
|
||
|
|
||
|
public void setSoftwareRendering(boolean z) {
|
||
|
this.usesSoftwareRendering = z;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: io.flutter.plugin.platform.PlatformViewsController$1, reason: invalid class name */
|
||
|
/* loaded from: classes.dex */
|
||
|
public class AnonymousClass1 implements PlatformViewsChannel.PlatformViewsHandler {
|
||
|
final PlatformViewsController this$0;
|
||
|
|
||
|
AnonymousClass1(PlatformViewsController platformViewsController) {
|
||
|
this.this$0 = platformViewsController;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void createForPlatformViewLayer(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
ensureValidAndroidVersion(19);
|
||
|
ensureValidRequest(platformViewCreationRequest);
|
||
|
configureForHybridComposition(createPlatformView(platformViewCreationRequest, false), platformViewCreationRequest);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public long createForTextureLayer(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
ensureValidRequest(platformViewCreationRequest);
|
||
|
int i = platformViewCreationRequest.viewId;
|
||
|
if (this.this$0.viewWrappers.get(i) == null) {
|
||
|
if (this.this$0.textureRegistry != null) {
|
||
|
if (this.this$0.flutterView == null) {
|
||
|
throw new IllegalStateException("Flutter view is null. This means the platform views controller doesn't have an attached view, view id: " + i);
|
||
|
}
|
||
|
PlatformView createPlatformView = createPlatformView(platformViewCreationRequest, true);
|
||
|
View view = createPlatformView.getView();
|
||
|
if (view.getParent() != null) {
|
||
|
throw new IllegalStateException("The Android view returned from PlatformView#getView() was already added to a parent view.");
|
||
|
}
|
||
|
if (ViewUtils.hasChildViewOfType(view, PlatformViewsController.VIEW_TYPES_REQUIRE_VIRTUAL_DISPLAY)) {
|
||
|
if (platformViewCreationRequest.displayMode != PlatformViewsChannel.PlatformViewCreationRequest.RequestedDisplayMode.TEXTURE_WITH_HYBRID_FALLBACK) {
|
||
|
if (!this.this$0.usesSoftwareRendering) {
|
||
|
return configureForVirtualDisplay(createPlatformView, platformViewCreationRequest);
|
||
|
}
|
||
|
} else {
|
||
|
configureForHybridComposition(createPlatformView, platformViewCreationRequest);
|
||
|
return -2L;
|
||
|
}
|
||
|
}
|
||
|
return configureForTextureLayerComposition(createPlatformView, platformViewCreationRequest);
|
||
|
}
|
||
|
throw new IllegalStateException("Texture registry is null. This means that platform views controller was detached, view id: " + i);
|
||
|
}
|
||
|
throw new IllegalStateException("Trying to create an already created platform view, view id: " + i);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void dispose(int i) {
|
||
|
PlatformView platformView = (PlatformView) this.this$0.platformViews.get(i);
|
||
|
if (platformView != null) {
|
||
|
this.this$0.platformViews.remove(i);
|
||
|
try {
|
||
|
platformView.dispose();
|
||
|
} catch (RuntimeException e) {
|
||
|
Log.e(PlatformViewsController.TAG, "Disposing platform view threw an exception", e);
|
||
|
}
|
||
|
if (!this.this$0.usesVirtualDisplay(i)) {
|
||
|
PlatformViewWrapper platformViewWrapper = (PlatformViewWrapper) this.this$0.viewWrappers.get(i);
|
||
|
if (platformViewWrapper == null) {
|
||
|
FlutterMutatorView flutterMutatorView = (FlutterMutatorView) this.this$0.platformViewParent.get(i);
|
||
|
if (flutterMutatorView != null) {
|
||
|
flutterMutatorView.removeAllViews();
|
||
|
flutterMutatorView.unsetOnDescendantFocusChangeListener();
|
||
|
ViewGroup viewGroup = (ViewGroup) flutterMutatorView.getParent();
|
||
|
if (viewGroup != null) {
|
||
|
viewGroup.removeView(flutterMutatorView);
|
||
|
}
|
||
|
this.this$0.platformViewParent.remove(i);
|
||
|
return;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
platformViewWrapper.removeAllViews();
|
||
|
platformViewWrapper.release();
|
||
|
platformViewWrapper.unsetOnDescendantFocusChangeListener();
|
||
|
ViewGroup viewGroup2 = (ViewGroup) platformViewWrapper.getParent();
|
||
|
if (viewGroup2 != null) {
|
||
|
viewGroup2.removeView(platformViewWrapper);
|
||
|
}
|
||
|
this.this$0.viewWrappers.remove(i);
|
||
|
return;
|
||
|
}
|
||
|
View view = this.this$0.vdControllers.get(Integer.valueOf(i)).getView();
|
||
|
if (view != null) {
|
||
|
this.this$0.contextToEmbeddedView.remove(view.getContext());
|
||
|
}
|
||
|
this.this$0.vdControllers.remove(Integer.valueOf(i));
|
||
|
return;
|
||
|
}
|
||
|
Log.e(PlatformViewsController.TAG, "Disposing unknown platform view with id: " + i);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void offset(int i, double d, double d2) {
|
||
|
if (this.this$0.usesVirtualDisplay(i)) {
|
||
|
return;
|
||
|
}
|
||
|
PlatformViewWrapper platformViewWrapper = (PlatformViewWrapper) this.this$0.viewWrappers.get(i);
|
||
|
if (platformViewWrapper != null) {
|
||
|
int physicalPixels = this.this$0.toPhysicalPixels(d);
|
||
|
int physicalPixels2 = this.this$0.toPhysicalPixels(d2);
|
||
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) platformViewWrapper.getLayoutParams();
|
||
|
layoutParams.topMargin = physicalPixels;
|
||
|
layoutParams.leftMargin = physicalPixels2;
|
||
|
platformViewWrapper.setLayoutParams(layoutParams);
|
||
|
return;
|
||
|
}
|
||
|
Log.e(PlatformViewsController.TAG, "Setting offset for unknown platform view with id: " + i);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void resize(PlatformViewsChannel.PlatformViewResizeRequest platformViewResizeRequest, final PlatformViewsChannel.PlatformViewBufferResized platformViewBufferResized) {
|
||
|
int physicalPixels = this.this$0.toPhysicalPixels(platformViewResizeRequest.newLogicalWidth);
|
||
|
int physicalPixels2 = this.this$0.toPhysicalPixels(platformViewResizeRequest.newLogicalHeight);
|
||
|
int i = platformViewResizeRequest.viewId;
|
||
|
if (this.this$0.usesVirtualDisplay(i)) {
|
||
|
final float displayDensity = this.this$0.getDisplayDensity();
|
||
|
final VirtualDisplayController virtualDisplayController = this.this$0.vdControllers.get(Integer.valueOf(i));
|
||
|
this.this$0.lockInputConnection(virtualDisplayController);
|
||
|
virtualDisplayController.resize(physicalPixels, physicalPixels2, new Runnable(this, virtualDisplayController, displayDensity, platformViewBufferResized) { // from class: io.flutter.plugin.platform.PlatformViewsController$1$$ExternalSyntheticLambda1
|
||
|
public final PlatformViewsController.AnonymousClass1 f$0;
|
||
|
public final VirtualDisplayController f$1;
|
||
|
public final float f$2;
|
||
|
public final PlatformViewsChannel.PlatformViewBufferResized f$3;
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = virtualDisplayController;
|
||
|
this.f$2 = displayDensity;
|
||
|
this.f$3 = platformViewBufferResized;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.f$0.m340x7b26d3(this.f$1, this.f$2, this.f$3);
|
||
|
}
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
PlatformView platformView = (PlatformView) this.this$0.platformViews.get(i);
|
||
|
PlatformViewWrapper platformViewWrapper = (PlatformViewWrapper) this.this$0.viewWrappers.get(i);
|
||
|
if (platformView == null || platformViewWrapper == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Resizing unknown platform view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
if (physicalPixels > platformViewWrapper.getBufferWidth() || physicalPixels2 > platformViewWrapper.getBufferHeight()) {
|
||
|
platformViewWrapper.setBufferSize(physicalPixels, physicalPixels2);
|
||
|
}
|
||
|
ViewGroup.LayoutParams layoutParams = platformViewWrapper.getLayoutParams();
|
||
|
layoutParams.width = physicalPixels;
|
||
|
layoutParams.height = physicalPixels2;
|
||
|
platformViewWrapper.setLayoutParams(layoutParams);
|
||
|
View view = platformView.getView();
|
||
|
if (view != null) {
|
||
|
ViewGroup.LayoutParams layoutParams2 = view.getLayoutParams();
|
||
|
layoutParams2.width = physicalPixels;
|
||
|
layoutParams2.height = physicalPixels2;
|
||
|
view.setLayoutParams(layoutParams2);
|
||
|
}
|
||
|
platformViewBufferResized.run(new PlatformViewsChannel.PlatformViewBufferSize(this.this$0.toLogicalPixels(platformViewWrapper.getBufferWidth()), this.this$0.toLogicalPixels(platformViewWrapper.getBufferHeight())));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$resize$0$io-flutter-plugin-platform-PlatformViewsController$1, reason: not valid java name */
|
||
|
public /* synthetic */ void m340x7b26d3(VirtualDisplayController virtualDisplayController, float f, PlatformViewsChannel.PlatformViewBufferResized platformViewBufferResized) {
|
||
|
this.this$0.unlockInputConnection(virtualDisplayController);
|
||
|
if (this.this$0.context != null) {
|
||
|
f = this.this$0.getDisplayDensity();
|
||
|
}
|
||
|
platformViewBufferResized.run(new PlatformViewsChannel.PlatformViewBufferSize(this.this$0.toLogicalPixels(virtualDisplayController.getBufferWidth(), f), this.this$0.toLogicalPixels(virtualDisplayController.getBufferHeight(), f)));
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void onTouch(PlatformViewsChannel.PlatformViewTouch platformViewTouch) {
|
||
|
int i = platformViewTouch.viewId;
|
||
|
float f = this.this$0.context.getResources().getDisplayMetrics().density;
|
||
|
if (!this.this$0.usesVirtualDisplay(i)) {
|
||
|
PlatformView platformView = (PlatformView) this.this$0.platformViews.get(i);
|
||
|
if (platformView == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Sending touch to an unknown view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
View view = platformView.getView();
|
||
|
if (view == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Sending touch to a null view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
view.dispatchTouchEvent(this.this$0.toMotionEvent(f, platformViewTouch, false));
|
||
|
return;
|
||
|
}
|
||
|
this.this$0.vdControllers.get(Integer.valueOf(i)).dispatchTouchEvent(this.this$0.toMotionEvent(f, platformViewTouch, true));
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void setDirection(int i, int i2) {
|
||
|
View view;
|
||
|
if (!PlatformViewsController.validateDirection(i2)) {
|
||
|
throw new IllegalStateException("Trying to set unknown direction value: " + i2 + "(view id: " + i + ")");
|
||
|
}
|
||
|
if (!this.this$0.usesVirtualDisplay(i)) {
|
||
|
PlatformView platformView = (PlatformView) this.this$0.platformViews.get(i);
|
||
|
if (platformView == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Setting direction to an unknown view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
view = platformView.getView();
|
||
|
} else {
|
||
|
view = this.this$0.vdControllers.get(Integer.valueOf(i)).getView();
|
||
|
}
|
||
|
if (view == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Setting direction to a null view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
view.setLayoutDirection(i2);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void clearFocus(int i) {
|
||
|
View view;
|
||
|
if (!this.this$0.usesVirtualDisplay(i)) {
|
||
|
PlatformView platformView = (PlatformView) this.this$0.platformViews.get(i);
|
||
|
if (platformView == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Clearing focus on an unknown view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
view = platformView.getView();
|
||
|
} else {
|
||
|
view = this.this$0.vdControllers.get(Integer.valueOf(i)).getView();
|
||
|
}
|
||
|
if (view == null) {
|
||
|
Log.e(PlatformViewsController.TAG, "Clearing focus on a null view with id: " + i);
|
||
|
return;
|
||
|
}
|
||
|
view.clearFocus();
|
||
|
}
|
||
|
|
||
|
private void ensureValidAndroidVersion(int i) {
|
||
|
if (Build.VERSION.SDK_INT >= i) {
|
||
|
return;
|
||
|
}
|
||
|
throw new IllegalStateException("Trying to use platform views with API " + Build.VERSION.SDK_INT + ", required API level is: " + i);
|
||
|
}
|
||
|
|
||
|
private void ensureValidRequest(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
if (PlatformViewsController.validateDirection(platformViewCreationRequest.direction)) {
|
||
|
return;
|
||
|
}
|
||
|
throw new IllegalStateException("Trying to create a view with unknown direction value: " + platformViewCreationRequest.direction + "(view id: " + platformViewCreationRequest.viewId + ")");
|
||
|
}
|
||
|
|
||
|
private PlatformView createPlatformView(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest, boolean z) {
|
||
|
Context context;
|
||
|
PlatformViewFactory factory = this.this$0.registry.getFactory(platformViewCreationRequest.viewType);
|
||
|
if (factory == null) {
|
||
|
throw new IllegalStateException("Trying to create a platform view of unregistered type: " + platformViewCreationRequest.viewType);
|
||
|
}
|
||
|
Object decodeMessage = platformViewCreationRequest.params != null ? factory.getCreateArgsCodec().decodeMessage(platformViewCreationRequest.params) : null;
|
||
|
if (!z) {
|
||
|
context = this.this$0.context;
|
||
|
} else {
|
||
|
context = new MutableContextWrapper(this.this$0.context);
|
||
|
}
|
||
|
PlatformView create = factory.create(context, platformViewCreationRequest.viewId, decodeMessage);
|
||
|
View view = create.getView();
|
||
|
if (view == null) {
|
||
|
throw new IllegalStateException("PlatformView#getView() returned null, but an Android view reference was expected.");
|
||
|
}
|
||
|
view.setLayoutDirection(platformViewCreationRequest.direction);
|
||
|
this.this$0.platformViews.put(platformViewCreationRequest.viewId, create);
|
||
|
return create;
|
||
|
}
|
||
|
|
||
|
private void configureForHybridComposition(PlatformView platformView, PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
Log.i(PlatformViewsController.TAG, "Using hybrid composition for platform view: " + platformViewCreationRequest.viewId);
|
||
|
}
|
||
|
|
||
|
private long configureForVirtualDisplay(PlatformView platformView, final PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
ensureValidAndroidVersion(20);
|
||
|
Log.i(PlatformViewsController.TAG, "Hosting view in a virtual display for platform view: " + platformViewCreationRequest.viewId);
|
||
|
TextureRegistry.SurfaceTextureEntry createSurfaceTexture = this.this$0.textureRegistry.createSurfaceTexture();
|
||
|
VirtualDisplayController create = VirtualDisplayController.create(this.this$0.context, this.this$0.accessibilityEventsDelegate, platformView, createSurfaceTexture, this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalWidth), this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalHeight), platformViewCreationRequest.viewId, null, new View.OnFocusChangeListener(this, platformViewCreationRequest) { // from class: io.flutter.plugin.platform.PlatformViewsController$1$$ExternalSyntheticLambda2
|
||
|
public final PlatformViewsController.AnonymousClass1 f$0;
|
||
|
public final PlatformViewsChannel.PlatformViewCreationRequest f$1;
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = platformViewCreationRequest;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnFocusChangeListener
|
||
|
public final void onFocusChange(View view, boolean z) {
|
||
|
this.f$0.m339xbd462dcc(this.f$1, view, z);
|
||
|
}
|
||
|
});
|
||
|
if (create != null) {
|
||
|
if (this.this$0.flutterView != null) {
|
||
|
create.onFlutterViewAttached(this.this$0.flutterView);
|
||
|
}
|
||
|
this.this$0.vdControllers.put(Integer.valueOf(platformViewCreationRequest.viewId), create);
|
||
|
View view = platformView.getView();
|
||
|
this.this$0.contextToEmbeddedView.put(view.getContext(), view);
|
||
|
return createSurfaceTexture.id();
|
||
|
}
|
||
|
throw new IllegalStateException("Failed creating virtual display for a " + platformViewCreationRequest.viewType + " with id: " + platformViewCreationRequest.viewId);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$configureForVirtualDisplay$1$io-flutter-plugin-platform-PlatformViewsController$1, reason: not valid java name */
|
||
|
public /* synthetic */ void m339xbd462dcc(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest, View view, boolean z) {
|
||
|
if (z) {
|
||
|
this.this$0.platformViewsChannel.invokeViewFocused(platformViewCreationRequest.viewId);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private long configureForTextureLayerComposition(PlatformView platformView, final PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest) {
|
||
|
PlatformViewWrapper platformViewWrapper;
|
||
|
long j;
|
||
|
ensureValidAndroidVersion(23);
|
||
|
Log.i(PlatformViewsController.TAG, "Hosting view in view hierarchy for platform view: " + platformViewCreationRequest.viewId);
|
||
|
int physicalPixels = this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalWidth);
|
||
|
int physicalPixels2 = this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalHeight);
|
||
|
if (!this.this$0.usesSoftwareRendering) {
|
||
|
TextureRegistry.SurfaceTextureEntry createSurfaceTexture = this.this$0.textureRegistry.createSurfaceTexture();
|
||
|
PlatformViewWrapper platformViewWrapper2 = new PlatformViewWrapper(this.this$0.context, createSurfaceTexture);
|
||
|
long id = createSurfaceTexture.id();
|
||
|
platformViewWrapper = platformViewWrapper2;
|
||
|
j = id;
|
||
|
} else {
|
||
|
platformViewWrapper = new PlatformViewWrapper(this.this$0.context);
|
||
|
j = -1;
|
||
|
}
|
||
|
platformViewWrapper.setTouchProcessor(this.this$0.androidTouchProcessor);
|
||
|
platformViewWrapper.setBufferSize(physicalPixels, physicalPixels2);
|
||
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(physicalPixels, physicalPixels2);
|
||
|
int physicalPixels3 = this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalTop);
|
||
|
int physicalPixels4 = this.this$0.toPhysicalPixels(platformViewCreationRequest.logicalLeft);
|
||
|
layoutParams.topMargin = physicalPixels3;
|
||
|
layoutParams.leftMargin = physicalPixels4;
|
||
|
platformViewWrapper.setLayoutParams(layoutParams);
|
||
|
View view = platformView.getView();
|
||
|
view.setLayoutParams(new FrameLayout.LayoutParams(physicalPixels, physicalPixels2));
|
||
|
view.setImportantForAccessibility(4);
|
||
|
platformViewWrapper.addView(view);
|
||
|
platformViewWrapper.setOnDescendantFocusChangeListener(new View.OnFocusChangeListener(this, platformViewCreationRequest) { // from class: io.flutter.plugin.platform.PlatformViewsController$1$$ExternalSyntheticLambda0
|
||
|
public final PlatformViewsController.AnonymousClass1 f$0;
|
||
|
public final PlatformViewsChannel.PlatformViewCreationRequest f$1;
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = platformViewCreationRequest;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnFocusChangeListener
|
||
|
public final void onFocusChange(View view2, boolean z) {
|
||
|
this.f$0.m338xfdfb23ee(this.f$1, view2, z);
|
||
|
}
|
||
|
});
|
||
|
this.this$0.flutterView.addView(platformViewWrapper);
|
||
|
this.this$0.viewWrappers.append(platformViewCreationRequest.viewId, platformViewWrapper);
|
||
|
return j;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$configureForTextureLayerComposition$2$io-flutter-plugin-platform-PlatformViewsController$1, reason: not valid java name */
|
||
|
public /* synthetic */ void m338xfdfb23ee(PlatformViewsChannel.PlatformViewCreationRequest platformViewCreationRequest, View view, boolean z) {
|
||
|
if (z) {
|
||
|
this.this$0.platformViewsChannel.invokeViewFocused(platformViewCreationRequest.viewId);
|
||
|
} else if (this.this$0.textInputPlugin != null) {
|
||
|
this.this$0.textInputPlugin.clearPlatformViewClient(platformViewCreationRequest.viewId);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.systemchannels.PlatformViewsChannel.PlatformViewsHandler
|
||
|
public void synchronizeToNativeViewHierarchy(boolean z) {
|
||
|
this.this$0.synchronizeToNativeViewHierarchy = z;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public MotionEvent toMotionEvent(float f, PlatformViewsChannel.PlatformViewTouch platformViewTouch, boolean z) {
|
||
|
MotionEvent pop = this.motionEventTracker.pop(MotionEventTracker.MotionEventId.from(platformViewTouch.motionEventId));
|
||
|
MotionEvent.PointerProperties[] pointerPropertiesArr = (MotionEvent.PointerProperties[]) parsePointerPropertiesList(platformViewTouch.rawPointerPropertiesList).toArray(new MotionEvent.PointerProperties[platformViewTouch.pointerCount]);
|
||
|
MotionEvent.PointerCoords[] pointerCoordsArr = (MotionEvent.PointerCoords[]) parsePointerCoordsList(platformViewTouch.rawPointerCoords, f).toArray(new MotionEvent.PointerCoords[platformViewTouch.pointerCount]);
|
||
|
if (!z && pop != null) {
|
||
|
return MotionEvent.obtain(pop.getDownTime(), pop.getEventTime(), platformViewTouch.action, platformViewTouch.pointerCount, pointerPropertiesArr, pointerCoordsArr, pop.getMetaState(), pop.getButtonState(), pop.getXPrecision(), pop.getYPrecision(), pop.getDeviceId(), pop.getEdgeFlags(), pop.getSource(), pop.getFlags());
|
||
|
}
|
||
|
return MotionEvent.obtain(platformViewTouch.downTime.longValue(), platformViewTouch.eventTime.longValue(), platformViewTouch.action, platformViewTouch.pointerCount, pointerPropertiesArr, pointerCoordsArr, platformViewTouch.metaState, platformViewTouch.buttonState, platformViewTouch.xPrecision, platformViewTouch.yPrecision, platformViewTouch.deviceId, platformViewTouch.edgeFlags, platformViewTouch.source, platformViewTouch.flags);
|
||
|
}
|
||
|
|
||
|
public void attach(Context context, TextureRegistry textureRegistry, DartExecutor dartExecutor) {
|
||
|
if (this.context != null) {
|
||
|
throw new AssertionError("A PlatformViewsController can only be attached to a single output target.\nattach was called while the PlatformViewsController was already attached.");
|
||
|
}
|
||
|
this.context = context;
|
||
|
this.textureRegistry = textureRegistry;
|
||
|
PlatformViewsChannel platformViewsChannel = new PlatformViewsChannel(dartExecutor);
|
||
|
this.platformViewsChannel = platformViewsChannel;
|
||
|
platformViewsChannel.setPlatformViewsHandler(this.channelHandler);
|
||
|
}
|
||
|
|
||
|
public void detach() {
|
||
|
PlatformViewsChannel platformViewsChannel = this.platformViewsChannel;
|
||
|
if (platformViewsChannel != null) {
|
||
|
platformViewsChannel.setPlatformViewsHandler(null);
|
||
|
}
|
||
|
destroyOverlaySurfaces();
|
||
|
this.platformViewsChannel = null;
|
||
|
this.context = null;
|
||
|
this.textureRegistry = null;
|
||
|
}
|
||
|
|
||
|
public void attachToView(FlutterView flutterView) {
|
||
|
this.flutterView = flutterView;
|
||
|
for (int i = 0; i < this.viewWrappers.size(); i++) {
|
||
|
this.flutterView.addView(this.viewWrappers.valueAt(i));
|
||
|
}
|
||
|
for (int i2 = 0; i2 < this.platformViewParent.size(); i2++) {
|
||
|
this.flutterView.addView(this.platformViewParent.valueAt(i2));
|
||
|
}
|
||
|
for (int i3 = 0; i3 < this.platformViews.size(); i3++) {
|
||
|
this.platformViews.valueAt(i3).onFlutterViewAttached(this.flutterView);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void detachFromView() {
|
||
|
for (int i = 0; i < this.viewWrappers.size(); i++) {
|
||
|
this.flutterView.removeView(this.viewWrappers.valueAt(i));
|
||
|
}
|
||
|
for (int i2 = 0; i2 < this.platformViewParent.size(); i2++) {
|
||
|
this.flutterView.removeView(this.platformViewParent.valueAt(i2));
|
||
|
}
|
||
|
destroyOverlaySurfaces();
|
||
|
removeOverlaySurfaces();
|
||
|
this.flutterView = null;
|
||
|
this.flutterViewConvertedToImageView = false;
|
||
|
for (int i3 = 0; i3 < this.platformViews.size(); i3++) {
|
||
|
this.platformViews.valueAt(i3).onFlutterViewDetached();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate
|
||
|
public void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge) {
|
||
|
this.accessibilityEventsDelegate.setAccessibilityBridge(accessibilityBridge);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate
|
||
|
public void detachAccessibilityBridge() {
|
||
|
this.accessibilityEventsDelegate.setAccessibilityBridge(null);
|
||
|
}
|
||
|
|
||
|
public boolean checkInputConnectionProxy(View view) {
|
||
|
if (view == null || !this.contextToEmbeddedView.containsKey(view.getContext())) {
|
||
|
return false;
|
||
|
}
|
||
|
View view2 = this.contextToEmbeddedView.get(view.getContext());
|
||
|
if (view2 == view) {
|
||
|
return true;
|
||
|
}
|
||
|
return view2.checkInputConnectionProxy(view);
|
||
|
}
|
||
|
|
||
|
public void onDetachedFromJNI() {
|
||
|
diposeAllViews();
|
||
|
}
|
||
|
|
||
|
public void onPreEngineRestart() {
|
||
|
diposeAllViews();
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate
|
||
|
public View getPlatformViewById(int i) {
|
||
|
if (usesVirtualDisplay(i)) {
|
||
|
return this.vdControllers.get(Integer.valueOf(i)).getView();
|
||
|
}
|
||
|
PlatformView platformView = this.platformViews.get(i);
|
||
|
if (platformView == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return platformView.getView();
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate
|
||
|
public boolean usesVirtualDisplay(int i) {
|
||
|
return this.vdControllers.containsKey(Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void lockInputConnection(VirtualDisplayController virtualDisplayController) {
|
||
|
TextInputPlugin textInputPlugin = this.textInputPlugin;
|
||
|
if (textInputPlugin == null) {
|
||
|
return;
|
||
|
}
|
||
|
textInputPlugin.lockPlatformViewInputConnection();
|
||
|
virtualDisplayController.onInputConnectionLocked();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void unlockInputConnection(VirtualDisplayController virtualDisplayController) {
|
||
|
TextInputPlugin textInputPlugin = this.textInputPlugin;
|
||
|
if (textInputPlugin == null) {
|
||
|
return;
|
||
|
}
|
||
|
textInputPlugin.unlockPlatformViewInputConnection();
|
||
|
virtualDisplayController.onInputConnectionUnlocked();
|
||
|
}
|
||
|
|
||
|
private static List<MotionEvent.PointerProperties> parsePointerPropertiesList(Object obj) {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
Iterator it = ((List) obj).iterator();
|
||
|
while (it.hasNext()) {
|
||
|
arrayList.add(parsePointerProperties(it.next()));
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
private static MotionEvent.PointerProperties parsePointerProperties(Object obj) {
|
||
|
List list = (List) obj;
|
||
|
MotionEvent.PointerProperties pointerProperties = new MotionEvent.PointerProperties();
|
||
|
pointerProperties.id = ((Integer) list.get(0)).intValue();
|
||
|
pointerProperties.toolType = ((Integer) list.get(1)).intValue();
|
||
|
return pointerProperties;
|
||
|
}
|
||
|
|
||
|
private static List<MotionEvent.PointerCoords> parsePointerCoordsList(Object obj, float f) {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
Iterator it = ((List) obj).iterator();
|
||
|
while (it.hasNext()) {
|
||
|
arrayList.add(parsePointerCoords(it.next(), f));
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
private static MotionEvent.PointerCoords parsePointerCoords(Object obj, float f) {
|
||
|
List list = (List) obj;
|
||
|
MotionEvent.PointerCoords pointerCoords = new MotionEvent.PointerCoords();
|
||
|
pointerCoords.orientation = (float) ((Double) list.get(0)).doubleValue();
|
||
|
pointerCoords.pressure = (float) ((Double) list.get(1)).doubleValue();
|
||
|
pointerCoords.size = (float) ((Double) list.get(2)).doubleValue();
|
||
|
pointerCoords.toolMajor = ((float) ((Double) list.get(3)).doubleValue()) * f;
|
||
|
pointerCoords.toolMinor = ((float) ((Double) list.get(4)).doubleValue()) * f;
|
||
|
pointerCoords.touchMajor = ((float) ((Double) list.get(5)).doubleValue()) * f;
|
||
|
pointerCoords.touchMinor = ((float) ((Double) list.get(6)).doubleValue()) * f;
|
||
|
pointerCoords.x = ((float) ((Double) list.get(7)).doubleValue()) * f;
|
||
|
pointerCoords.y = ((float) ((Double) list.get(8)).doubleValue()) * f;
|
||
|
return pointerCoords;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public float getDisplayDensity() {
|
||
|
return this.context.getResources().getDisplayMetrics().density;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public int toPhysicalPixels(double d) {
|
||
|
return (int) Math.round(d * getDisplayDensity());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public int toLogicalPixels(double d, float f) {
|
||
|
return (int) Math.round(d / f);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public int toLogicalPixels(double d) {
|
||
|
return toLogicalPixels(d, getDisplayDensity());
|
||
|
}
|
||
|
|
||
|
private void diposeAllViews() {
|
||
|
while (this.platformViews.size() > 0) {
|
||
|
this.channelHandler.dispose(this.platformViews.keyAt(0));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void initializeRootImageViewIfNeeded() {
|
||
|
if (!this.synchronizeToNativeViewHierarchy || this.flutterViewConvertedToImageView) {
|
||
|
return;
|
||
|
}
|
||
|
this.flutterView.convertToImageView();
|
||
|
this.flutterViewConvertedToImageView = true;
|
||
|
}
|
||
|
|
||
|
void initializePlatformViewIfNeeded(final int i) {
|
||
|
PlatformView platformView = this.platformViews.get(i);
|
||
|
if (platformView == null) {
|
||
|
throw new IllegalStateException("Platform view hasn't been initialized from the platform view channel.");
|
||
|
}
|
||
|
if (this.platformViewParent.get(i) != null) {
|
||
|
return;
|
||
|
}
|
||
|
View view = platformView.getView();
|
||
|
if (view == null) {
|
||
|
throw new IllegalStateException("PlatformView#getView() returned null, but an Android view reference was expected.");
|
||
|
}
|
||
|
if (view.getParent() != null) {
|
||
|
throw new IllegalStateException("The Android view returned from PlatformView#getView() was already added to a parent view.");
|
||
|
}
|
||
|
Context context = this.context;
|
||
|
FlutterMutatorView flutterMutatorView = new FlutterMutatorView(context, context.getResources().getDisplayMetrics().density, this.androidTouchProcessor);
|
||
|
flutterMutatorView.setOnDescendantFocusChangeListener(new View.OnFocusChangeListener(this, i) { // from class: io.flutter.plugin.platform.PlatformViewsController$$ExternalSyntheticLambda0
|
||
|
public final PlatformViewsController f$0;
|
||
|
public final int f$1;
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = i;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnFocusChangeListener
|
||
|
public final void onFocusChange(View view2, boolean z) {
|
||
|
this.f$0.m336x825f680(this.f$1, view2, z);
|
||
|
}
|
||
|
});
|
||
|
this.platformViewParent.put(i, flutterMutatorView);
|
||
|
view.setImportantForAccessibility(4);
|
||
|
flutterMutatorView.addView(view);
|
||
|
this.flutterView.addView(flutterMutatorView);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$initializePlatformViewIfNeeded$0$io-flutter-plugin-platform-PlatformViewsController, reason: not valid java name */
|
||
|
public /* synthetic */ void m336x825f680(int i, View view, boolean z) {
|
||
|
if (z) {
|
||
|
this.platformViewsChannel.invokeViewFocused(i);
|
||
|
return;
|
||
|
}
|
||
|
TextInputPlugin textInputPlugin = this.textInputPlugin;
|
||
|
if (textInputPlugin != null) {
|
||
|
textInputPlugin.clearPlatformViewClient(i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void attachToFlutterRenderer(FlutterRenderer flutterRenderer) {
|
||
|
this.androidTouchProcessor = new AndroidTouchProcessor(flutterRenderer, true);
|
||
|
}
|
||
|
|
||
|
public void onDisplayPlatformView(int i, int i2, int i3, int i4, int i5, int i6, int i7, FlutterMutatorsStack flutterMutatorsStack) {
|
||
|
initializeRootImageViewIfNeeded();
|
||
|
initializePlatformViewIfNeeded(i);
|
||
|
FlutterMutatorView flutterMutatorView = this.platformViewParent.get(i);
|
||
|
flutterMutatorView.readyToDisplay(flutterMutatorsStack, i2, i3, i4, i5);
|
||
|
flutterMutatorView.setVisibility(0);
|
||
|
flutterMutatorView.bringToFront();
|
||
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(i6, i7);
|
||
|
View view = this.platformViews.get(i).getView();
|
||
|
if (view != null) {
|
||
|
view.setLayoutParams(layoutParams);
|
||
|
view.bringToFront();
|
||
|
}
|
||
|
this.currentFrameUsedPlatformViewIds.add(Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
public void onDisplayOverlaySurface(int i, int i2, int i3, int i4, int i5) {
|
||
|
if (this.overlayLayerViews.get(i) == null) {
|
||
|
throw new IllegalStateException("The overlay surface (id:" + i + ") doesn't exist");
|
||
|
}
|
||
|
initializeRootImageViewIfNeeded();
|
||
|
PlatformOverlayView platformOverlayView = this.overlayLayerViews.get(i);
|
||
|
if (platformOverlayView.getParent() == null) {
|
||
|
this.flutterView.addView(platformOverlayView);
|
||
|
}
|
||
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(i4, i5);
|
||
|
layoutParams.leftMargin = i2;
|
||
|
layoutParams.topMargin = i3;
|
||
|
platformOverlayView.setLayoutParams(layoutParams);
|
||
|
platformOverlayView.setVisibility(0);
|
||
|
platformOverlayView.bringToFront();
|
||
|
this.currentFrameUsedOverlayLayerIds.add(Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
public void onBeginFrame() {
|
||
|
this.currentFrameUsedOverlayLayerIds.clear();
|
||
|
this.currentFrameUsedPlatformViewIds.clear();
|
||
|
}
|
||
|
|
||
|
public void onEndFrame() {
|
||
|
boolean z = false;
|
||
|
if (this.flutterViewConvertedToImageView && this.currentFrameUsedPlatformViewIds.isEmpty()) {
|
||
|
this.flutterViewConvertedToImageView = false;
|
||
|
this.flutterView.revertImageView(new Runnable(this) { // from class: io.flutter.plugin.platform.PlatformViewsController$$ExternalSyntheticLambda1
|
||
|
public final PlatformViewsController f$0;
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.f$0.m337xe1328d28();
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
if (this.flutterViewConvertedToImageView && this.flutterView.acquireLatestImageViewFrame()) {
|
||
|
z = true;
|
||
|
}
|
||
|
finishFrame(z);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$onEndFrame$1$io-flutter-plugin-platform-PlatformViewsController, reason: not valid java name */
|
||
|
public /* synthetic */ void m337xe1328d28() {
|
||
|
finishFrame(false);
|
||
|
}
|
||
|
|
||
|
private void finishFrame(boolean z) {
|
||
|
for (int i = 0; i < this.overlayLayerViews.size(); i++) {
|
||
|
int keyAt = this.overlayLayerViews.keyAt(i);
|
||
|
PlatformOverlayView valueAt = this.overlayLayerViews.valueAt(i);
|
||
|
if (this.currentFrameUsedOverlayLayerIds.contains(Integer.valueOf(keyAt))) {
|
||
|
this.flutterView.attachOverlaySurfaceToRender(valueAt);
|
||
|
z &= valueAt.acquireLatestImage();
|
||
|
} else {
|
||
|
if (!this.flutterViewConvertedToImageView) {
|
||
|
valueAt.detachFromRenderer();
|
||
|
}
|
||
|
valueAt.setVisibility(8);
|
||
|
}
|
||
|
}
|
||
|
for (int i2 = 0; i2 < this.platformViewParent.size(); i2++) {
|
||
|
int keyAt2 = this.platformViewParent.keyAt(i2);
|
||
|
FlutterMutatorView flutterMutatorView = this.platformViewParent.get(keyAt2);
|
||
|
if (this.currentFrameUsedPlatformViewIds.contains(Integer.valueOf(keyAt2)) && (z || !this.synchronizeToNativeViewHierarchy)) {
|
||
|
flutterMutatorView.setVisibility(0);
|
||
|
} else {
|
||
|
flutterMutatorView.setVisibility(8);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public FlutterOverlaySurface createOverlaySurface(PlatformOverlayView platformOverlayView) {
|
||
|
int i = this.nextOverlayLayerId;
|
||
|
this.nextOverlayLayerId = i + 1;
|
||
|
this.overlayLayerViews.put(i, platformOverlayView);
|
||
|
return new FlutterOverlaySurface(i, platformOverlayView.getSurface());
|
||
|
}
|
||
|
|
||
|
public FlutterOverlaySurface createOverlaySurface() {
|
||
|
return createOverlaySurface(new PlatformOverlayView(this.flutterView.getContext(), this.flutterView.getWidth(), this.flutterView.getHeight(), this.accessibilityEventsDelegate));
|
||
|
}
|
||
|
|
||
|
public void destroyOverlaySurfaces() {
|
||
|
for (int i = 0; i < this.overlayLayerViews.size(); i++) {
|
||
|
PlatformOverlayView valueAt = this.overlayLayerViews.valueAt(i);
|
||
|
valueAt.detachFromRenderer();
|
||
|
valueAt.closeImageReader();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void removeOverlaySurfaces() {
|
||
|
if (this.flutterView == null) {
|
||
|
Log.e(TAG, "removeOverlaySurfaces called while flutter view is null");
|
||
|
return;
|
||
|
}
|
||
|
for (int i = 0; i < this.overlayLayerViews.size(); i++) {
|
||
|
this.flutterView.removeView(this.overlayLayerViews.valueAt(i));
|
||
|
}
|
||
|
this.overlayLayerViews.clear();
|
||
|
}
|
||
|
}
|