1204 lines
54 KiB
Java
1204 lines
54 KiB
Java
|
package io.flutter.embedding.android;
|
||
|
|
||
|
import android.app.Activity;
|
||
|
import android.content.Context;
|
||
|
import android.content.res.Configuration;
|
||
|
import android.database.ContentObserver;
|
||
|
import android.graphics.Insets;
|
||
|
import android.graphics.Rect;
|
||
|
import android.os.Build;
|
||
|
import android.os.Handler;
|
||
|
import android.os.Looper;
|
||
|
import android.provider.Settings;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.util.SparseArray;
|
||
|
import android.view.DisplayCutout;
|
||
|
import android.view.KeyEvent;
|
||
|
import android.view.MotionEvent;
|
||
|
import android.view.PointerIcon;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewConfiguration;
|
||
|
import android.view.ViewGroup;
|
||
|
import android.view.ViewStructure;
|
||
|
import android.view.WindowInsets;
|
||
|
import android.view.WindowManager;
|
||
|
import android.view.accessibility.AccessibilityManager;
|
||
|
import android.view.accessibility.AccessibilityNodeProvider;
|
||
|
import android.view.autofill.AutofillValue;
|
||
|
import android.view.inputmethod.EditorInfo;
|
||
|
import android.view.inputmethod.InputConnection;
|
||
|
import android.view.textservice.TextServicesManager;
|
||
|
import android.widget.FrameLayout;
|
||
|
import io.flutter.Log;
|
||
|
import io.flutter.embedding.android.FlutterImageView;
|
||
|
import io.flutter.embedding.android.KeyboardManager;
|
||
|
import io.flutter.embedding.engine.FlutterEngine;
|
||
|
import io.flutter.embedding.engine.renderer.FlutterRenderer;
|
||
|
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
|
||
|
import io.flutter.embedding.engine.renderer.RenderSurface;
|
||
|
import io.flutter.plugin.common.BinaryMessenger;
|
||
|
import io.flutter.plugin.editing.SpellCheckPlugin;
|
||
|
import io.flutter.plugin.editing.TextInputPlugin;
|
||
|
import io.flutter.plugin.localization.LocalizationPlugin;
|
||
|
import io.flutter.plugin.mouse.MouseCursorPlugin;
|
||
|
import io.flutter.util.ViewUtils;
|
||
|
import io.flutter.view.AccessibilityBridge;
|
||
|
import java.lang.reflect.InvocationTargetException;
|
||
|
import java.lang.reflect.Method;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.Set;
|
||
|
import o.C6827cck;
|
||
|
import o.InterfaceC11781eln;
|
||
|
import o.QUU;
|
||
|
import o.VIk;
|
||
|
import o.bWE;
|
||
|
import o.nMh;
|
||
|
import o.oEt;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseCursorViewDelegate, KeyboardManager.ViewDelegate {
|
||
|
private static final String TAG = "FlutterView";
|
||
|
private AccessibilityBridge accessibilityBridge;
|
||
|
private AndroidTouchProcessor androidTouchProcessor;
|
||
|
private FlutterEngine flutterEngine;
|
||
|
private final Set<FlutterEngineAttachmentListener> flutterEngineAttachmentListeners;
|
||
|
private FlutterImageView flutterImageView;
|
||
|
private FlutterSurfaceView flutterSurfaceView;
|
||
|
private FlutterTextureView flutterTextureView;
|
||
|
private final FlutterUiDisplayListener flutterUiDisplayListener;
|
||
|
private final Set<FlutterUiDisplayListener> flutterUiDisplayListeners;
|
||
|
private boolean isFlutterUiDisplayed;
|
||
|
private KeyboardManager keyboardManager;
|
||
|
private LocalizationPlugin localizationPlugin;
|
||
|
private MouseCursorPlugin mouseCursorPlugin;
|
||
|
private final AccessibilityBridge.OnAccessibilityChangeListener onAccessibilityChangeListener;
|
||
|
private RenderSurface previousRenderSurface;
|
||
|
RenderSurface renderSurface;
|
||
|
private SpellCheckPlugin spellCheckPlugin;
|
||
|
private final ContentObserver systemSettingsObserver;
|
||
|
private TextInputPlugin textInputPlugin;
|
||
|
private TextServicesManager textServicesManager;
|
||
|
private final FlutterRenderer.ViewportMetrics viewportMetrics;
|
||
|
private final QUU<oEt> windowInfoListener;
|
||
|
private WindowInfoRepositoryCallbackAdapterWrapper windowInfoRepo;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public interface FlutterEngineAttachmentListener {
|
||
|
void onFlutterEngineAttachedToFlutterView(FlutterEngine flutterEngine);
|
||
|
|
||
|
void onFlutterEngineDetachedFromFlutterView();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public enum ZeroSides {
|
||
|
NONE,
|
||
|
LEFT,
|
||
|
RIGHT,
|
||
|
BOTH
|
||
|
}
|
||
|
|
||
|
public FlutterEngine getAttachedFlutterEngine() {
|
||
|
return this.flutterEngine;
|
||
|
}
|
||
|
|
||
|
public FlutterImageView getCurrentImageSurface() {
|
||
|
return this.flutterImageView;
|
||
|
}
|
||
|
|
||
|
public boolean hasRenderedFirstFrame() {
|
||
|
return this.isFlutterUiDisplayed;
|
||
|
}
|
||
|
|
||
|
public FlutterView(Context context) {
|
||
|
this(context, (AttributeSet) null, new FlutterSurfaceView(context));
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public FlutterView(Context context, RenderMode renderMode) {
|
||
|
super(context, null);
|
||
|
this.flutterUiDisplayListeners = new HashSet();
|
||
|
this.flutterEngineAttachmentListeners = new HashSet();
|
||
|
this.viewportMetrics = new FlutterRenderer.ViewportMetrics();
|
||
|
this.onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener(this) { // from class: io.flutter.embedding.android.FlutterView.1
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.view.AccessibilityBridge.OnAccessibilityChangeListener
|
||
|
public void onAccessibilityChanged(boolean z, boolean z2) {
|
||
|
this.this$0.resetWillNotDraw(z, z2);
|
||
|
}
|
||
|
};
|
||
|
this.systemSettingsObserver = new ContentObserver(this, new Handler(Looper.getMainLooper())) { // from class: io.flutter.embedding.android.FlutterView.2
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public boolean deliverSelfNotifications() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public void onChange(boolean z) {
|
||
|
super.onChange(z);
|
||
|
if (this.this$0.flutterEngine == null) {
|
||
|
return;
|
||
|
}
|
||
|
Log.v(FlutterView.TAG, "System settings changed. Sending user settings to Flutter.");
|
||
|
this.this$0.sendUserSettingsToFlutter();
|
||
|
}
|
||
|
};
|
||
|
this.flutterUiDisplayListener = new FlutterUiDisplayListener(this) { // from class: io.flutter.embedding.android.FlutterView.3
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = true;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = false;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiNoLongerDisplayed();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.windowInfoListener = new QUU<oEt>(this) { // from class: io.flutter.embedding.android.FlutterView.4
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.QUU
|
||
|
public void accept(oEt oet) {
|
||
|
this.this$0.setWindowInfoListenerDisplayFeatures(oet);
|
||
|
}
|
||
|
};
|
||
|
if (renderMode == RenderMode.surface) {
|
||
|
FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(context);
|
||
|
this.flutterSurfaceView = flutterSurfaceView;
|
||
|
this.renderSurface = flutterSurfaceView;
|
||
|
} else if (renderMode == RenderMode.texture) {
|
||
|
FlutterTextureView flutterTextureView = new FlutterTextureView(context);
|
||
|
this.flutterTextureView = flutterTextureView;
|
||
|
this.renderSurface = flutterTextureView;
|
||
|
} else {
|
||
|
throw new IllegalArgumentException(String.format("RenderMode not supported with this constructor: %s", renderMode));
|
||
|
}
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public FlutterView(Context context, TransparencyMode transparencyMode) {
|
||
|
this(context, (AttributeSet) null, new FlutterSurfaceView(context, transparencyMode == TransparencyMode.transparent));
|
||
|
}
|
||
|
|
||
|
public FlutterView(Context context, FlutterSurfaceView flutterSurfaceView) {
|
||
|
this(context, (AttributeSet) null, flutterSurfaceView);
|
||
|
}
|
||
|
|
||
|
public FlutterView(Context context, FlutterTextureView flutterTextureView) {
|
||
|
this(context, (AttributeSet) null, flutterTextureView);
|
||
|
}
|
||
|
|
||
|
public FlutterView(Context context, FlutterImageView flutterImageView) {
|
||
|
this(context, (AttributeSet) null, flutterImageView);
|
||
|
}
|
||
|
|
||
|
public FlutterView(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, new FlutterSurfaceView(context));
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public FlutterView(Context context, RenderMode renderMode, TransparencyMode transparencyMode) {
|
||
|
super(context, null);
|
||
|
this.flutterUiDisplayListeners = new HashSet();
|
||
|
this.flutterEngineAttachmentListeners = new HashSet();
|
||
|
this.viewportMetrics = new FlutterRenderer.ViewportMetrics();
|
||
|
this.onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener(this) { // from class: io.flutter.embedding.android.FlutterView.1
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.view.AccessibilityBridge.OnAccessibilityChangeListener
|
||
|
public void onAccessibilityChanged(boolean z, boolean z2) {
|
||
|
this.this$0.resetWillNotDraw(z, z2);
|
||
|
}
|
||
|
};
|
||
|
this.systemSettingsObserver = new ContentObserver(this, new Handler(Looper.getMainLooper())) { // from class: io.flutter.embedding.android.FlutterView.2
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public boolean deliverSelfNotifications() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public void onChange(boolean z) {
|
||
|
super.onChange(z);
|
||
|
if (this.this$0.flutterEngine == null) {
|
||
|
return;
|
||
|
}
|
||
|
Log.v(FlutterView.TAG, "System settings changed. Sending user settings to Flutter.");
|
||
|
this.this$0.sendUserSettingsToFlutter();
|
||
|
}
|
||
|
};
|
||
|
this.flutterUiDisplayListener = new FlutterUiDisplayListener(this) { // from class: io.flutter.embedding.android.FlutterView.3
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = true;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = false;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiNoLongerDisplayed();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.windowInfoListener = new QUU<oEt>(this) { // from class: io.flutter.embedding.android.FlutterView.4
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.QUU
|
||
|
public void accept(oEt oet) {
|
||
|
this.this$0.setWindowInfoListenerDisplayFeatures(oet);
|
||
|
}
|
||
|
};
|
||
|
if (renderMode == RenderMode.surface) {
|
||
|
FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(context, transparencyMode == TransparencyMode.transparent);
|
||
|
this.flutterSurfaceView = flutterSurfaceView;
|
||
|
this.renderSurface = flutterSurfaceView;
|
||
|
} else if (renderMode == RenderMode.texture) {
|
||
|
FlutterTextureView flutterTextureView = new FlutterTextureView(context);
|
||
|
this.flutterTextureView = flutterTextureView;
|
||
|
this.renderSurface = flutterTextureView;
|
||
|
} else {
|
||
|
throw new IllegalArgumentException(String.format("RenderMode not supported with this constructor: %s", renderMode));
|
||
|
}
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
private FlutterView(Context context, AttributeSet attributeSet, FlutterSurfaceView flutterSurfaceView) {
|
||
|
super(context, attributeSet);
|
||
|
this.flutterUiDisplayListeners = new HashSet();
|
||
|
this.flutterEngineAttachmentListeners = new HashSet();
|
||
|
this.viewportMetrics = new FlutterRenderer.ViewportMetrics();
|
||
|
this.onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener(this) { // from class: io.flutter.embedding.android.FlutterView.1
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.view.AccessibilityBridge.OnAccessibilityChangeListener
|
||
|
public void onAccessibilityChanged(boolean z, boolean z2) {
|
||
|
this.this$0.resetWillNotDraw(z, z2);
|
||
|
}
|
||
|
};
|
||
|
this.systemSettingsObserver = new ContentObserver(this, new Handler(Looper.getMainLooper())) { // from class: io.flutter.embedding.android.FlutterView.2
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public boolean deliverSelfNotifications() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public void onChange(boolean z) {
|
||
|
super.onChange(z);
|
||
|
if (this.this$0.flutterEngine == null) {
|
||
|
return;
|
||
|
}
|
||
|
Log.v(FlutterView.TAG, "System settings changed. Sending user settings to Flutter.");
|
||
|
this.this$0.sendUserSettingsToFlutter();
|
||
|
}
|
||
|
};
|
||
|
this.flutterUiDisplayListener = new FlutterUiDisplayListener(this) { // from class: io.flutter.embedding.android.FlutterView.3
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = true;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = false;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiNoLongerDisplayed();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.windowInfoListener = new QUU<oEt>(this) { // from class: io.flutter.embedding.android.FlutterView.4
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.QUU
|
||
|
public void accept(oEt oet) {
|
||
|
this.this$0.setWindowInfoListenerDisplayFeatures(oet);
|
||
|
}
|
||
|
};
|
||
|
this.flutterSurfaceView = flutterSurfaceView;
|
||
|
this.renderSurface = flutterSurfaceView;
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
private FlutterView(Context context, AttributeSet attributeSet, FlutterTextureView flutterTextureView) {
|
||
|
super(context, attributeSet);
|
||
|
this.flutterUiDisplayListeners = new HashSet();
|
||
|
this.flutterEngineAttachmentListeners = new HashSet();
|
||
|
this.viewportMetrics = new FlutterRenderer.ViewportMetrics();
|
||
|
this.onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener(this) { // from class: io.flutter.embedding.android.FlutterView.1
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.view.AccessibilityBridge.OnAccessibilityChangeListener
|
||
|
public void onAccessibilityChanged(boolean z, boolean z2) {
|
||
|
this.this$0.resetWillNotDraw(z, z2);
|
||
|
}
|
||
|
};
|
||
|
this.systemSettingsObserver = new ContentObserver(this, new Handler(Looper.getMainLooper())) { // from class: io.flutter.embedding.android.FlutterView.2
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public boolean deliverSelfNotifications() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public void onChange(boolean z) {
|
||
|
super.onChange(z);
|
||
|
if (this.this$0.flutterEngine == null) {
|
||
|
return;
|
||
|
}
|
||
|
Log.v(FlutterView.TAG, "System settings changed. Sending user settings to Flutter.");
|
||
|
this.this$0.sendUserSettingsToFlutter();
|
||
|
}
|
||
|
};
|
||
|
this.flutterUiDisplayListener = new FlutterUiDisplayListener(this) { // from class: io.flutter.embedding.android.FlutterView.3
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = true;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = false;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiNoLongerDisplayed();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.windowInfoListener = new QUU<oEt>(this) { // from class: io.flutter.embedding.android.FlutterView.4
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.QUU
|
||
|
public void accept(oEt oet) {
|
||
|
this.this$0.setWindowInfoListenerDisplayFeatures(oet);
|
||
|
}
|
||
|
};
|
||
|
this.flutterTextureView = flutterTextureView;
|
||
|
this.renderSurface = flutterTextureView;
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
private FlutterView(Context context, AttributeSet attributeSet, FlutterImageView flutterImageView) {
|
||
|
super(context, attributeSet);
|
||
|
this.flutterUiDisplayListeners = new HashSet();
|
||
|
this.flutterEngineAttachmentListeners = new HashSet();
|
||
|
this.viewportMetrics = new FlutterRenderer.ViewportMetrics();
|
||
|
this.onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener(this) { // from class: io.flutter.embedding.android.FlutterView.1
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.view.AccessibilityBridge.OnAccessibilityChangeListener
|
||
|
public void onAccessibilityChanged(boolean z, boolean z2) {
|
||
|
this.this$0.resetWillNotDraw(z, z2);
|
||
|
}
|
||
|
};
|
||
|
this.systemSettingsObserver = new ContentObserver(this, new Handler(Looper.getMainLooper())) { // from class: io.flutter.embedding.android.FlutterView.2
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public boolean deliverSelfNotifications() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.ContentObserver
|
||
|
public void onChange(boolean z) {
|
||
|
super.onChange(z);
|
||
|
if (this.this$0.flutterEngine == null) {
|
||
|
return;
|
||
|
}
|
||
|
Log.v(FlutterView.TAG, "System settings changed. Sending user settings to Flutter.");
|
||
|
this.this$0.sendUserSettingsToFlutter();
|
||
|
}
|
||
|
};
|
||
|
this.flutterUiDisplayListener = new FlutterUiDisplayListener(this) { // from class: io.flutter.embedding.android.FlutterView.3
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = true;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
this.this$0.isFlutterUiDisplayed = false;
|
||
|
Iterator it = this.this$0.flutterUiDisplayListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((FlutterUiDisplayListener) it.next()).onFlutterUiNoLongerDisplayed();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.windowInfoListener = new QUU<oEt>(this) { // from class: io.flutter.embedding.android.FlutterView.4
|
||
|
final FlutterView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.QUU
|
||
|
public void accept(oEt oet) {
|
||
|
this.this$0.setWindowInfoListenerDisplayFeatures(oet);
|
||
|
}
|
||
|
};
|
||
|
this.flutterImageView = flutterImageView;
|
||
|
this.renderSurface = flutterImageView;
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
private void init() {
|
||
|
Log.v(TAG, "Initializing FlutterView");
|
||
|
if (this.flutterSurfaceView != null) {
|
||
|
Log.v(TAG, "Internally using a FlutterSurfaceView.");
|
||
|
addView(this.flutterSurfaceView);
|
||
|
} else if (this.flutterTextureView != null) {
|
||
|
Log.v(TAG, "Internally using a FlutterTextureView.");
|
||
|
addView(this.flutterTextureView);
|
||
|
} else {
|
||
|
Log.v(TAG, "Internally using a FlutterImageView.");
|
||
|
addView(this.flutterImageView);
|
||
|
}
|
||
|
setFocusable(true);
|
||
|
setFocusableInTouchMode(true);
|
||
|
setImportantForAutofill(4);
|
||
|
}
|
||
|
|
||
|
public void addOnFirstFrameRenderedListener(FlutterUiDisplayListener flutterUiDisplayListener) {
|
||
|
this.flutterUiDisplayListeners.add(flutterUiDisplayListener);
|
||
|
}
|
||
|
|
||
|
public void removeOnFirstFrameRenderedListener(FlutterUiDisplayListener flutterUiDisplayListener) {
|
||
|
this.flutterUiDisplayListeners.remove(flutterUiDisplayListener);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onConfigurationChanged(Configuration configuration) {
|
||
|
super.onConfigurationChanged(configuration);
|
||
|
if (this.flutterEngine != null) {
|
||
|
Log.v(TAG, "Configuration changed. Sending locales and user settings to Flutter.");
|
||
|
this.localizationPlugin.sendLocalesToFlutter(configuration);
|
||
|
sendUserSettingsToFlutter();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onSizeChanged(int i, int i2, int i3, int i4) {
|
||
|
super.onSizeChanged(i, i2, i3, i4);
|
||
|
Log.v(TAG, "Size changed. Sending Flutter new viewport metrics. FlutterView was " + i3 + " x " + i4 + ", it is now " + i + " x " + i2);
|
||
|
this.viewportMetrics.width = i;
|
||
|
this.viewportMetrics.height = i2;
|
||
|
sendViewportMetricsToFlutter();
|
||
|
}
|
||
|
|
||
|
protected WindowInfoRepositoryCallbackAdapterWrapper createWindowInfoRepo() {
|
||
|
try {
|
||
|
return new WindowInfoRepositoryCallbackAdapterWrapper(new C6827cck(InterfaceC11781eln.c.d(getContext())));
|
||
|
} catch (NoClassDefFoundError unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
protected void onAttachedToWindow() {
|
||
|
super.onAttachedToWindow();
|
||
|
this.windowInfoRepo = createWindowInfoRepo();
|
||
|
Activity activity = ViewUtils.getActivity(getContext());
|
||
|
WindowInfoRepositoryCallbackAdapterWrapper windowInfoRepositoryCallbackAdapterWrapper = this.windowInfoRepo;
|
||
|
if (windowInfoRepositoryCallbackAdapterWrapper == null || activity == null) {
|
||
|
return;
|
||
|
}
|
||
|
windowInfoRepositoryCallbackAdapterWrapper.addWindowLayoutInfoListener(activity, nMh.getMainExecutor(getContext()), this.windowInfoListener);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
protected void onDetachedFromWindow() {
|
||
|
WindowInfoRepositoryCallbackAdapterWrapper windowInfoRepositoryCallbackAdapterWrapper = this.windowInfoRepo;
|
||
|
if (windowInfoRepositoryCallbackAdapterWrapper != null) {
|
||
|
windowInfoRepositoryCallbackAdapterWrapper.removeWindowLayoutInfoListener(this.windowInfoListener);
|
||
|
}
|
||
|
this.windowInfoRepo = null;
|
||
|
super.onDetachedFromWindow();
|
||
|
}
|
||
|
|
||
|
protected void setWindowInfoListenerDisplayFeatures(oEt oet) {
|
||
|
WindowInsets rootWindowInsets;
|
||
|
DisplayCutout displayCutout;
|
||
|
FlutterRenderer.DisplayFeatureType displayFeatureType;
|
||
|
FlutterRenderer.DisplayFeatureState displayFeatureState;
|
||
|
List<VIk> e = oet.e();
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (VIk vIk : e) {
|
||
|
Log.v(TAG, "WindowInfoTracker Display Feature reported with bounds = " + vIk.CL_().toString() + " and type = " + vIk.getClass().getSimpleName());
|
||
|
if (vIk instanceof bWE) {
|
||
|
bWE bwe = (bWE) vIk;
|
||
|
if (bwe.e() == bWE.LWm.b) {
|
||
|
displayFeatureType = FlutterRenderer.DisplayFeatureType.HINGE;
|
||
|
} else {
|
||
|
displayFeatureType = FlutterRenderer.DisplayFeatureType.FOLD;
|
||
|
}
|
||
|
if (bwe.a() == bWE.RVV.d) {
|
||
|
displayFeatureState = FlutterRenderer.DisplayFeatureState.POSTURE_FLAT;
|
||
|
} else if (bwe.a() == bWE.RVV.b) {
|
||
|
displayFeatureState = FlutterRenderer.DisplayFeatureState.POSTURE_HALF_OPENED;
|
||
|
} else {
|
||
|
displayFeatureState = FlutterRenderer.DisplayFeatureState.UNKNOWN;
|
||
|
}
|
||
|
arrayList.add(new FlutterRenderer.DisplayFeature(vIk.CL_(), displayFeatureType, displayFeatureState));
|
||
|
} else {
|
||
|
arrayList.add(new FlutterRenderer.DisplayFeature(vIk.CL_(), FlutterRenderer.DisplayFeatureType.UNKNOWN, FlutterRenderer.DisplayFeatureState.UNKNOWN));
|
||
|
}
|
||
|
}
|
||
|
if (Build.VERSION.SDK_INT >= 28 && (rootWindowInsets = getRootWindowInsets()) != null && (displayCutout = rootWindowInsets.getDisplayCutout()) != null) {
|
||
|
for (Rect rect : displayCutout.getBoundingRects()) {
|
||
|
Log.v(TAG, "DisplayCutout area reported with bounds = " + rect.toString());
|
||
|
arrayList.add(new FlutterRenderer.DisplayFeature(rect, FlutterRenderer.DisplayFeatureType.CUTOUT));
|
||
|
}
|
||
|
}
|
||
|
this.viewportMetrics.displayFeatures = arrayList;
|
||
|
sendViewportMetricsToFlutter();
|
||
|
}
|
||
|
|
||
|
private ZeroSides calculateShouldZeroSides() {
|
||
|
Context context = getContext();
|
||
|
int i = context.getResources().getConfiguration().orientation;
|
||
|
int rotation = ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getRotation();
|
||
|
if (i == 2) {
|
||
|
if (rotation == 1) {
|
||
|
return ZeroSides.RIGHT;
|
||
|
}
|
||
|
if (rotation == 3) {
|
||
|
return ZeroSides.LEFT;
|
||
|
}
|
||
|
if (rotation == 0 || rotation == 2) {
|
||
|
return ZeroSides.BOTH;
|
||
|
}
|
||
|
}
|
||
|
return ZeroSides.NONE;
|
||
|
}
|
||
|
|
||
|
private int guessBottomKeyboardInset(WindowInsets windowInsets) {
|
||
|
if (windowInsets.getSystemWindowInsetBottom() < getRootView().getHeight() * 0.18d) {
|
||
|
return 0;
|
||
|
}
|
||
|
return windowInsets.getSystemWindowInsetBottom();
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public final WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
||
|
WindowInsets onApplyWindowInsets = super.onApplyWindowInsets(windowInsets);
|
||
|
if (Build.VERSION.SDK_INT == 29) {
|
||
|
Insets systemGestureInsets = windowInsets.getSystemGestureInsets();
|
||
|
this.viewportMetrics.systemGestureInsetTop = systemGestureInsets.top;
|
||
|
this.viewportMetrics.systemGestureInsetRight = systemGestureInsets.right;
|
||
|
this.viewportMetrics.systemGestureInsetBottom = systemGestureInsets.bottom;
|
||
|
this.viewportMetrics.systemGestureInsetLeft = systemGestureInsets.left;
|
||
|
}
|
||
|
boolean z = (getWindowSystemUiVisibility() & 4) == 0;
|
||
|
boolean z2 = (getWindowSystemUiVisibility() & 2) == 0;
|
||
|
if (Build.VERSION.SDK_INT >= 30) {
|
||
|
int navigationBars = z2 ? WindowInsets.Type.navigationBars() : 0;
|
||
|
if (z) {
|
||
|
navigationBars |= WindowInsets.Type.statusBars();
|
||
|
}
|
||
|
Insets insets = windowInsets.getInsets(navigationBars);
|
||
|
this.viewportMetrics.viewPaddingTop = insets.top;
|
||
|
this.viewportMetrics.viewPaddingRight = insets.right;
|
||
|
this.viewportMetrics.viewPaddingBottom = insets.bottom;
|
||
|
this.viewportMetrics.viewPaddingLeft = insets.left;
|
||
|
Insets insets2 = windowInsets.getInsets(WindowInsets.Type.ime());
|
||
|
this.viewportMetrics.viewInsetTop = insets2.top;
|
||
|
this.viewportMetrics.viewInsetRight = insets2.right;
|
||
|
this.viewportMetrics.viewInsetBottom = insets2.bottom;
|
||
|
this.viewportMetrics.viewInsetLeft = insets2.left;
|
||
|
Insets insets3 = windowInsets.getInsets(WindowInsets.Type.systemGestures());
|
||
|
this.viewportMetrics.systemGestureInsetTop = insets3.top;
|
||
|
this.viewportMetrics.systemGestureInsetRight = insets3.right;
|
||
|
this.viewportMetrics.systemGestureInsetBottom = insets3.bottom;
|
||
|
this.viewportMetrics.systemGestureInsetLeft = insets3.left;
|
||
|
DisplayCutout displayCutout = windowInsets.getDisplayCutout();
|
||
|
if (displayCutout != null) {
|
||
|
Insets waterfallInsets = displayCutout.getWaterfallInsets();
|
||
|
FlutterRenderer.ViewportMetrics viewportMetrics = this.viewportMetrics;
|
||
|
viewportMetrics.viewPaddingTop = Math.max(Math.max(viewportMetrics.viewPaddingTop, waterfallInsets.top), displayCutout.getSafeInsetTop());
|
||
|
FlutterRenderer.ViewportMetrics viewportMetrics2 = this.viewportMetrics;
|
||
|
viewportMetrics2.viewPaddingRight = Math.max(Math.max(viewportMetrics2.viewPaddingRight, waterfallInsets.right), displayCutout.getSafeInsetRight());
|
||
|
FlutterRenderer.ViewportMetrics viewportMetrics3 = this.viewportMetrics;
|
||
|
viewportMetrics3.viewPaddingBottom = Math.max(Math.max(viewportMetrics3.viewPaddingBottom, waterfallInsets.bottom), displayCutout.getSafeInsetBottom());
|
||
|
FlutterRenderer.ViewportMetrics viewportMetrics4 = this.viewportMetrics;
|
||
|
viewportMetrics4.viewPaddingLeft = Math.max(Math.max(viewportMetrics4.viewPaddingLeft, waterfallInsets.left), displayCutout.getSafeInsetLeft());
|
||
|
}
|
||
|
} else {
|
||
|
ZeroSides zeroSides = ZeroSides.NONE;
|
||
|
if (!z2) {
|
||
|
zeroSides = calculateShouldZeroSides();
|
||
|
}
|
||
|
this.viewportMetrics.viewPaddingTop = z ? windowInsets.getSystemWindowInsetTop() : 0;
|
||
|
this.viewportMetrics.viewPaddingRight = (zeroSides == ZeroSides.RIGHT || zeroSides == ZeroSides.BOTH) ? 0 : windowInsets.getSystemWindowInsetRight();
|
||
|
this.viewportMetrics.viewPaddingBottom = (z2 && guessBottomKeyboardInset(windowInsets) == 0) ? windowInsets.getSystemWindowInsetBottom() : 0;
|
||
|
this.viewportMetrics.viewPaddingLeft = (zeroSides == ZeroSides.LEFT || zeroSides == ZeroSides.BOTH) ? 0 : windowInsets.getSystemWindowInsetLeft();
|
||
|
this.viewportMetrics.viewInsetTop = 0;
|
||
|
this.viewportMetrics.viewInsetRight = 0;
|
||
|
this.viewportMetrics.viewInsetBottom = guessBottomKeyboardInset(windowInsets);
|
||
|
this.viewportMetrics.viewInsetLeft = 0;
|
||
|
}
|
||
|
Log.v(TAG, "Updating window insets (onApplyWindowInsets()):\nStatus bar insets: Top: " + this.viewportMetrics.viewPaddingTop + ", Left: " + this.viewportMetrics.viewPaddingLeft + ", Right: " + this.viewportMetrics.viewPaddingRight + "\nKeyboard insets: Bottom: " + this.viewportMetrics.viewInsetBottom + ", Left: " + this.viewportMetrics.viewInsetLeft + ", Right: " + this.viewportMetrics.viewInsetRight + "System Gesture Insets - Left: " + this.viewportMetrics.systemGestureInsetLeft + ", Top: " + this.viewportMetrics.systemGestureInsetTop + ", Right: " + this.viewportMetrics.systemGestureInsetRight + ", Bottom: " + this.viewportMetrics.viewInsetBottom);
|
||
|
sendViewportMetricsToFlutter();
|
||
|
return onApplyWindowInsets;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected boolean fitSystemWindows(Rect rect) {
|
||
|
return super.fitSystemWindows(rect);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||
|
if (!isAttachedToFlutterEngine()) {
|
||
|
return super.onCreateInputConnection(editorInfo);
|
||
|
}
|
||
|
return this.textInputPlugin.createInputConnection(this, this.keyboardManager, editorInfo);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public boolean checkInputConnectionProxy(View view) {
|
||
|
FlutterEngine flutterEngine = this.flutterEngine;
|
||
|
if (flutterEngine != null) {
|
||
|
return flutterEngine.getPlatformViewsController().checkInputConnectionProxy(view);
|
||
|
}
|
||
|
return super.checkInputConnectionProxy(view);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
||
|
if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
|
||
|
getKeyDispatcherState().startTracking(keyEvent, this);
|
||
|
} else if (keyEvent.getAction() == 1) {
|
||
|
getKeyDispatcherState().handleUpEvent(keyEvent);
|
||
|
}
|
||
|
return (isAttachedToFlutterEngine() && this.keyboardManager.handleEvent(keyEvent)) || super.dispatchKeyEvent(keyEvent);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||
|
if (!isAttachedToFlutterEngine()) {
|
||
|
return super.onTouchEvent(motionEvent);
|
||
|
}
|
||
|
requestUnbufferedDispatch(motionEvent);
|
||
|
return this.androidTouchProcessor.onTouchEvent(motionEvent);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
|
||
|
if (isAttachedToFlutterEngine() && this.androidTouchProcessor.onGenericMotionEvent(motionEvent)) {
|
||
|
return true;
|
||
|
}
|
||
|
return super.onGenericMotionEvent(motionEvent);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||
|
if (!isAttachedToFlutterEngine()) {
|
||
|
return super.onHoverEvent(motionEvent);
|
||
|
}
|
||
|
return this.accessibilityBridge.onAccessibilityHoverEvent(motionEvent);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public AccessibilityNodeProvider getAccessibilityNodeProvider() {
|
||
|
AccessibilityBridge accessibilityBridge = this.accessibilityBridge;
|
||
|
if (accessibilityBridge == null || !accessibilityBridge.isAccessibilityEnabled()) {
|
||
|
return null;
|
||
|
}
|
||
|
return this.accessibilityBridge;
|
||
|
}
|
||
|
|
||
|
public View findViewByAccessibilityIdTraversal(int i) {
|
||
|
if (Build.VERSION.SDK_INT < 29) {
|
||
|
return findViewByAccessibilityIdRootedAtCurrentView(i, this);
|
||
|
}
|
||
|
try {
|
||
|
Method declaredMethod = View.class.getDeclaredMethod("findViewByAccessibilityIdTraversal", Integer.TYPE);
|
||
|
declaredMethod.setAccessible(true);
|
||
|
return (View) declaredMethod.invoke(this, Integer.valueOf(i));
|
||
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private View findViewByAccessibilityIdRootedAtCurrentView(int i, View view) {
|
||
|
try {
|
||
|
int i2 = 0;
|
||
|
Method declaredMethod = View.class.getDeclaredMethod("getAccessibilityViewId", new Class[0]);
|
||
|
declaredMethod.setAccessible(true);
|
||
|
if (declaredMethod.invoke(view, new Object[0]).equals(Integer.valueOf(i))) {
|
||
|
return view;
|
||
|
}
|
||
|
if (!(view instanceof ViewGroup)) {
|
||
|
return null;
|
||
|
}
|
||
|
while (true) {
|
||
|
ViewGroup viewGroup = (ViewGroup) view;
|
||
|
if (i2 >= viewGroup.getChildCount()) {
|
||
|
return null;
|
||
|
}
|
||
|
View findViewByAccessibilityIdRootedAtCurrentView = findViewByAccessibilityIdRootedAtCurrentView(i, viewGroup.getChildAt(i2));
|
||
|
if (findViewByAccessibilityIdRootedAtCurrentView != null) {
|
||
|
return findViewByAccessibilityIdRootedAtCurrentView;
|
||
|
}
|
||
|
i2++;
|
||
|
}
|
||
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void resetWillNotDraw(boolean z, boolean z2) {
|
||
|
boolean z3 = false;
|
||
|
if (!this.flutterEngine.getRenderer().isSoftwareRenderingEnabled()) {
|
||
|
if (!z && !z2) {
|
||
|
z3 = true;
|
||
|
}
|
||
|
setWillNotDraw(z3);
|
||
|
return;
|
||
|
}
|
||
|
setWillNotDraw(false);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate
|
||
|
public PointerIcon getSystemPointerIcon(int i) {
|
||
|
return PointerIcon.getSystemIcon(getContext(), i);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.android.KeyboardManager.ViewDelegate
|
||
|
public BinaryMessenger getBinaryMessenger() {
|
||
|
return this.flutterEngine.getDartExecutor();
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.android.KeyboardManager.ViewDelegate
|
||
|
public boolean onTextInputKeyEvent(KeyEvent keyEvent) {
|
||
|
return this.textInputPlugin.handleKeyEvent(keyEvent);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.android.KeyboardManager.ViewDelegate
|
||
|
public void redispatch(KeyEvent keyEvent) {
|
||
|
getRootView().dispatchKeyEvent(keyEvent);
|
||
|
}
|
||
|
|
||
|
public void attachToFlutterEngine(FlutterEngine flutterEngine) {
|
||
|
Log.v(TAG, "Attaching to a FlutterEngine: " + flutterEngine);
|
||
|
if (isAttachedToFlutterEngine()) {
|
||
|
if (flutterEngine == this.flutterEngine) {
|
||
|
Log.v(TAG, "Already attached to this engine. Doing nothing.");
|
||
|
return;
|
||
|
} else {
|
||
|
Log.v(TAG, "Currently attached to a different engine. Detaching and then attaching to new engine.");
|
||
|
detachFromFlutterEngine();
|
||
|
}
|
||
|
}
|
||
|
this.flutterEngine = flutterEngine;
|
||
|
FlutterRenderer renderer = flutterEngine.getRenderer();
|
||
|
this.isFlutterUiDisplayed = renderer.isDisplayingFlutterUi();
|
||
|
this.renderSurface.attachToRenderer(renderer);
|
||
|
renderer.addIsDisplayingFlutterUiListener(this.flutterUiDisplayListener);
|
||
|
this.mouseCursorPlugin = new MouseCursorPlugin(this, this.flutterEngine.getMouseCursorChannel());
|
||
|
this.textInputPlugin = new TextInputPlugin(this, this.flutterEngine.getTextInputChannel(), this.flutterEngine.getPlatformViewsController());
|
||
|
try {
|
||
|
this.textServicesManager = (TextServicesManager) getContext().getSystemService("textservices");
|
||
|
this.spellCheckPlugin = new SpellCheckPlugin(this.textServicesManager, this.flutterEngine.getSpellCheckChannel());
|
||
|
} catch (Exception unused) {
|
||
|
Log.e(TAG, "TextServicesManager not supported by device, spell check disabled.");
|
||
|
}
|
||
|
this.localizationPlugin = this.flutterEngine.getLocalizationPlugin();
|
||
|
this.keyboardManager = new KeyboardManager(this);
|
||
|
this.androidTouchProcessor = new AndroidTouchProcessor(this.flutterEngine.getRenderer(), false);
|
||
|
AccessibilityBridge accessibilityBridge = new AccessibilityBridge(this, flutterEngine.getAccessibilityChannel(), (AccessibilityManager) getContext().getSystemService("accessibility"), getContext().getContentResolver(), this.flutterEngine.getPlatformViewsController());
|
||
|
this.accessibilityBridge = accessibilityBridge;
|
||
|
accessibilityBridge.setOnAccessibilityChangeListener(this.onAccessibilityChangeListener);
|
||
|
resetWillNotDraw(this.accessibilityBridge.isAccessibilityEnabled(), this.accessibilityBridge.isTouchExplorationEnabled());
|
||
|
this.flutterEngine.getPlatformViewsController().attachAccessibilityBridge(this.accessibilityBridge);
|
||
|
this.flutterEngine.getPlatformViewsController().attachToFlutterRenderer(this.flutterEngine.getRenderer());
|
||
|
this.textInputPlugin.getInputMethodManager().restartInput(this);
|
||
|
sendUserSettingsToFlutter();
|
||
|
getContext().getContentResolver().registerContentObserver(Settings.System.getUriFor("show_password"), false, this.systemSettingsObserver);
|
||
|
sendViewportMetricsToFlutter();
|
||
|
flutterEngine.getPlatformViewsController().attachToView(this);
|
||
|
Iterator<FlutterEngineAttachmentListener> it = this.flutterEngineAttachmentListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onFlutterEngineAttachedToFlutterView(flutterEngine);
|
||
|
}
|
||
|
if (this.isFlutterUiDisplayed) {
|
||
|
this.flutterUiDisplayListener.onFlutterUiDisplayed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void detachFromFlutterEngine() {
|
||
|
Log.v(TAG, "Detaching from a FlutterEngine: " + this.flutterEngine);
|
||
|
if (!isAttachedToFlutterEngine()) {
|
||
|
Log.v(TAG, "FlutterView not attached to an engine. Not detaching.");
|
||
|
return;
|
||
|
}
|
||
|
Iterator<FlutterEngineAttachmentListener> it = this.flutterEngineAttachmentListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onFlutterEngineDetachedFromFlutterView();
|
||
|
}
|
||
|
getContext().getContentResolver().unregisterContentObserver(this.systemSettingsObserver);
|
||
|
this.flutterEngine.getPlatformViewsController().detachFromView();
|
||
|
this.flutterEngine.getPlatformViewsController().detachAccessibilityBridge();
|
||
|
this.accessibilityBridge.release();
|
||
|
this.accessibilityBridge = null;
|
||
|
this.textInputPlugin.getInputMethodManager().restartInput(this);
|
||
|
this.textInputPlugin.destroy();
|
||
|
this.keyboardManager.destroy();
|
||
|
SpellCheckPlugin spellCheckPlugin = this.spellCheckPlugin;
|
||
|
if (spellCheckPlugin != null) {
|
||
|
spellCheckPlugin.destroy();
|
||
|
}
|
||
|
MouseCursorPlugin mouseCursorPlugin = this.mouseCursorPlugin;
|
||
|
if (mouseCursorPlugin != null) {
|
||
|
mouseCursorPlugin.destroy();
|
||
|
}
|
||
|
FlutterRenderer renderer = this.flutterEngine.getRenderer();
|
||
|
this.isFlutterUiDisplayed = false;
|
||
|
renderer.removeIsDisplayingFlutterUiListener(this.flutterUiDisplayListener);
|
||
|
renderer.stopRenderingToSurface();
|
||
|
renderer.setSemanticsEnabled(false);
|
||
|
RenderSurface renderSurface = this.previousRenderSurface;
|
||
|
if (renderSurface != null && this.renderSurface == this.flutterImageView) {
|
||
|
this.renderSurface = renderSurface;
|
||
|
}
|
||
|
this.renderSurface.detachFromRenderer();
|
||
|
FlutterImageView flutterImageView = this.flutterImageView;
|
||
|
if (flutterImageView != null) {
|
||
|
flutterImageView.closeImageReader();
|
||
|
removeView(this.flutterImageView);
|
||
|
this.flutterImageView = null;
|
||
|
}
|
||
|
this.previousRenderSurface = null;
|
||
|
this.flutterEngine = null;
|
||
|
}
|
||
|
|
||
|
public FlutterImageView createImageView() {
|
||
|
return new FlutterImageView(getContext(), getWidth(), getHeight(), FlutterImageView.SurfaceKind.background);
|
||
|
}
|
||
|
|
||
|
public void convertToImageView() {
|
||
|
this.renderSurface.pause();
|
||
|
FlutterImageView flutterImageView = this.flutterImageView;
|
||
|
if (flutterImageView == null) {
|
||
|
FlutterImageView createImageView = createImageView();
|
||
|
this.flutterImageView = createImageView;
|
||
|
addView(createImageView);
|
||
|
} else {
|
||
|
flutterImageView.resizeIfNeeded(getWidth(), getHeight());
|
||
|
}
|
||
|
this.previousRenderSurface = this.renderSurface;
|
||
|
FlutterImageView flutterImageView2 = this.flutterImageView;
|
||
|
this.renderSurface = flutterImageView2;
|
||
|
FlutterEngine flutterEngine = this.flutterEngine;
|
||
|
if (flutterEngine != null) {
|
||
|
flutterImageView2.attachToRenderer(flutterEngine.getRenderer());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void revertImageView(Runnable runnable) {
|
||
|
FlutterImageView flutterImageView = this.flutterImageView;
|
||
|
if (flutterImageView == null) {
|
||
|
Log.v(TAG, "Tried to revert the image view, but no image view is used.");
|
||
|
return;
|
||
|
}
|
||
|
RenderSurface renderSurface = this.previousRenderSurface;
|
||
|
if (renderSurface == null) {
|
||
|
Log.v(TAG, "Tried to revert the image view, but no previous surface was used.");
|
||
|
return;
|
||
|
}
|
||
|
this.renderSurface = renderSurface;
|
||
|
this.previousRenderSurface = null;
|
||
|
FlutterEngine flutterEngine = this.flutterEngine;
|
||
|
if (flutterEngine == null) {
|
||
|
flutterImageView.detachFromRenderer();
|
||
|
runnable.run();
|
||
|
return;
|
||
|
}
|
||
|
FlutterRenderer renderer = flutterEngine.getRenderer();
|
||
|
if (renderer == null) {
|
||
|
this.flutterImageView.detachFromRenderer();
|
||
|
runnable.run();
|
||
|
} else {
|
||
|
this.renderSurface.attachToRenderer(renderer);
|
||
|
renderer.addIsDisplayingFlutterUiListener(new FlutterUiDisplayListener(this, renderer, runnable) { // from class: io.flutter.embedding.android.FlutterView.5
|
||
|
final FlutterView this$0;
|
||
|
final Runnable val$onDone;
|
||
|
final FlutterRenderer val$renderer;
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiNoLongerDisplayed() {
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
this.val$renderer = renderer;
|
||
|
this.val$onDone = runnable;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
|
||
|
public void onFlutterUiDisplayed() {
|
||
|
this.val$renderer.removeIsDisplayingFlutterUiListener(this);
|
||
|
this.val$onDone.run();
|
||
|
if ((this.this$0.renderSurface instanceof FlutterImageView) || this.this$0.flutterImageView == null) {
|
||
|
return;
|
||
|
}
|
||
|
this.this$0.flutterImageView.detachFromRenderer();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void attachOverlaySurfaceToRender(FlutterImageView flutterImageView) {
|
||
|
FlutterEngine flutterEngine = this.flutterEngine;
|
||
|
if (flutterEngine != null) {
|
||
|
flutterImageView.attachToRenderer(flutterEngine.getRenderer());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public boolean acquireLatestImageViewFrame() {
|
||
|
FlutterImageView flutterImageView = this.flutterImageView;
|
||
|
if (flutterImageView != null) {
|
||
|
return flutterImageView.acquireLatestImage();
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public boolean isAttachedToFlutterEngine() {
|
||
|
FlutterEngine flutterEngine = this.flutterEngine;
|
||
|
return flutterEngine != null && flutterEngine.getRenderer() == this.renderSurface.getAttachedRenderer();
|
||
|
}
|
||
|
|
||
|
public void addFlutterEngineAttachmentListener(FlutterEngineAttachmentListener flutterEngineAttachmentListener) {
|
||
|
this.flutterEngineAttachmentListeners.add(flutterEngineAttachmentListener);
|
||
|
}
|
||
|
|
||
|
public void removeFlutterEngineAttachmentListener(FlutterEngineAttachmentListener flutterEngineAttachmentListener) {
|
||
|
this.flutterEngineAttachmentListeners.remove(flutterEngineAttachmentListener);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x003c, code lost:
|
||
|
|
||
|
if (r1 != false) goto L13;
|
||
|
*/
|
||
|
/* JADX WARN: Removed duplicated region for block: B:14:0x006d */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
void sendUserSettingsToFlutter() {
|
||
|
/*
|
||
|
r6 = this;
|
||
|
android.content.res.Resources r0 = r6.getResources()
|
||
|
android.content.res.Configuration r0 = r0.getConfiguration()
|
||
|
int r0 = r0.uiMode
|
||
|
r0 = r0 & 48
|
||
|
r1 = 32
|
||
|
if (r0 != r1) goto L13
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$PlatformBrightness r0 = io.flutter.embedding.engine.systemchannels.SettingsChannel.PlatformBrightness.dark
|
||
|
goto L15
|
||
|
L13:
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$PlatformBrightness r0 = io.flutter.embedding.engine.systemchannels.SettingsChannel.PlatformBrightness.light
|
||
|
L15:
|
||
|
android.view.textservice.TextServicesManager r1 = r6.textServicesManager
|
||
|
r2 = 0
|
||
|
r3 = 1
|
||
|
if (r1 == 0) goto L40
|
||
|
int r1 = android.os.Build.VERSION.SDK_INT
|
||
|
r4 = 31
|
||
|
if (r1 < r4) goto L3e
|
||
|
android.view.textservice.TextServicesManager r1 = r6.textServicesManager
|
||
|
java.util.List r1 = r1.getEnabledSpellCheckerInfos()
|
||
|
java.util.stream.Stream r1 = r1.stream()
|
||
|
io.flutter.embedding.android.FlutterView$$ExternalSyntheticLambda0 r4 = new io.flutter.embedding.android.FlutterView$$ExternalSyntheticLambda0
|
||
|
r4.<init>()
|
||
|
boolean r1 = r1.anyMatch(r4)
|
||
|
android.view.textservice.TextServicesManager r4 = r6.textServicesManager
|
||
|
boolean r4 = r4.isSpellCheckerEnabled()
|
||
|
if (r4 == 0) goto L40
|
||
|
if (r1 == 0) goto L40
|
||
|
L3e:
|
||
|
r1 = r3
|
||
|
goto L41
|
||
|
L40:
|
||
|
r1 = r2
|
||
|
L41:
|
||
|
io.flutter.embedding.engine.FlutterEngine r4 = r6.flutterEngine
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel r4 = r4.getSettingsChannel()
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r4 = r4.startMessage()
|
||
|
android.content.res.Resources r5 = r6.getResources()
|
||
|
android.content.res.Configuration r5 = r5.getConfiguration()
|
||
|
float r5 = r5.fontScale
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r4 = r4.setTextScaleFactor(r5)
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r1 = r4.setNativeSpellCheckServiceDefined(r1)
|
||
|
android.content.Context r4 = r6.getContext()
|
||
|
android.content.ContentResolver r4 = r4.getContentResolver()
|
||
|
java.lang.String r5 = "show_password"
|
||
|
int r4 = android.provider.Settings.System.getInt(r4, r5, r3)
|
||
|
if (r4 != r3) goto L6e
|
||
|
r2 = r3
|
||
|
L6e:
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r1 = r1.setBrieflyShowPassword(r2)
|
||
|
android.content.Context r2 = r6.getContext()
|
||
|
boolean r2 = android.text.format.DateFormat.is24HourFormat(r2)
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r1 = r1.setUse24HourFormat(r2)
|
||
|
io.flutter.embedding.engine.systemchannels.SettingsChannel$MessageBuilder r0 = r1.setPlatformBrightness(r0)
|
||
|
r0.send()
|
||
|
return
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: io.flutter.embedding.android.FlutterView.sendUserSettingsToFlutter():void");
|
||
|
}
|
||
|
|
||
|
private void sendViewportMetricsToFlutter() {
|
||
|
if (!isAttachedToFlutterEngine()) {
|
||
|
Log.w(TAG, "Tried to send viewport metrics from Android to Flutter but this FlutterView was not attached to a FlutterEngine.");
|
||
|
return;
|
||
|
}
|
||
|
this.viewportMetrics.devicePixelRatio = getResources().getDisplayMetrics().density;
|
||
|
this.viewportMetrics.physicalTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
||
|
this.flutterEngine.getRenderer().setViewportMetrics(this.viewportMetrics);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void onProvideAutofillVirtualStructure(ViewStructure viewStructure, int i) {
|
||
|
super.onProvideAutofillVirtualStructure(viewStructure, i);
|
||
|
this.textInputPlugin.onProvideAutofillVirtualStructure(viewStructure, i);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void autofill(SparseArray<AutofillValue> sparseArray) {
|
||
|
this.textInputPlugin.autofill(sparseArray);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setVisibility(int i) {
|
||
|
super.setVisibility(i);
|
||
|
RenderSurface renderSurface = this.renderSurface;
|
||
|
if (renderSurface instanceof FlutterSurfaceView) {
|
||
|
((FlutterSurfaceView) renderSurface).setVisibility(i);
|
||
|
}
|
||
|
}
|
||
|
}
|