package c.f.g.a.a.h.i; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import androidx.annotation.NonNull; import c.f.d.k.b; import c.f.g.a.a.h.f; import c.f.g.a.a.h.g; import c.f.g.a.a.h.h; import c.f.h.b.a.b; import com.facebook.common.internal.Supplier; import com.facebook.imagepipeline.image.ImageInfo; import java.util.Objects; /* compiled from: ImagePerfControllerListener2 */ public class a extends c.f.h.b.a.a { public final b a; public final h b; /* renamed from: c reason: collision with root package name */ public final g f381c; public final Supplier d; public final Supplier e; public Handler f; /* compiled from: ImagePerfControllerListener2 */ /* renamed from: c.f.g.a.a.h.i.a$a reason: collision with other inner class name */ public static class HandlerC0060a extends Handler { public final g a; public HandlerC0060a(@NonNull Looper looper, @NonNull g gVar) { super(looper); this.a = gVar; } @Override // android.os.Handler public void handleMessage(@NonNull Message message) { Object obj = message.obj; Objects.requireNonNull(obj); h hVar = (h) obj; int i = message.what; if (i == 1) { ((f) this.a).b(hVar, message.arg1); } else if (i == 2) { ((f) this.a).a(hVar, message.arg1); } } } public a(b bVar, h hVar, g gVar, Supplier supplier, Supplier supplier2) { this.a = bVar; this.b = hVar; this.f381c = gVar; this.d = supplier; this.e = supplier2; } @Override // c.f.h.b.a.b public void a(String str, Object obj, b.a aVar) { long now = this.a.now(); h e = e(); e.a(); e.i = now; e.a = str; e.d = obj; e.A = aVar; g(e, 0); e.w = 1; e.f378x = now; h(e, 1); } @Override // c.f.h.b.a.b public void b(String str, Throwable th, b.a aVar) { long now = this.a.now(); h e = e(); e.A = aVar; e.l = now; e.a = str; e.u = th; g(e, 5); e.w = 2; e.f379y = now; h(e, 2); } @Override // c.f.h.b.a.b public void c(String str, b.a aVar) { long now = this.a.now(); h e = e(); e.A = aVar; e.a = str; int i = e.v; if (!(i == 3 || i == 5 || i == 6)) { e.m = now; g(e, 4); } e.w = 2; e.f379y = now; h(e, 2); } @Override // c.f.h.b.a.b public void d(String str, Object obj, b.a aVar) { long now = this.a.now(); h e = e(); e.A = aVar; e.k = now; e.o = now; e.a = str; e.e = (ImageInfo) obj; g(e, 3); } public final h e() { return Boolean.FALSE.booleanValue() ? new h() : this.b; } public final boolean f() { boolean booleanValue = this.d.get().booleanValue(); if (booleanValue && this.f == null) { synchronized (this) { if (this.f == null) { HandlerThread handlerThread = new HandlerThread("ImagePerfControllerListener2Thread"); handlerThread.start(); Looper looper = handlerThread.getLooper(); Objects.requireNonNull(looper); this.f = new HandlerC0060a(looper, this.f381c); } } } return booleanValue; } public final void g(h hVar, int i) { if (f()) { Handler handler = this.f; Objects.requireNonNull(handler); Message obtainMessage = handler.obtainMessage(); obtainMessage.what = 1; obtainMessage.arg1 = i; obtainMessage.obj = hVar; this.f.sendMessage(obtainMessage); return; } ((f) this.f381c).b(hVar, i); } public final void h(h hVar, int i) { if (f()) { Handler handler = this.f; Objects.requireNonNull(handler); Message obtainMessage = handler.obtainMessage(); obtainMessage.what = 2; obtainMessage.arg1 = i; obtainMessage.obj = hVar; this.f.sendMessage(obtainMessage); return; } ((f) this.f381c).a(hVar, i); } }