739 lines
33 KiB
Java
739 lines
33 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 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;
|
|
import o.wdQ;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.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) {
|
|
this.flutterEngine = flutterEngine;
|
|
this.pluginBinding = new FlutterPlugin.FlutterPluginBinding(context, flutterEngine, flutterEngine.getDartExecutor(), flutterEngine.getRenderer(), flutterEngine.getPlatformViewsController().getRegistry(), new DefaultFlutterAssets(flutterLoader));
|
|
}
|
|
|
|
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.begin("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 + ").");
|
|
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);
|
|
}
|
|
}
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
@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.begin("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);
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
@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, wdQ wdq) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#attachToActivity");
|
|
try {
|
|
ExclusiveAppComponent<Activity> exclusiveAppComponent2 = this.exclusiveActivity;
|
|
if (exclusiveAppComponent2 != null) {
|
|
exclusiveAppComponent2.detachFromFlutterEngine();
|
|
}
|
|
detachFromAppComponent();
|
|
this.exclusiveActivity = exclusiveAppComponent;
|
|
attachToActivityInternal(exclusiveAppComponent.getAppComponent(), wdq);
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
private void attachToActivityInternal(Activity activity, wdQ wdq) {
|
|
this.activityPluginBinding = new FlutterEngineActivityPluginBinding(activity, wdq);
|
|
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.begin("FlutterEngineConnectionRegistry#detachFromActivityForConfigChanges");
|
|
try {
|
|
this.isWaitingForActivityReattachment = true;
|
|
Iterator<ActivityAware> it = this.activityAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onDetachedFromActivityForConfigChanges();
|
|
}
|
|
detachFromActivityInternal();
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#detachFromActivity");
|
|
try {
|
|
Iterator<ActivityAware> it = this.activityAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onDetachedFromActivity();
|
|
}
|
|
detachFromActivityInternal();
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onRequestPermissionsResult");
|
|
try {
|
|
return this.activityPluginBinding.onRequestPermissionsResult(i, strArr, iArr);
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onActivityResult");
|
|
try {
|
|
return this.activityPluginBinding.onActivityResult(i, i2, intent);
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onNewIntent");
|
|
try {
|
|
this.activityPluginBinding.onNewIntent(intent);
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onUserLeaveHint");
|
|
try {
|
|
this.activityPluginBinding.onUserLeaveHint();
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onSaveInstanceState");
|
|
try {
|
|
this.activityPluginBinding.onSaveInstanceState(bundle);
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onRestoreInstanceState");
|
|
try {
|
|
this.activityPluginBinding.onRestoreInstanceState(bundle);
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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, wdQ wdq, boolean z) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#attachToService");
|
|
try {
|
|
detachFromAppComponent();
|
|
this.service = service;
|
|
this.servicePluginBinding = new FlutterEngineServicePluginBinding(service, wdq);
|
|
Iterator<ServiceAware> it = this.serviceAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onAttachedToService(this.servicePluginBinding);
|
|
}
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
|
|
public void detachFromService() {
|
|
if (isAttachedToService()) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#detachFromService");
|
|
try {
|
|
Iterator<ServiceAware> it = this.serviceAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onDetachedFromService();
|
|
}
|
|
this.service = null;
|
|
this.servicePluginBinding = null;
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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.begin("FlutterEngineConnectionRegistry#onMoveToForeground");
|
|
try {
|
|
this.servicePluginBinding.onMoveToForeground();
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.service.ServiceControlSurface
|
|
public void onMoveToBackground() {
|
|
if (isAttachedToService()) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#onMoveToBackground");
|
|
try {
|
|
this.servicePluginBinding.onMoveToBackground();
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface
|
|
public void attachToBroadcastReceiver(BroadcastReceiver broadcastReceiver, wdQ wdq) {
|
|
TraceSection.begin("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);
|
|
}
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface
|
|
public void detachFromBroadcastReceiver() {
|
|
if (isAttachedToBroadcastReceiver()) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#detachFromBroadcastReceiver");
|
|
try {
|
|
Iterator<BroadcastReceiverAware> it = this.broadcastReceiverAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onDetachedFromBroadcastReceiver();
|
|
}
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
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, wdQ wdq) {
|
|
TraceSection.begin("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);
|
|
}
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.contentprovider.ContentProviderControlSurface
|
|
public void detachFromContentProvider() {
|
|
if (isAttachedToContentProvider()) {
|
|
TraceSection.begin("FlutterEngineConnectionRegistry#detachFromContentProvider");
|
|
try {
|
|
Iterator<ContentProviderAware> it = this.contentProviderAwarePlugins.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onDetachedFromContentProvider();
|
|
}
|
|
return;
|
|
} finally {
|
|
TraceSection.end();
|
|
}
|
|
}
|
|
Log.e(TAG, "Attempted to detach plugins from a ContentProvider when no ContentProvider was attached.");
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
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: package-private */
|
|
/* loaded from: classes6.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<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, wdQ wdq) {
|
|
this.activity = activity;
|
|
this.hiddenLifecycleReference = new HiddenLifecycleReference(wdq);
|
|
}
|
|
|
|
@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) {
|
|
boolean z;
|
|
Iterator<PluginRegistry.RequestPermissionsResultListener> it = this.onRequestPermissionsResultListeners.iterator();
|
|
while (true) {
|
|
while (it.hasNext()) {
|
|
z = it.next().onRequestPermissionsResult(i, strArr, iArr) || z;
|
|
}
|
|
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) {
|
|
boolean z;
|
|
Iterator it = new HashSet(this.onActivityResultListeners).iterator();
|
|
while (true) {
|
|
while (it.hasNext()) {
|
|
z = ((PluginRegistry.ActivityResultListener) it.next()).onActivityResult(i, i2, intent) || z;
|
|
}
|
|
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 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: package-private */
|
|
/* loaded from: classes6.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, wdQ wdq) {
|
|
this.service = service;
|
|
this.hiddenLifecycleReference = wdq != null ? new HiddenLifecycleReference(wdq) : 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: package-private */
|
|
/* loaded from: classes6.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: package-private */
|
|
/* loaded from: classes6.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;
|
|
}
|
|
}
|
|
}
|