package com.google.gson.internal;

import android.support.v4.media.session.b;
import com.google.gson.d;
import com.google.gson.u;
import com.google.gson.v;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import tk.e;
import xk.c;

/* loaded from: classes3.dex */
public final class Excluder implements v, Cloneable {

    /* renamed from: v, reason: collision with root package name */
    public static final Excluder f14866v = new Excluder();

    /* renamed from: s, reason: collision with root package name */
    private boolean f14870s;

    /* renamed from: p, reason: collision with root package name */
    private double f14867p = -1.0d;

    /* renamed from: q, reason: collision with root package name */
    private int f14868q = 136;

    /* renamed from: r, reason: collision with root package name */
    private boolean f14869r = true;

    /* renamed from: t, reason: collision with root package name */
    private List f14871t = Collections.emptyList();

    /* renamed from: u, reason: collision with root package name */
    private List f14872u = Collections.emptyList();

    /* loaded from: classes3.dex */
    class a extends u {

        /* renamed from: a, reason: collision with root package name */
        private u f14873a;

        /* renamed from: b, reason: collision with root package name */
        final /* synthetic */ boolean f14874b;

        /* renamed from: c, reason: collision with root package name */
        final /* synthetic */ boolean f14875c;

        /* renamed from: d, reason: collision with root package name */
        final /* synthetic */ d f14876d;

        /* renamed from: e, reason: collision with root package name */
        final /* synthetic */ com.google.gson.reflect.a f14877e;

        a(boolean z10, boolean z11, d dVar, com.google.gson.reflect.a aVar) {
            this.f14874b = z10;
            this.f14875c = z11;
            this.f14876d = dVar;
            this.f14877e = aVar;
        }

        private u a() {
            u uVar = this.f14873a;
            if (uVar != null) {
                return uVar;
            }
            u o10 = this.f14876d.o(Excluder.this, this.f14877e);
            this.f14873a = o10;
            return o10;
        }

        @Override // com.google.gson.u
        public Object read(xk.a aVar) {
            if (!this.f14874b) {
                return a().read(aVar);
            }
            aVar.g0();
            return null;
        }

        @Override // com.google.gson.u
        public void write(c cVar, Object obj) {
            if (this.f14875c) {
                cVar.t();
            } else {
                a().write(cVar, obj);
            }
        }
    }

    private boolean c(Class cls) {
        if (this.f14867p == -1.0d || n((tk.d) cls.getAnnotation(tk.d.class), (e) cls.getAnnotation(e.class))) {
            return (!this.f14869r && i(cls)) || h(cls);
        }
        return true;
    }

    private boolean d(Class cls, boolean z10) {
        Iterator it = (z10 ? this.f14871t : this.f14872u).iterator();
        if (!it.hasNext()) {
            return false;
        }
        b.a(it.next());
        throw null;
    }

    private boolean h(Class cls) {
        return (Enum.class.isAssignableFrom(cls) || j(cls) || (!cls.isAnonymousClass() && !cls.isLocalClass())) ? false : true;
    }

    private boolean i(Class cls) {
        return cls.isMemberClass() && !j(cls);
    }

    private boolean j(Class cls) {
        return (cls.getModifiers() & 8) != 0;
    }

    private boolean k(tk.d dVar) {
        return dVar == null || dVar.value() <= this.f14867p;
    }

    private boolean l(e eVar) {
        return eVar == null || eVar.value() > this.f14867p;
    }

    private boolean n(tk.d dVar, e eVar) {
        return k(dVar) && l(eVar);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    /* renamed from: a, reason: merged with bridge method [inline-methods] */
    public Excluder clone() {
        try {
            return (Excluder) super.clone();
        } catch (CloneNotSupportedException e10) {
            throw new AssertionError(e10);
        }
    }

    public boolean b(Class cls, boolean z10) {
        return c(cls) || d(cls, z10);
    }

    @Override // com.google.gson.v
    public u create(d dVar, com.google.gson.reflect.a aVar) {
        Class<Object> rawType = aVar.getRawType();
        boolean c10 = c(rawType);
        boolean z10 = c10 || d(rawType, true);
        boolean z11 = c10 || d(rawType, false);
        if (z10 || z11) {
            return new a(z11, z10, dVar, aVar);
        }
        return null;
    }

    public boolean f(Field field, boolean z10) {
        tk.a aVar;
        if ((this.f14868q & field.getModifiers()) != 0) {
            return true;
        }
        if ((this.f14867p != -1.0d && !n((tk.d) field.getAnnotation(tk.d.class), (e) field.getAnnotation(e.class))) || field.isSynthetic()) {
            return true;
        }
        if (this.f14870s && ((aVar = (tk.a) field.getAnnotation(tk.a.class)) == null || (!z10 ? aVar.deserialize() : aVar.serialize()))) {
            return true;
        }
        if ((!this.f14869r && i(field.getType())) || h(field.getType())) {
            return true;
        }
        List list = z10 ? this.f14871t : this.f14872u;
        if (list.isEmpty()) {
            return false;
        }
        new com.google.gson.a(field);
        Iterator it = list.iterator();
        if (!it.hasNext()) {
            return false;
        }
        b.a(it.next());
        throw null;
    }
}
