package d.c.a;

import android.os.RemoteException;
import com.codezjx.andlinker.BaseTypeWrapper;
import com.codezjx.andlinker.InTypeWrapper;
import com.codezjx.andlinker.Request;
import com.codezjx.andlinker.Response;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Objects;

/* JADX INFO: compiled from: Invoker.java */
/* JADX INFO: loaded from: classes.dex */
public class j implements InvocationHandler {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ int f2427b;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Class f2428e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ k f2429f;

    public j(k kVar, int i2, Class cls) {
        this.f2429f = kVar;
        this.f2427b = i2;
        this.f2428e = cls;
    }

    @Override // java.lang.reflect.InvocationHandler
    public Object invoke(Object obj, Method method, Object[] objArr) throws Throwable {
        Object obj2;
        int iBeginBroadcast = this.f2429f.f2431c.beginBroadcast();
        int i2 = 0;
        while (true) {
            obj2 = null;
            if (i2 >= iBeginBroadcast) {
                break;
            }
            if (((Integer) this.f2429f.f2431c.getBroadcastCookie(i2)).intValue() == this.f2427b) {
                try {
                    k kVar = this.f2429f;
                    String simpleName = this.f2428e.getSimpleName();
                    String name = method.getName();
                    Objects.requireNonNull(kVar);
                    int length = objArr != null ? objArr.length : 0;
                    BaseTypeWrapper[] baseTypeWrapperArr = new BaseTypeWrapper[length];
                    for (int i3 = 0; i3 < length; i3++) {
                        baseTypeWrapperArr[i3] = new InTypeWrapper(objArr[i3], objArr[i3].getClass());
                    }
                    Response responseD = ((h) this.f2429f.f2431c.getBroadcastItem(i2)).d(new Request(simpleName, name, baseTypeWrapperArr));
                    obj2 = responseD.f1952f;
                    if (responseD.f1950b != 200) {
                        l.b("Invoker", "Execute remote callback fail: " + responseD.toString());
                    }
                } catch (RemoteException e2) {
                    l.c(6, "Invoker", "Error when execute callback!", e2);
                }
            } else {
                i2++;
            }
        }
        this.f2429f.f2431c.finishBroadcast();
        return obj2;
    }
}
