Rabbit-R1/original r1/java/sources/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java
2024-05-21 17:08:36 -04:00

965 lines
41 KiB
Java

package io.flutter.embedding.engine;
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.lifecycle.Lifecycle;
import io.flutter.Log;
import io.flutter.embedding.android.ExclusiveAppComponent;
import io.flutter.embedding.engine.loader.FlutterLoader;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.PluginRegistry;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityControlSurface;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverAware;
import io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface;
import io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverPluginBinding;
import io.flutter.embedding.engine.plugins.contentprovider.ContentProviderAware;
import io.flutter.embedding.engine.plugins.contentprovider.ContentProviderControlSurface;
import io.flutter.embedding.engine.plugins.contentprovider.ContentProviderPluginBinding;
import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference;
import io.flutter.embedding.engine.plugins.service.ServiceAware;
import io.flutter.embedding.engine.plugins.service.ServiceControlSurface;
import io.flutter.embedding.engine.plugins.service.ServicePluginBinding;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.util.TraceSection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public class FlutterEngineConnectionRegistry implements PluginRegistry, ActivityControlSurface, ServiceControlSurface, BroadcastReceiverControlSurface, ContentProviderControlSurface {
private static final String TAG = "FlutterEngineCxnRegstry";
private FlutterEngineActivityPluginBinding activityPluginBinding;
private BroadcastReceiver broadcastReceiver;
private FlutterEngineBroadcastReceiverPluginBinding broadcastReceiverPluginBinding;
private ContentProvider contentProvider;
private FlutterEngineContentProviderPluginBinding contentProviderPluginBinding;
private ExclusiveAppComponent<Activity> exclusiveActivity;
private final FlutterEngine flutterEngine;
private final FlutterPlugin.FlutterPluginBinding pluginBinding;
private Service service;
private FlutterEngineServicePluginBinding servicePluginBinding;
private final Map<Class<? extends FlutterPlugin>, FlutterPlugin> plugins = new HashMap();
private final Map<Class<? extends FlutterPlugin>, ActivityAware> activityAwarePlugins = new HashMap();
private boolean isWaitingForActivityReattachment = false;
private final Map<Class<? extends FlutterPlugin>, ServiceAware> serviceAwarePlugins = new HashMap();
private final Map<Class<? extends FlutterPlugin>, BroadcastReceiverAware> broadcastReceiverAwarePlugins = new HashMap();
private final Map<Class<? extends FlutterPlugin>, ContentProviderAware> contentProviderAwarePlugins = new HashMap();
private boolean isAttachedToActivity() {
return this.exclusiveActivity != null;
}
private boolean isAttachedToBroadcastReceiver() {
return this.broadcastReceiver != null;
}
private boolean isAttachedToContentProvider() {
return this.contentProvider != null;
}
private boolean isAttachedToService() {
return this.service != null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public FlutterEngineConnectionRegistry(Context context, FlutterEngine flutterEngine, FlutterLoader flutterLoader, FlutterEngineGroup flutterEngineGroup) {
this.flutterEngine = flutterEngine;
this.pluginBinding = new FlutterPlugin.FlutterPluginBinding(context, flutterEngine, flutterEngine.getDartExecutor(), flutterEngine.getRenderer(), flutterEngine.getPlatformViewsController().getRegistry(), new DefaultFlutterAssets(flutterLoader), flutterEngineGroup);
}
public void destroy() {
Log.v(TAG, "Destroying.");
detachFromAppComponent();
removeAll();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public void add(FlutterPlugin flutterPlugin) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#add " + flutterPlugin.getClass().getSimpleName());
try {
if (has(flutterPlugin.getClass())) {
Log.w(TAG, "Attempted to register plugin (" + flutterPlugin + ") but it was already registered with this FlutterEngine (" + this.flutterEngine + ").");
if (scoped != null) {
scoped.close();
return;
}
return;
}
Log.v(TAG, "Adding plugin: " + flutterPlugin);
this.plugins.put(flutterPlugin.getClass(), flutterPlugin);
flutterPlugin.onAttachedToEngine(this.pluginBinding);
if (flutterPlugin instanceof ActivityAware) {
ActivityAware activityAware = (ActivityAware) flutterPlugin;
this.activityAwarePlugins.put(flutterPlugin.getClass(), activityAware);
if (isAttachedToActivity()) {
activityAware.onAttachedToActivity(this.activityPluginBinding);
}
}
if (flutterPlugin instanceof ServiceAware) {
ServiceAware serviceAware = (ServiceAware) flutterPlugin;
this.serviceAwarePlugins.put(flutterPlugin.getClass(), serviceAware);
if (isAttachedToService()) {
serviceAware.onAttachedToService(this.servicePluginBinding);
}
}
if (flutterPlugin instanceof BroadcastReceiverAware) {
BroadcastReceiverAware broadcastReceiverAware = (BroadcastReceiverAware) flutterPlugin;
this.broadcastReceiverAwarePlugins.put(flutterPlugin.getClass(), broadcastReceiverAware);
if (isAttachedToBroadcastReceiver()) {
broadcastReceiverAware.onAttachedToBroadcastReceiver(this.broadcastReceiverPluginBinding);
}
}
if (flutterPlugin instanceof ContentProviderAware) {
ContentProviderAware contentProviderAware = (ContentProviderAware) flutterPlugin;
this.contentProviderAwarePlugins.put(flutterPlugin.getClass(), contentProviderAware);
if (isAttachedToContentProvider()) {
contentProviderAware.onAttachedToContentProvider(this.contentProviderPluginBinding);
}
}
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public void add(Set<FlutterPlugin> set) {
Iterator<FlutterPlugin> it = set.iterator();
while (it.hasNext()) {
add(it.next());
}
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public boolean has(Class<? extends FlutterPlugin> cls) {
return this.plugins.containsKey(cls);
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public FlutterPlugin get(Class<? extends FlutterPlugin> cls) {
return this.plugins.get(cls);
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public void remove(Class<? extends FlutterPlugin> cls) {
FlutterPlugin flutterPlugin = this.plugins.get(cls);
if (flutterPlugin == null) {
return;
}
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#remove " + cls.getSimpleName());
try {
if (flutterPlugin instanceof ActivityAware) {
if (isAttachedToActivity()) {
((ActivityAware) flutterPlugin).onDetachedFromActivity();
}
this.activityAwarePlugins.remove(cls);
}
if (flutterPlugin instanceof ServiceAware) {
if (isAttachedToService()) {
((ServiceAware) flutterPlugin).onDetachedFromService();
}
this.serviceAwarePlugins.remove(cls);
}
if (flutterPlugin instanceof BroadcastReceiverAware) {
if (isAttachedToBroadcastReceiver()) {
((BroadcastReceiverAware) flutterPlugin).onDetachedFromBroadcastReceiver();
}
this.broadcastReceiverAwarePlugins.remove(cls);
}
if (flutterPlugin instanceof ContentProviderAware) {
if (isAttachedToContentProvider()) {
((ContentProviderAware) flutterPlugin).onDetachedFromContentProvider();
}
this.contentProviderAwarePlugins.remove(cls);
}
flutterPlugin.onDetachedFromEngine(this.pluginBinding);
this.plugins.remove(cls);
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public void remove(Set<Class<? extends FlutterPlugin>> set) {
Iterator<Class<? extends FlutterPlugin>> it = set.iterator();
while (it.hasNext()) {
remove(it.next());
}
}
@Override // io.flutter.embedding.engine.plugins.PluginRegistry
public void removeAll() {
remove(new HashSet(this.plugins.keySet()));
this.plugins.clear();
}
private void detachFromAppComponent() {
if (isAttachedToActivity()) {
detachFromActivity();
return;
}
if (isAttachedToService()) {
detachFromService();
} else if (isAttachedToBroadcastReceiver()) {
detachFromBroadcastReceiver();
} else if (isAttachedToContentProvider()) {
detachFromContentProvider();
}
}
private Activity attachedActivity() {
ExclusiveAppComponent<Activity> exclusiveAppComponent = this.exclusiveActivity;
if (exclusiveAppComponent != null) {
return exclusiveAppComponent.getAppComponent();
}
return null;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void attachToActivity(ExclusiveAppComponent<Activity> exclusiveAppComponent, Lifecycle lifecycle) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#attachToActivity");
try {
ExclusiveAppComponent<Activity> exclusiveAppComponent2 = this.exclusiveActivity;
if (exclusiveAppComponent2 != null) {
exclusiveAppComponent2.detachFromFlutterEngine();
}
detachFromAppComponent();
this.exclusiveActivity = exclusiveAppComponent;
attachToActivityInternal(exclusiveAppComponent.getAppComponent(), lifecycle);
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
private void attachToActivityInternal(Activity activity, Lifecycle lifecycle) {
this.activityPluginBinding = new FlutterEngineActivityPluginBinding(activity, lifecycle);
this.flutterEngine.getPlatformViewsController().setSoftwareRendering(activity.getIntent() != null ? activity.getIntent().getBooleanExtra(FlutterShellArgs.ARG_KEY_ENABLE_SOFTWARE_RENDERING, false) : false);
this.flutterEngine.getPlatformViewsController().attach(activity, this.flutterEngine.getRenderer(), this.flutterEngine.getDartExecutor());
for (ActivityAware activityAware : this.activityAwarePlugins.values()) {
if (this.isWaitingForActivityReattachment) {
activityAware.onReattachedToActivityForConfigChanges(this.activityPluginBinding);
} else {
activityAware.onAttachedToActivity(this.activityPluginBinding);
}
}
this.isWaitingForActivityReattachment = false;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void detachFromActivityForConfigChanges() {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#detachFromActivityForConfigChanges");
try {
this.isWaitingForActivityReattachment = true;
Iterator<ActivityAware> it = this.activityAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onDetachedFromActivityForConfigChanges();
}
detachFromActivityInternal();
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to detach plugins from an Activity when no Activity was attached.");
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void detachFromActivity() {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#detachFromActivity");
try {
Iterator<ActivityAware> it = this.activityAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onDetachedFromActivity();
}
detachFromActivityInternal();
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to detach plugins from an Activity when no Activity was attached.");
}
private void detachFromActivityInternal() {
this.flutterEngine.getPlatformViewsController().detach();
this.exclusiveActivity = null;
this.activityPluginBinding = null;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public boolean onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onRequestPermissionsResult");
try {
boolean onRequestPermissionsResult = this.activityPluginBinding.onRequestPermissionsResult(i, strArr, iArr);
if (scoped != null) {
scoped.close();
}
return onRequestPermissionsResult;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onRequestPermissionsResult, but no Activity was attached.");
return false;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public boolean onActivityResult(int i, int i2, Intent intent) {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onActivityResult");
try {
boolean onActivityResult = this.activityPluginBinding.onActivityResult(i, i2, intent);
if (scoped != null) {
scoped.close();
}
return onActivityResult;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onActivityResult, but no Activity was attached.");
return false;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void onNewIntent(Intent intent) {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onNewIntent");
try {
this.activityPluginBinding.onNewIntent(intent);
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onNewIntent, but no Activity was attached.");
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void onUserLeaveHint() {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onUserLeaveHint");
try {
this.activityPluginBinding.onUserLeaveHint();
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onUserLeaveHint, but no Activity was attached.");
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void onSaveInstanceState(Bundle bundle) {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onSaveInstanceState");
try {
this.activityPluginBinding.onSaveInstanceState(bundle);
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onSaveInstanceState, but no Activity was attached.");
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
public void onRestoreInstanceState(Bundle bundle) {
if (isAttachedToActivity()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onRestoreInstanceState");
try {
this.activityPluginBinding.onRestoreInstanceState(bundle);
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to notify ActivityAware plugins of onRestoreInstanceState, but no Activity was attached.");
}
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
public void attachToService(Service service, Lifecycle lifecycle, boolean z) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#attachToService");
try {
detachFromAppComponent();
this.service = service;
this.servicePluginBinding = new FlutterEngineServicePluginBinding(service, lifecycle);
Iterator<ServiceAware> it = this.serviceAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onAttachedToService(this.servicePluginBinding);
}
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
public void detachFromService() {
if (isAttachedToService()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#detachFromService");
try {
Iterator<ServiceAware> it = this.serviceAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onDetachedFromService();
}
this.service = null;
this.servicePluginBinding = null;
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to detach plugins from a Service when no Service was attached.");
}
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
public void onMoveToForeground() {
if (isAttachedToService()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onMoveToForeground");
try {
this.servicePluginBinding.onMoveToForeground();
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
}
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
public void onMoveToBackground() {
if (isAttachedToService()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#onMoveToBackground");
try {
this.servicePluginBinding.onMoveToBackground();
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
}
@Override // io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface
public void attachToBroadcastReceiver(BroadcastReceiver broadcastReceiver, Lifecycle lifecycle) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#attachToBroadcastReceiver");
try {
detachFromAppComponent();
this.broadcastReceiver = broadcastReceiver;
this.broadcastReceiverPluginBinding = new FlutterEngineBroadcastReceiverPluginBinding(broadcastReceiver);
Iterator<BroadcastReceiverAware> it = this.broadcastReceiverAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onAttachedToBroadcastReceiver(this.broadcastReceiverPluginBinding);
}
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
@Override // io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface
public void detachFromBroadcastReceiver() {
if (isAttachedToBroadcastReceiver()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#detachFromBroadcastReceiver");
try {
Iterator<BroadcastReceiverAware> it = this.broadcastReceiverAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onDetachedFromBroadcastReceiver();
}
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to detach plugins from a BroadcastReceiver when no BroadcastReceiver was attached.");
}
@Override // io.flutter.embedding.engine.plugins.contentprovider.ContentProviderControlSurface
public void attachToContentProvider(ContentProvider contentProvider, Lifecycle lifecycle) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#attachToContentProvider");
try {
detachFromAppComponent();
this.contentProvider = contentProvider;
this.contentProviderPluginBinding = new FlutterEngineContentProviderPluginBinding(contentProvider);
Iterator<ContentProviderAware> it = this.contentProviderAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onAttachedToContentProvider(this.contentProviderPluginBinding);
}
if (scoped != null) {
scoped.close();
}
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
@Override // io.flutter.embedding.engine.plugins.contentprovider.ContentProviderControlSurface
public void detachFromContentProvider() {
if (isAttachedToContentProvider()) {
TraceSection scoped = TraceSection.scoped("FlutterEngineConnectionRegistry#detachFromContentProvider");
try {
Iterator<ContentProviderAware> it = this.contentProviderAwarePlugins.values().iterator();
while (it.hasNext()) {
it.next().onDetachedFromContentProvider();
}
if (scoped != null) {
scoped.close();
return;
}
return;
} catch (Throwable th) {
if (scoped != null) {
try {
scoped.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
}
throw th;
}
}
Log.e(TAG, "Attempted to detach plugins from a ContentProvider when no ContentProvider was attached.");
}
/* loaded from: classes3.dex */
private static class DefaultFlutterAssets implements FlutterPlugin.FlutterAssets {
final FlutterLoader flutterLoader;
private DefaultFlutterAssets(FlutterLoader flutterLoader) {
this.flutterLoader = flutterLoader;
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterAssets
public String getAssetFilePathByName(String str) {
return this.flutterLoader.getLookupKeyForAsset(str);
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterAssets
public String getAssetFilePathByName(String str, String str2) {
return this.flutterLoader.getLookupKeyForAsset(str, str2);
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterAssets
public String getAssetFilePathBySubpath(String str) {
return this.flutterLoader.getLookupKeyForAsset(str);
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterAssets
public String getAssetFilePathBySubpath(String str, String str2) {
return this.flutterLoader.getLookupKeyForAsset(str, str2);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes3.dex */
public static class FlutterEngineActivityPluginBinding implements ActivityPluginBinding {
private final Activity activity;
private final HiddenLifecycleReference hiddenLifecycleReference;
private final Set<PluginRegistry.RequestPermissionsResultListener> onRequestPermissionsResultListeners = new HashSet();
private final Set<PluginRegistry.ActivityResultListener> onActivityResultListeners = new HashSet();
private final Set<PluginRegistry.NewIntentListener> onNewIntentListeners = new HashSet();
private final Set<PluginRegistry.UserLeaveHintListener> onUserLeaveHintListeners = new HashSet();
private final Set<PluginRegistry.WindowFocusChangedListener> onWindowFocusChangedListeners = new HashSet();
private final Set<ActivityPluginBinding.OnSaveInstanceStateListener> onSaveInstanceStateListeners = new HashSet();
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public Activity getActivity() {
return this.activity;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public Object getLifecycle() {
return this.hiddenLifecycleReference;
}
public FlutterEngineActivityPluginBinding(Activity activity, Lifecycle lifecycle) {
this.activity = activity;
this.hiddenLifecycleReference = new HiddenLifecycleReference(lifecycle);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener requestPermissionsResultListener) {
this.onRequestPermissionsResultListeners.add(requestPermissionsResultListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener requestPermissionsResultListener) {
this.onRequestPermissionsResultListeners.remove(requestPermissionsResultListener);
}
boolean onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
Iterator<PluginRegistry.RequestPermissionsResultListener> it = this.onRequestPermissionsResultListeners.iterator();
while (true) {
boolean z = false;
while (it.hasNext()) {
if (it.next().onRequestPermissionsResult(i, strArr, iArr) || z) {
z = true;
}
}
return z;
}
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addActivityResultListener(PluginRegistry.ActivityResultListener activityResultListener) {
this.onActivityResultListeners.add(activityResultListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeActivityResultListener(PluginRegistry.ActivityResultListener activityResultListener) {
this.onActivityResultListeners.remove(activityResultListener);
}
boolean onActivityResult(int i, int i2, Intent intent) {
Iterator it = new HashSet(this.onActivityResultListeners).iterator();
while (true) {
boolean z = false;
while (it.hasNext()) {
if (((PluginRegistry.ActivityResultListener) it.next()).onActivityResult(i, i2, intent) || z) {
z = true;
}
}
return z;
}
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addOnNewIntentListener(PluginRegistry.NewIntentListener newIntentListener) {
this.onNewIntentListeners.add(newIntentListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeOnNewIntentListener(PluginRegistry.NewIntentListener newIntentListener) {
this.onNewIntentListeners.remove(newIntentListener);
}
void onNewIntent(Intent intent) {
Iterator<PluginRegistry.NewIntentListener> it = this.onNewIntentListeners.iterator();
while (it.hasNext()) {
it.next().onNewIntent(intent);
}
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener userLeaveHintListener) {
this.onUserLeaveHintListeners.add(userLeaveHintListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener userLeaveHintListener) {
this.onUserLeaveHintListeners.remove(userLeaveHintListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addOnWindowFocusChangedListener(PluginRegistry.WindowFocusChangedListener windowFocusChangedListener) {
this.onWindowFocusChangedListeners.add(windowFocusChangedListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeOnWindowFocusChangedListener(PluginRegistry.WindowFocusChangedListener windowFocusChangedListener) {
this.onWindowFocusChangedListeners.remove(windowFocusChangedListener);
}
void onWindowFocusChanged(boolean z) {
Iterator<PluginRegistry.WindowFocusChangedListener> it = this.onWindowFocusChangedListeners.iterator();
while (it.hasNext()) {
it.next().onWindowFocusChanged(z);
}
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void addOnSaveStateListener(ActivityPluginBinding.OnSaveInstanceStateListener onSaveInstanceStateListener) {
this.onSaveInstanceStateListeners.add(onSaveInstanceStateListener);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
public void removeOnSaveStateListener(ActivityPluginBinding.OnSaveInstanceStateListener onSaveInstanceStateListener) {
this.onSaveInstanceStateListeners.remove(onSaveInstanceStateListener);
}
void onUserLeaveHint() {
Iterator<PluginRegistry.UserLeaveHintListener> it = this.onUserLeaveHintListeners.iterator();
while (it.hasNext()) {
it.next().onUserLeaveHint();
}
}
void onSaveInstanceState(Bundle bundle) {
Iterator<ActivityPluginBinding.OnSaveInstanceStateListener> it = this.onSaveInstanceStateListeners.iterator();
while (it.hasNext()) {
it.next().onSaveInstanceState(bundle);
}
}
void onRestoreInstanceState(Bundle bundle) {
Iterator<ActivityPluginBinding.OnSaveInstanceStateListener> it = this.onSaveInstanceStateListeners.iterator();
while (it.hasNext()) {
it.next().onRestoreInstanceState(bundle);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes3.dex */
public static class FlutterEngineServicePluginBinding implements ServicePluginBinding {
private final HiddenLifecycleReference hiddenLifecycleReference;
private final Set<ServiceAware.OnModeChangeListener> onModeChangeListeners = new HashSet();
private final Service service;
@Override // io.flutter.embedding.engine.plugins.service.ServicePluginBinding
public Object getLifecycle() {
return this.hiddenLifecycleReference;
}
@Override // io.flutter.embedding.engine.plugins.service.ServicePluginBinding
public Service getService() {
return this.service;
}
FlutterEngineServicePluginBinding(Service service, Lifecycle lifecycle) {
this.service = service;
this.hiddenLifecycleReference = lifecycle != null ? new HiddenLifecycleReference(lifecycle) : null;
}
@Override // io.flutter.embedding.engine.plugins.service.ServicePluginBinding
public void addOnModeChangeListener(ServiceAware.OnModeChangeListener onModeChangeListener) {
this.onModeChangeListeners.add(onModeChangeListener);
}
@Override // io.flutter.embedding.engine.plugins.service.ServicePluginBinding
public void removeOnModeChangeListener(ServiceAware.OnModeChangeListener onModeChangeListener) {
this.onModeChangeListeners.remove(onModeChangeListener);
}
void onMoveToForeground() {
Iterator<ServiceAware.OnModeChangeListener> it = this.onModeChangeListeners.iterator();
while (it.hasNext()) {
it.next().onMoveToForeground();
}
}
void onMoveToBackground() {
Iterator<ServiceAware.OnModeChangeListener> it = this.onModeChangeListeners.iterator();
while (it.hasNext()) {
it.next().onMoveToBackground();
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes3.dex */
public static class FlutterEngineBroadcastReceiverPluginBinding implements BroadcastReceiverPluginBinding {
private final BroadcastReceiver broadcastReceiver;
@Override // io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverPluginBinding
public BroadcastReceiver getBroadcastReceiver() {
return this.broadcastReceiver;
}
FlutterEngineBroadcastReceiverPluginBinding(BroadcastReceiver broadcastReceiver) {
this.broadcastReceiver = broadcastReceiver;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes3.dex */
public static class FlutterEngineContentProviderPluginBinding implements ContentProviderPluginBinding {
private final ContentProvider contentProvider;
@Override // io.flutter.embedding.engine.plugins.contentprovider.ContentProviderPluginBinding
public ContentProvider getContentProvider() {
return this.contentProvider;
}
FlutterEngineContentProviderPluginBinding(ContentProvider contentProvider) {
this.contentProvider = contentProvider;
}
}
}