package o; import android.hardware.Camera; import android.os.Handler; import android.os.Message; import java.util.ArrayList; import java.util.Collection; import o.OVZ; /* loaded from: classes3.dex */ public final class OVZ { private static final Collection e; private final Handler.Callback a; private final Camera.AutoFocusCallback b; private int c = 1; private final Camera d; private boolean f; private final boolean g; private Handler h; private boolean i; /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ boolean b(OVZ ovz) { ovz.f = false; return false; } static { ArrayList arrayList = new ArrayList(2); e = arrayList; arrayList.add("auto"); arrayList.add("macro"); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.OVZ$3, reason: invalid class name */ /* loaded from: classes3.dex */ public final class AnonymousClass3 implements Camera.AutoFocusCallback { final OVZ d; AnonymousClass3(OVZ ovz) { this.d = ovz; } @Override // android.hardware.Camera.AutoFocusCallback public final void onAutoFocus(boolean z, Camera camera) { this.d.h.post(new Runnable(this) { // from class: o.nyj private OVZ.AnonymousClass3 a; @Override // java.lang.Runnable public final void run() { OVZ.AnonymousClass3 anonymousClass3 = this.a; OVZ.b(anonymousClass3.d); anonymousClass3.d.e(); } { this.a = this; } }); } } public OVZ(Camera camera, Xad xad) { Handler.Callback callback = new Handler.Callback(this) { // from class: o.OVZ.5 private OVZ b; { this.b = this; } @Override // android.os.Handler.Callback public final boolean handleMessage(Message message) { if (message.what != this.b.c) { return false; } this.b.d(); return true; } }; this.a = callback; this.b = new AnonymousClass3(this); this.h = new Handler(callback); this.d = camera; this.g = xad.b && e.contains(camera.getParameters().getFocusMode()); this.i = false; d(); } /* JADX INFO: Access modifiers changed from: private */ public void e() { synchronized (this) { if (!this.i && !this.h.hasMessages(this.c)) { Handler handler = this.h; handler.sendMessageDelayed(handler.obtainMessage(this.c), 2000L); } } } public final void b() { this.i = false; d(); } /* JADX INFO: Access modifiers changed from: private */ public void d() { if (!this.g || this.i || this.f) { return; } try { this.d.autoFocus(this.b); this.f = true; } catch (RuntimeException unused) { e(); } } public final void c() { this.i = true; this.f = false; this.h.removeMessages(this.c); if (this.g) { try { this.d.cancelAutoFocus(); } catch (RuntimeException unused) { } } } }