小红书.apk(点击下载) / b.java


package p02;

import android.os.Bundle;
import android.text.TextUtils;
import com.xingin.utils.async.run.task.XYRunnable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import ki2.d;
import ko2.e;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

@Metadata(bv = {}, d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\bÆ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u000e\u0010\u000fJ$\u0010\b\u001a\u00020\u00072\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0004\u001a\u0004\u0018\u00010\u00022\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005J\u001a\u0010\n\u001a\u00020\u00072\b\u0010\u0004\u001a\u0004\u0018\u00010\u00022\b\u0010\t\u001a\u0004\u0018\u00010\u0005J\u0014\u0010\r\u001a\u0004\u0018\u00010\f2\b\u0010\u000b\u001a\u0004\u0018\u00010\u0002H\u0002¨\u0006\u0010"}, d2 = {"Lp02/b;", "", "", "delegationName", "observerId", "Landroid/os/Bundle;", "params", "", "a", "resultData", "c", "delegateName", "Lp02/a;", "b", "<init>", "()V", "xyprocess_library_release"}, k = 1, mv = {1, 4, 0})
/* compiled from: AppMessengerDelegationUtils.kt */
public final class b {

    /* renamed from: a  reason: collision with root package name */
    public static final b f116605a = new b();

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"p02/b$a", "Lcom/xingin/utils/async/run/task/XYRunnable;", "", "execute", "xyprocess_library_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: AppMessengerDelegationUtils.kt */
    public static final class a extends XYRunnable {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ a f116606a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public a(a aVar, String str) {
            super(str, null, 2, null);
            this.f116606a = aVar;
        }

        @Override // com.xingin.utils.async.run.task.XYRunnable
        public void execute() {
            Bundle c14 = b12.b.f6018b.c(this.f116606a.d());
            try {
                a aVar = this.f116606a;
                if (c14 == null) {
                    c14 = new Bundle();
                }
                aVar.a(c14);
            } catch (Exception e14) {
                e.f("AppMessengerDelegationUtils", "call messenger delegation", e14);
            }
        }
    }

    public final void a(String str, String str2, Bundle bundle) {
        a b14 = b(str);
        if (b14 == null) {
            c(str2, null);
            return;
        }
        if (bundle == null) {
            bundle = new Bundle();
        }
        b14.g(bundle);
        b14.f(str2);
        mi2.a.m(new a(b14, "wvDegt"));
    }

    public final a b(String str) {
        if (TextUtils.isEmpty(str)) {
            e.a("AppMessengerDelegationUtils", "create delegation with null delegate name");
            return null;
        }
        if (str == null) {
            try {
                Intrinsics.throwNpe();
            } catch (Exception e14) {
                e.f("AppMessengerDelegationUtils", "create delegation", e14);
                return null;
            }
        }
        Class<?> cls = Class.forName(str);
        int modifiers = cls.getModifiers();
        if (a.class.isAssignableFrom(cls) && !cls.isInterface()) {
            if (!Modifier.isAbstract(modifiers)) {
                Constructor<?> declaredConstructor = cls.getDeclaredConstructor(new Class[0]);
                Intrinsics.checkExpressionValueIsNotNull(declaredConstructor, "constructor");
                declaredConstructor.setAccessible(true);
                Object newInstance = declaredConstructor.newInstance(new Object[0]);
                if (!(newInstance instanceof a)) {
                    return null;
                }
                return (a) newInstance;
            }
        }
        return null;
    }

    public final void c(String str, Bundle bundle) {
        if (!TextUtils.isEmpty(str)) {
            Bundle bundle2 = new Bundle();
            bundle2.putString("key_observer_id", str);
            if (bundle != null) {
                bundle2.putBundle("key_result_data", b12.b.f6018b.d(bundle));
            }
            if (d.f98474d.a().e()) {
                y02.a.f156427a.e(bundle2);
            } else {
                y02.a.f156427a.f(bundle2);
            }
        }
    }
}