575 lines
21 KiB
Java
575 lines
21 KiB
Java
package o;
|
|
|
|
import android.graphics.Rect;
|
|
import android.os.Bundle;
|
|
import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import android.view.accessibility.AccessibilityManager;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeProviderCompat;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import o.YCi;
|
|
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
|
|
import org.jmrtd.cbeff.ISO781611;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class JRd extends yZt {
|
|
private static final Rect a = new Rect(Integer.MAX_VALUE, Integer.MAX_VALUE, PKIFailureInfo.systemUnavail, PKIFailureInfo.systemUnavail);
|
|
private static final YCi.IeS<AccessibilityNodeInfoCompat> b = new YCi.IeS<AccessibilityNodeInfoCompat>() { // from class: o.JRd.5
|
|
@Override // o.YCi.IeS
|
|
public final /* synthetic */ void xl_(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat, Rect rect) {
|
|
accessibilityNodeInfoCompat.tV_(rect);
|
|
}
|
|
};
|
|
private static final YCi.LWm<VOL<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat> c = new YCi.LWm<VOL<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat>() { // from class: o.JRd.2
|
|
@Override // o.YCi.LWm
|
|
public final /* synthetic */ AccessibilityNodeInfoCompat c(VOL<AccessibilityNodeInfoCompat> vol, int i) {
|
|
return vol.b(i);
|
|
}
|
|
|
|
@Override // o.YCi.LWm
|
|
public final /* synthetic */ int d(VOL<AccessibilityNodeInfoCompat> vol) {
|
|
return vol.c();
|
|
}
|
|
};
|
|
private HBt f;
|
|
private final AccessibilityManager g;
|
|
private final View h;
|
|
private final Rect m = new Rect();
|
|
private final Rect l = new Rect();
|
|
private final Rect k = new Rect();
|
|
private final int[] j = new int[2];
|
|
public int d = PKIFailureInfo.systemUnavail;
|
|
public int e = PKIFailureInfo.systemUnavail;
|
|
private int i = PKIFailureInfo.systemUnavail;
|
|
|
|
protected abstract int a(float f, float f2);
|
|
|
|
protected void a(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
|
}
|
|
|
|
protected void c(int i, boolean z) {
|
|
}
|
|
|
|
protected abstract boolean d(int i, int i2);
|
|
|
|
protected abstract void e(int i, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat);
|
|
|
|
protected abstract void e(List<Integer> list);
|
|
|
|
public JRd(View view) {
|
|
if (view == null) {
|
|
throw new IllegalArgumentException("View may not be null");
|
|
}
|
|
this.h = view;
|
|
this.g = (AccessibilityManager) view.getContext().getSystemService("accessibility");
|
|
view.setFocusable(true);
|
|
if (ViewCompat.n(view) == 0) {
|
|
ViewCompat.g(view, 1);
|
|
}
|
|
}
|
|
|
|
@Override // o.yZt
|
|
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
|
|
if (this.f == null) {
|
|
this.f = new HBt(this);
|
|
}
|
|
return this.f;
|
|
}
|
|
|
|
public final boolean wY_(MotionEvent motionEvent) {
|
|
try {
|
|
if (!((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isEnabled", null).invoke(this.g, null)).booleanValue()) {
|
|
return false;
|
|
}
|
|
if (!((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.g, null)).booleanValue()) {
|
|
return false;
|
|
}
|
|
int action = motionEvent.getAction();
|
|
if (action == 7 || action == 9) {
|
|
int a2 = a(motionEvent.getX(), motionEvent.getY());
|
|
b(a2);
|
|
return a2 != Integer.MIN_VALUE;
|
|
}
|
|
if (action != 10 || this.i == Integer.MIN_VALUE) {
|
|
return false;
|
|
}
|
|
b(PKIFailureInfo.systemUnavail);
|
|
return true;
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause != null) {
|
|
throw cause;
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final boolean wZ_(KeyEvent keyEvent) {
|
|
int i = 0;
|
|
if (keyEvent.getAction() == 1) {
|
|
return false;
|
|
}
|
|
int keyCode = keyEvent.getKeyCode();
|
|
if (keyCode != 61) {
|
|
int i2 = 66;
|
|
if (keyCode != 66) {
|
|
switch (keyCode) {
|
|
case 19:
|
|
case 20:
|
|
case 21:
|
|
case 22:
|
|
if (!keyEvent.hasNoModifiers()) {
|
|
return false;
|
|
}
|
|
if (keyCode == 19) {
|
|
i2 = 33;
|
|
} else if (keyCode == 21) {
|
|
i2 = 17;
|
|
} else if (keyCode != 22) {
|
|
i2 = ISO781611.BIOMETRIC_SUBTYPE_TAG;
|
|
}
|
|
int repeatCount = keyEvent.getRepeatCount();
|
|
boolean z = false;
|
|
while (i < repeatCount + 1 && wX_(i2, null)) {
|
|
i++;
|
|
z = true;
|
|
}
|
|
return z;
|
|
case 23:
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
if (!keyEvent.hasNoModifiers() || keyEvent.getRepeatCount() != 0) {
|
|
return false;
|
|
}
|
|
int i3 = this.e;
|
|
if (i3 != Integer.MIN_VALUE) {
|
|
d(i3, 16);
|
|
}
|
|
return true;
|
|
}
|
|
if (keyEvent.hasNoModifiers()) {
|
|
return wX_(2, null);
|
|
}
|
|
if (keyEvent.hasModifiers(1)) {
|
|
return wX_(1, null);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void xa_(boolean z, int i, Rect rect) {
|
|
int i2 = this.e;
|
|
if (i2 != Integer.MIN_VALUE) {
|
|
this.e = PKIFailureInfo.systemUnavail;
|
|
c(i2, false);
|
|
c(i2, 8);
|
|
}
|
|
if (z) {
|
|
wX_(i, rect);
|
|
}
|
|
}
|
|
|
|
public final boolean c(int i, int i2) {
|
|
ViewParent parent;
|
|
if (i != Integer.MIN_VALUE) {
|
|
try {
|
|
if (!((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isEnabled", null).invoke(this.g, null)).booleanValue() || (parent = this.h.getParent()) == null) {
|
|
return false;
|
|
}
|
|
return parent.requestSendAccessibilityEvent(this.h, wW_(i, i2));
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause != null) {
|
|
throw cause;
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void b(int i) {
|
|
int i2 = this.i;
|
|
if (i2 == i) {
|
|
return;
|
|
}
|
|
this.i = i;
|
|
c(i, 128);
|
|
c(i2, 256);
|
|
}
|
|
|
|
@Override // o.yZt
|
|
public void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent) {
|
|
super.onInitializeAccessibilityEvent(view, accessibilityEvent);
|
|
}
|
|
|
|
final AccessibilityNodeInfoCompat c(int i) {
|
|
if (i == -1) {
|
|
return a();
|
|
}
|
|
return e(i);
|
|
}
|
|
|
|
private AccessibilityNodeInfoCompat a() {
|
|
AccessibilityNodeInfoCompat d = AccessibilityNodeInfoCompat.d(this.h);
|
|
ViewCompat.e(this.h, d);
|
|
ArrayList arrayList = new ArrayList();
|
|
e(arrayList);
|
|
if (d.a() > 0 && arrayList.size() > 0) {
|
|
throw new RuntimeException("Views cannot have both real and virtual children");
|
|
}
|
|
int size = arrayList.size();
|
|
for (int i = 0; i < size; i++) {
|
|
d.a(this.h, ((Integer) arrayList.get(i)).intValue());
|
|
}
|
|
return d;
|
|
}
|
|
|
|
@Override // o.yZt
|
|
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
|
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat);
|
|
a(accessibilityNodeInfoCompat);
|
|
}
|
|
|
|
private AccessibilityNodeInfoCompat e(int i) {
|
|
AccessibilityNodeInfoCompat b2 = AccessibilityNodeInfoCompat.b();
|
|
b2.g(true);
|
|
b2.f(true);
|
|
b2.e("android.view.View");
|
|
Rect rect = a;
|
|
b2.tZ_(rect);
|
|
b2.ua_(rect);
|
|
b2.b(this.h);
|
|
e(i, b2);
|
|
if (b2.i() == null && b2.j() == null) {
|
|
throw new RuntimeException("Callbacks must add text or a content description in populateNodeForVirtualViewId()");
|
|
}
|
|
b2.tV_(this.l);
|
|
if (this.l.equals(rect)) {
|
|
throw new RuntimeException("Callbacks must set parent bounds in populateNodeForVirtualViewId()");
|
|
}
|
|
int e = b2.e();
|
|
if ((e & 64) != 0) {
|
|
throw new RuntimeException("Callbacks must not add ACTION_ACCESSIBILITY_FOCUS in populateNodeForVirtualViewId()");
|
|
}
|
|
if ((e & 128) != 0) {
|
|
throw new RuntimeException("Callbacks must not add ACTION_CLEAR_ACCESSIBILITY_FOCUS in populateNodeForVirtualViewId()");
|
|
}
|
|
b2.f(this.h.getContext().getPackageName());
|
|
b2.c(this.h, i);
|
|
if (this.d == i) {
|
|
b2.e(true);
|
|
b2.d(128);
|
|
} else {
|
|
b2.e(false);
|
|
b2.d(64);
|
|
}
|
|
boolean z = this.e == i;
|
|
if (z) {
|
|
b2.d(2);
|
|
} else if (b2.r()) {
|
|
b2.d(1);
|
|
}
|
|
b2.j(z);
|
|
this.h.getLocationOnScreen(this.j);
|
|
b2.tW_(this.m);
|
|
if (this.m.equals(rect)) {
|
|
b2.tV_(this.m);
|
|
if (b2.a != -1) {
|
|
AccessibilityNodeInfoCompat b3 = AccessibilityNodeInfoCompat.b();
|
|
for (int i2 = b2.a; i2 != -1; i2 = b3.a) {
|
|
b3.b(this.h, -1);
|
|
b3.tZ_(a);
|
|
e(i2, b3);
|
|
b3.tV_(this.l);
|
|
this.m.offset(this.l.left, this.l.top);
|
|
}
|
|
b3.u();
|
|
}
|
|
this.m.offset(this.j[0] - this.h.getScrollX(), this.j[1] - this.h.getScrollY());
|
|
}
|
|
if (this.h.getLocalVisibleRect(this.k)) {
|
|
this.k.offset(this.j[0] - this.h.getScrollX(), this.j[1] - this.h.getScrollY());
|
|
if (this.m.intersect(this.k)) {
|
|
b2.ua_(this.m);
|
|
Rect rect2 = this.m;
|
|
if (rect2 != null && !rect2.isEmpty() && this.h.getWindowVisibility() == 0) {
|
|
Object parent = this.h.getParent();
|
|
while (true) {
|
|
if (parent instanceof View) {
|
|
View view = (View) parent;
|
|
if (view.getAlpha() <= BitmapDescriptorFactory.HUE_RED || view.getVisibility() != 0) {
|
|
break;
|
|
}
|
|
parent = view.getParent();
|
|
} else if (parent != null) {
|
|
b2.l(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return b2;
|
|
}
|
|
|
|
private boolean d(int i) {
|
|
if (this.d != i) {
|
|
return false;
|
|
}
|
|
this.d = PKIFailureInfo.systemUnavail;
|
|
this.h.invalidate();
|
|
c(i, 65536);
|
|
return true;
|
|
}
|
|
|
|
private boolean a(int i) {
|
|
int i2;
|
|
if ((!this.h.isFocused() && !this.h.requestFocus()) || (i2 = this.e) == i) {
|
|
return false;
|
|
}
|
|
if (i2 != Integer.MIN_VALUE) {
|
|
this.e = PKIFailureInfo.systemUnavail;
|
|
c(i2, false);
|
|
c(i2, 8);
|
|
}
|
|
if (i == Integer.MIN_VALUE) {
|
|
return false;
|
|
}
|
|
this.e = i;
|
|
c(i, true);
|
|
c(i, 8);
|
|
return true;
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
class HBt extends AccessibilityNodeProviderCompat {
|
|
final JRd b;
|
|
|
|
HBt(JRd jRd) {
|
|
this.b = jRd;
|
|
}
|
|
|
|
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
|
|
public final AccessibilityNodeInfoCompat b(int i) {
|
|
return AccessibilityNodeInfoCompat.b(this.b.c(i));
|
|
}
|
|
|
|
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
|
|
public final boolean xd_(int i, int i2, Bundle bundle) {
|
|
return this.b.xb_(i, i2, bundle);
|
|
}
|
|
|
|
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
|
|
public final AccessibilityNodeInfoCompat d(int i) {
|
|
int i2 = i == 2 ? this.b.d : this.b.e;
|
|
if (i2 == Integer.MIN_VALUE) {
|
|
return null;
|
|
}
|
|
return b(i2);
|
|
}
|
|
}
|
|
|
|
private AccessibilityEvent wW_(int i, int i2) {
|
|
AccessibilityNodeInfoCompat e;
|
|
if (i != -1) {
|
|
AccessibilityEvent obtain = AccessibilityEvent.obtain(i2);
|
|
if (i == -1) {
|
|
e = a();
|
|
} else {
|
|
e = e(i);
|
|
}
|
|
obtain.getText().add(e.i());
|
|
obtain.setContentDescription(e.j());
|
|
obtain.setScrollable(e.p());
|
|
obtain.setPassword(e.s());
|
|
obtain.setEnabled(e.k());
|
|
obtain.setChecked(e.o());
|
|
if (obtain.getText().isEmpty() && obtain.getContentDescription() == null) {
|
|
throw new RuntimeException("Callbacks must add text or a content description in populateEventForVirtualViewId()");
|
|
}
|
|
obtain.setClassName(e.c());
|
|
C15996kMa.uh_(obtain, this.h, i);
|
|
obtain.setPackageName(this.h.getContext().getPackageName());
|
|
return obtain;
|
|
}
|
|
AccessibilityEvent obtain2 = AccessibilityEvent.obtain(i2);
|
|
this.h.onInitializeAccessibilityEvent(obtain2);
|
|
return obtain2;
|
|
}
|
|
|
|
private boolean wX_(int i, Rect rect) {
|
|
Object obj;
|
|
AccessibilityNodeInfoCompat e;
|
|
ArrayList arrayList = new ArrayList();
|
|
e(arrayList);
|
|
VOL<AccessibilityNodeInfoCompat> vol = new VOL<>();
|
|
for (int i2 = 0; i2 < arrayList.size(); i2++) {
|
|
vol.a(arrayList.get(i2).intValue(), e(arrayList.get(i2).intValue()));
|
|
}
|
|
int i3 = this.e;
|
|
int i4 = PKIFailureInfo.systemUnavail;
|
|
AccessibilityNodeInfoCompat e2 = i3 == Integer.MIN_VALUE ? null : vol.e(i3);
|
|
if (i == 1 || i == 2) {
|
|
boolean z = ViewCompat.m(this.h) == 1;
|
|
YCi.LWm<VOL<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat> lWm = c;
|
|
YCi.IeS<AccessibilityNodeInfoCompat> ieS = b;
|
|
int d = lWm.d(vol);
|
|
ArrayList arrayList2 = new ArrayList(d);
|
|
for (int i5 = 0; i5 < d; i5++) {
|
|
arrayList2.add(lWm.c(vol, i5));
|
|
}
|
|
Collections.sort(arrayList2, new YCi.Sts(z, ieS));
|
|
if (i != 1) {
|
|
if (i != 2) {
|
|
throw new IllegalArgumentException("direction must be one of {FOCUS_FORWARD, FOCUS_BACKWARD}.");
|
|
}
|
|
int size = arrayList2.size();
|
|
int lastIndexOf = (e2 != null ? arrayList2.lastIndexOf(e2) : -1) + 1;
|
|
if (lastIndexOf < size) {
|
|
obj = arrayList2.get(lastIndexOf);
|
|
}
|
|
obj = null;
|
|
} else {
|
|
int size2 = arrayList2.size();
|
|
if (e2 != null) {
|
|
size2 = arrayList2.indexOf(e2);
|
|
}
|
|
int i6 = size2 - 1;
|
|
if (i6 >= 0) {
|
|
obj = arrayList2.get(i6);
|
|
}
|
|
obj = null;
|
|
}
|
|
} else if (i == 17 || i == 33 || i == 66 || i == 130) {
|
|
Rect rect2 = new Rect();
|
|
int i7 = this.e;
|
|
if (i7 != Integer.MIN_VALUE) {
|
|
if (i7 == -1) {
|
|
e = a();
|
|
} else {
|
|
e = e(i7);
|
|
}
|
|
e.tV_(rect2);
|
|
} else if (rect != null) {
|
|
rect2.set(rect);
|
|
} else {
|
|
View view = this.h;
|
|
int width = view.getWidth();
|
|
int height = view.getHeight();
|
|
if (i == 17) {
|
|
rect2.set(width, 0, width, height);
|
|
} else if (i == 33) {
|
|
rect2.set(0, height, width, height);
|
|
} else if (i == 66) {
|
|
rect2.set(-1, 0, -1, height);
|
|
} else if (i == 130) {
|
|
rect2.set(0, -1, width, -1);
|
|
} else {
|
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
|
}
|
|
}
|
|
YCi.LWm<VOL<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat> lWm2 = c;
|
|
YCi.IeS<AccessibilityNodeInfoCompat> ieS2 = b;
|
|
Rect rect3 = new Rect(rect2);
|
|
if (i == 17) {
|
|
rect3.offset(rect2.width() + 1, 0);
|
|
} else if (i == 33) {
|
|
rect3.offset(0, rect2.height() + 1);
|
|
} else if (i == 66) {
|
|
rect3.offset(-(rect2.width() + 1), 0);
|
|
} else if (i == 130) {
|
|
rect3.offset(0, -(rect2.height() + 1));
|
|
} else {
|
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
|
}
|
|
int d2 = lWm2.d(vol);
|
|
Rect rect4 = new Rect();
|
|
AccessibilityNodeInfoCompat accessibilityNodeInfoCompat = null;
|
|
for (int i8 = 0; i8 < d2; i8++) {
|
|
AccessibilityNodeInfoCompat c2 = lWm2.c(vol, i8);
|
|
if (c2 != e2) {
|
|
ieS2.xl_(c2, rect4);
|
|
if (YCi.xg_(rect2, rect4, i)) {
|
|
if (YCi.xg_(rect2, rect3, i) && !YCi.xe_(i, rect2, rect4, rect3)) {
|
|
if (!YCi.xe_(i, rect2, rect3, rect4)) {
|
|
int max = Math.max(0, YCi.xi_(i, rect2, rect4));
|
|
int xk_ = YCi.xk_(i, rect2, rect4);
|
|
int i9 = (max * 13 * max) + (xk_ * xk_);
|
|
int max2 = Math.max(0, YCi.xi_(i, rect2, rect3));
|
|
int xk_2 = YCi.xk_(i, rect2, rect3);
|
|
if (i9 >= (max2 * 13 * max2) + (xk_2 * xk_2)) {
|
|
}
|
|
}
|
|
}
|
|
rect3.set(rect4);
|
|
accessibilityNodeInfoCompat = c2;
|
|
}
|
|
}
|
|
}
|
|
obj = accessibilityNodeInfoCompat;
|
|
} else {
|
|
throw new IllegalArgumentException("direction must be one of {FOCUS_FORWARD, FOCUS_BACKWARD, FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
|
}
|
|
AccessibilityNodeInfoCompat accessibilityNodeInfoCompat2 = (AccessibilityNodeInfoCompat) obj;
|
|
if (accessibilityNodeInfoCompat2 != null) {
|
|
i4 = vol.a(vol.c(accessibilityNodeInfoCompat2));
|
|
}
|
|
return a(i4);
|
|
}
|
|
|
|
final boolean xb_(int i, int i2, Bundle bundle) {
|
|
int i3;
|
|
if (i == -1) {
|
|
return ViewCompat.sl_(this.h, i2, bundle);
|
|
}
|
|
if (i2 == 1) {
|
|
return a(i);
|
|
}
|
|
if (i2 == 2) {
|
|
if (this.e != i) {
|
|
return false;
|
|
}
|
|
this.e = PKIFailureInfo.systemUnavail;
|
|
c(i, false);
|
|
c(i, 8);
|
|
return true;
|
|
}
|
|
if (i2 != 64) {
|
|
if (i2 == 128) {
|
|
return d(i);
|
|
}
|
|
return d(i, i2);
|
|
}
|
|
try {
|
|
if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isEnabled", null).invoke(this.g, null)).booleanValue()) {
|
|
if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.g, null)).booleanValue() && (i3 = this.d) != i) {
|
|
if (i3 != Integer.MIN_VALUE) {
|
|
d(i3);
|
|
}
|
|
this.d = i;
|
|
this.h.invalidate();
|
|
c(i, 32768);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause != null) {
|
|
throw cause;
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
}
|