package com.kofax.mobile.sdk.k; import android.content.Context; import android.speech.tts.TextToSpeech; import android.view.accessibility.AccessibilityManager; import com.kofax.kmc.kut.utilities.error.IllegalArgumentException; import java.util.Locale; import o.InterfaceC13391fZD; @com.kofax.mobile.sdk._internal.dagger.a /* loaded from: classes3.dex */ public class m implements com.kofax.mobile.sdk._internal.capture.g { private AccessibilityManager GM; private TextToSpeech GN; private String GO; @InterfaceC13391fZD public m(Context context) { this.GN = null; this.GM = (AccessibilityManager) context.getSystemService("accessibility"); this.GN = new TextToSpeech(context, new TextToSpeech.OnInitListener(this) { // from class: com.kofax.mobile.sdk.k.m.1 final m GP; { this.GP = this; } @Override // android.speech.tts.TextToSpeech.OnInitListener public void onInit(int i) { if (i != -1) { try { this.GP.GN.setLanguage(Locale.US); } catch (IllegalArgumentException unused) { } } } }); } private void a(com.kofax.mobile.sdk._internal.dagger.d dVar) { this.GN.shutdown(); } private boolean ly() { try { if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isEnabled", null).invoke(this.GM, null)).booleanValue()) { if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.GM, null)).booleanValue()) { return true; } } return false; } catch (Throwable th) { Throwable cause = th.getCause(); if (cause != null) { throw cause; } throw th; } } private void lz() { TextToSpeech textToSpeech = this.GN; if (textToSpeech != null) { textToSpeech.stop(); } } private boolean ai(String str) { return ly() && !str.equals(this.GO); } @Override // com.kofax.mobile.sdk._internal.capture.g public void M(String str) { if (ai(str)) { lz(); this.GO = str; this.GN.speak(str, 0, null); } } }