package com.facetec.sdk; import com.facetec.sdk.fn; import java.io.IOException; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; /* loaded from: classes.dex */ final class fq extends ek { private final dx a; private final ek b; private final Type d; /* JADX INFO: Access modifiers changed from: package-private */ public fq(dx dxVar, ek ekVar, Type type) { this.a = dxVar; this.b = ekVar; this.d = type; } @Override // com.facetec.sdk.ek public final T a(fu fuVar) throws IOException { return this.b.a(fuVar); } @Override // com.facetec.sdk.ek public final void b(ga gaVar, T t) throws IOException { ek ekVar = this.b; Type type = this.d; if (t != null && (type == Object.class || (type instanceof TypeVariable) || (type instanceof Class))) { type = t.getClass(); } if (type != this.d) { ekVar = this.a.d(fv.b(type)); if (ekVar instanceof fn.e) { ek ekVar2 = this.b; if (!(ekVar2 instanceof fn.e)) { ekVar = ekVar2; } } } ekVar.b(gaVar, t); } }