You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
7.5 KiB

package p029j0;
import android.content.ClipData;
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.util.Log;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import android.view.inputmethod.InputContentInfo;
import p020g0.C0734d;
import p020g0.C0737f;
import p023h0.C0784c;
import p023h0.C0829h1;
/* renamed from: j0.f */
/* loaded from: classes.dex */
public final class C1256f {
/* renamed from: j0.f$a */
/* loaded from: classes.dex */
public class C1257a extends InputConnectionWrapper {
/* renamed from: a */
public final /* synthetic */ InterfaceC1259c f2949a;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public C1257a(InputConnection inputConnection, boolean z, InterfaceC1259c interfaceC1259c) {
super(inputConnection, z);
this.f2949a = interfaceC1259c;
}
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
public boolean commitContent(InputContentInfo inputContentInfo, int i, Bundle bundle) {
if (this.f2949a.mo1765a(C1264k.m1755f(inputContentInfo), i, bundle)) {
return true;
}
return super.commitContent(inputContentInfo, i, bundle);
}
}
/* renamed from: j0.f$b */
/* loaded from: classes.dex */
public class C1258b extends InputConnectionWrapper {
/* renamed from: a */
public final /* synthetic */ InterfaceC1259c f2950a;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public C1258b(InputConnection inputConnection, boolean z, InterfaceC1259c interfaceC1259c) {
super(inputConnection, z);
this.f2950a = interfaceC1259c;
}
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
public boolean performPrivateCommand(String str, Bundle bundle) {
if (C1256f.m1767e(str, bundle, this.f2950a)) {
return true;
}
return super.performPrivateCommand(str, bundle);
}
}
/* renamed from: j0.f$c */
/* loaded from: classes.dex */
public interface InterfaceC1259c {
/* renamed from: a */
boolean mo1765a(C1264k c1264k, int i, Bundle bundle);
}
/* renamed from: b */
public static InterfaceC1259c m1770b(final View view) {
C0737f.m3033f(view);
return new InterfaceC1259c() { // from class: j0.e
@Override // p029j0.C1256f.InterfaceC1259c
/* renamed from: a */
public final boolean mo1765a(C1264k c1264k, int i, Bundle bundle) {
boolean m1766f;
m1766f = C1256f.m1766f(view, c1264k, i, bundle);
return m1766f;
}
};
}
/* renamed from: c */
public static InputConnection m1769c(View view, InputConnection inputConnection, EditorInfo editorInfo) {
return m1768d(inputConnection, editorInfo, m1770b(view));
}
@Deprecated
/* renamed from: d */
public static InputConnection m1768d(InputConnection inputConnection, EditorInfo editorInfo, InterfaceC1259c interfaceC1259c) {
C0734d.m3041c(inputConnection, "inputConnection must be non-null");
C0734d.m3041c(editorInfo, "editorInfo must be non-null");
C0734d.m3041c(interfaceC1259c, "onCommitContentListener must be non-null");
return Build.VERSION.SDK_INT >= 25 ? new C1257a(inputConnection, false, interfaceC1259c) : C1253d.m1780a(editorInfo).length == 0 ? inputConnection : new C1258b(inputConnection, false, interfaceC1259c);
}
/* 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 */
/* renamed from: e */
public static boolean m1767e(String str, Bundle bundle, InterfaceC1259c interfaceC1259c) {
boolean z;
ResultReceiver resultReceiver;
?? r0 = 0;
r0 = 0;
if (bundle == null) {
return false;
}
if (TextUtils.equals("androidx.core.view.inputmethod.InputConnectionCompat.COMMIT_CONTENT", str)) {
z = false;
} else if (!TextUtils.equals("android.support.v13.view.inputmethod.InputConnectionCompat.COMMIT_CONTENT", str)) {
return false;
} else {
z = true;
}
try {
resultReceiver = (ResultReceiver) bundle.getParcelable(z ? "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(z ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_URI" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_URI");
ClipDescription clipDescription = (ClipDescription) bundle.getParcelable(z ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_DESCRIPTION" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_DESCRIPTION");
Uri uri2 = (Uri) bundle.getParcelable(z ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_LINK_URI" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_LINK_URI");
int i = bundle.getInt(z ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_FLAGS" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_FLAGS");
Bundle bundle2 = (Bundle) bundle.getParcelable(z ? "android.support.v13.view.inputmethod.InputConnectionCompat.CONTENT_OPTS" : "androidx.core.view.inputmethod.InputConnectionCompat.CONTENT_OPTS");
if (uri != null && clipDescription != null) {
r0 = interfaceC1259c.mo1765a(new C1264k(uri, clipDescription, uri2), i, bundle2);
}
if (resultReceiver != 0) {
resultReceiver.send(r0, null);
}
return r0;
} catch (Throwable th2) {
th = th2;
if (resultReceiver != 0) {
resultReceiver.send(0, null);
}
throw th;
}
}
/* renamed from: f */
public static /* synthetic */ boolean m1766f(View view, C1264k c1264k, int i, Bundle bundle) {
if (Build.VERSION.SDK_INT >= 25 && (i & 1) != 0) {
try {
c1264k.m1757d();
InputContentInfo inputContentInfo = (InputContentInfo) c1264k.m1756e();
bundle = bundle == null ? new Bundle() : new Bundle(bundle);
bundle.putParcelable("androidx.core.view.extra.INPUT_CONTENT_INFO", inputContentInfo);
} catch (Exception e) {
Log.w("InputConnectionCompat", "Can't insert content from IME; requestPermission() failed", e);
return false;
}
}
return C0829h1.m2855H(view, new C0784c.C0785a(new ClipData(c1264k.m1759b(), new ClipData.Item(c1264k.m1760a())), 2).m2915d(c1264k.m1758c()).m2917b(bundle).m2918a()) == null;
}
}