package s1; /* loaded from: classes.dex */ class p implements v { /* renamed from: a, reason: collision with root package name */ private final boolean f13939a; /* renamed from: b, reason: collision with root package name */ private final boolean f13940b; /* renamed from: c, reason: collision with root package name */ private final v f13941c; /* renamed from: d, reason: collision with root package name */ private final a f13942d; /* renamed from: e, reason: collision with root package name */ private final q1.f f13943e; /* renamed from: f, reason: collision with root package name */ private int f13944f; /* renamed from: g, reason: collision with root package name */ private boolean f13945g; interface a { void a(q1.f fVar, p pVar); } p(v vVar, boolean z10, boolean z11, q1.f fVar, a aVar) { this.f13941c = (v) m2.j.d(vVar); this.f13939a = z10; this.f13940b = z11; this.f13943e = fVar; this.f13942d = (a) m2.j.d(aVar); } @Override // s1.v public synchronized void a() { if (this.f13944f > 0) { throw new IllegalStateException("Cannot recycle a resource while it is still acquired"); } if (this.f13945g) { throw new IllegalStateException("Cannot recycle a resource that has already been recycled"); } this.f13945g = true; if (this.f13940b) { this.f13941c.a(); } } @Override // s1.v public int b() { return this.f13941c.b(); } synchronized void c() { if (this.f13945g) { throw new IllegalStateException("Cannot acquire a recycled resource"); } this.f13944f++; } @Override // s1.v public Class d() { return this.f13941c.d(); } v e() { return this.f13941c; } boolean f() { return this.f13939a; } void g() { boolean z10; synchronized (this) { int i10 = this.f13944f; if (i10 <= 0) { throw new IllegalStateException("Cannot release a recycled or not yet acquired resource"); } z10 = true; int i11 = i10 - 1; this.f13944f = i11; if (i11 != 0) { z10 = false; } } if (z10) { this.f13942d.a(this.f13943e, this); } } @Override // s1.v public Object get() { return this.f13941c.get(); } public synchronized String toString() { return "EngineResource{isMemoryCacheable=" + this.f13939a + ", listener=" + this.f13942d + ", key=" + this.f13943e + ", acquired=" + this.f13944f + ", isRecycled=" + this.f13945g + ", resource=" + this.f13941c + '}'; } }