package a0; import android.content.ClipDescription; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.ResultReceiver; import android.text.TextUtils; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputContentInfo; /* loaded from: classes.dex */ public abstract class d { class a extends InputConnectionWrapper { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ c f4a; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ a(InputConnection inputConnection, boolean z10, c cVar) { super(inputConnection, z10); this.f4a = cVar; } @Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection public boolean commitContent(InputContentInfo inputContentInfo, int i10, Bundle bundle) { if (this.f4a.a(e.f(inputContentInfo), i10, bundle)) { return true; } return super.commitContent(inputContentInfo, i10, bundle); } } class b extends InputConnectionWrapper { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ c f5a; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ b(InputConnection inputConnection, boolean z10, c cVar) { super(inputConnection, z10); this.f5a = cVar; } @Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection public boolean performPrivateCommand(String str, Bundle bundle) { if (d.b(str, bundle, this.f5a)) { return true; } return super.performPrivateCommand(str, bundle); } } public interface c { boolean a(e eVar, int i10, Bundle bundle); } public static InputConnection a(InputConnection inputConnection, EditorInfo editorInfo, c cVar) { y.c.c(inputConnection, "inputConnection must be non-null"); y.c.c(editorInfo, "editorInfo must be non-null"); y.c.c(cVar, "onCommitContentListener must be non-null"); return Build.VERSION.SDK_INT >= 25 ? new a(inputConnection, false, cVar) : a0.c.a(editorInfo).length == 0 ? inputConnection : new b(inputConnection, false, cVar); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r0v0 */ /* JADX WARN: Type inference failed for: r0v3, types: [boolean, int] */ /* JADX WARN: Type inference failed for: r0v5 */ /* JADX WARN: Type inference failed for: r0v6 */ static boolean b(String str, Bundle bundle, c cVar) { boolean z10; ResultReceiver resultReceiver; ?? r02 = 0; r02 = 0; if (bundle == null) { return false; } if (TextUtils.equals("androidx.core.view.inputmethod.InputConnectionCompat.COMMIT_CONTENT", str)) { z10 = false; } else { if (!TextUtils.equals("android.support.v13.view.inputmethod.InputConnectionCompat.COMMIT_CONTENT", str)) { return false; } z10 = true; } try { resultReceiver = (ResultReceiver) bundle.getParcelable(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_RESULT_RECEIVER" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_RESULT_RECEIVER"); } catch (Throwable th) { th = th; resultReceiver = 0; } try { Uri uri = (Uri) bundle.getParcelable(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_URI" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_URI"); ClipDescription clipDescription = (ClipDescription) bundle.getParcelable(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_DESCRIPTION" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_DESCRIPTION"); Uri uri2 = (Uri) bundle.getParcelable(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_LINK_URI" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_LINK_URI"); int i10 = bundle.getInt(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_FLAGS" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_FLAGS"); Bundle bundle2 = (Bundle) bundle.getParcelable(z10 ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_OPTS" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_OPTS"); if (uri != null && clipDescription != null) { r02 = cVar.a(new e(uri, clipDescription, uri2), i10, bundle2); } if (resultReceiver != 0) { resultReceiver.send(r02, null); } return r02; } catch (Throwable th2) { th = th2; if (resultReceiver != 0) { resultReceiver.send(0, null); } throw th; } } }