Rabbit-R1/android (non root)/java/sources/androidx/compose/ui/focus/FocusTargetNode.java
2024-05-21 17:08:36 -04:00

416 lines
24 KiB
Java

package androidx.compose.ui.focus;
import androidx.compose.runtime.collection.MutableVector;
import androidx.compose.ui.Modifier;
import androidx.compose.ui.layout.BeyondBoundsLayout;
import androidx.compose.ui.modifier.ModifierLocalModifierNode;
import androidx.compose.ui.node.DelegatableNodeKt;
import androidx.compose.ui.node.DelegatingNode;
import androidx.compose.ui.node.LayoutNode;
import androidx.compose.ui.node.ModifierNodeElement;
import androidx.compose.ui.node.NodeChain;
import androidx.compose.ui.node.NodeKind;
import androidx.compose.ui.node.ObserverModifierNode;
import androidx.compose.ui.node.ObserverModifierNodeKt;
import androidx.compose.ui.platform.InspectorInfo;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
/* compiled from: FocusTargetNode.kt */
@Metadata(d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\t\b\u0000\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004:\u0001(B\u0005¢\u0006\u0002\u0010\u0005J5\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0012\u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00020\u001a\u0012\u0004\u0012\u00020\u00150\u0019H\u0080\\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0004\b\u001b\u0010\u001cJ5\u0010\u001d\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0012\u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00020\u001a\u0012\u0004\u0012\u00020\u00150\u0019H\u0080\\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0004\b\u001e\u0010\u001cJ\r\u0010\u001f\u001a\u00020 H\u0000¢\u0006\u0002\b!J\r\u0010\"\u001a\u00020\u0015H\u0000¢\u0006\u0002\b#J\b\u0010$\u001a\u00020\u0015H\u0016J\b\u0010%\u001a\u00020\u0015H\u0016J\r\u0010&\u001a\u00020\u0015H\u0000¢\u0006\u0002\b'R\u0013\u0010\u0006\u001a\u0004\u0018\u00010\u00078F¢\u0006\u0006\u001a\u0004\b\b\u0010\tR \u0010\n\u001a\u00020\u000bX\u0096\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\f\u0010\u0005\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0012X\u0082\u000e¢\u0006\u0002\n\u0000\u0082\u0002\u0012\n\u0005\b\u009920\u0001\n\u0005\\u001e0\u0001\n\u0002\b\u0019¨\u0006)"}, d2 = {"Landroidx/compose/ui/focus/FocusTargetNode;", "Landroidx/compose/ui/focus/FocusTargetModifierNode;", "Landroidx/compose/ui/node/ObserverModifierNode;", "Landroidx/compose/ui/modifier/ModifierLocalModifierNode;", "Landroidx/compose/ui/Modifier$Node;", "()V", "beyondBoundsLayoutParent", "Landroidx/compose/ui/layout/BeyondBoundsLayout;", "getBeyondBoundsLayoutParent", "()Landroidx/compose/ui/layout/BeyondBoundsLayout;", "focusState", "Landroidx/compose/ui/focus/FocusStateImpl;", "getFocusState$annotations", "getFocusState", "()Landroidx/compose/ui/focus/FocusStateImpl;", "setFocusState", "(Landroidx/compose/ui/focus/FocusStateImpl;)V", "isProcessingCustomEnter", "", "isProcessingCustomExit", "fetchCustomEnter", "", "focusDirection", "Landroidx/compose/ui/focus/FocusDirection;", "block", "Lkotlin/Function1;", "Landroidx/compose/ui/focus/FocusRequester;", "fetchCustomEnter-aToIllA$ui_release", "(ILkotlin/jvm/functions/Function1;)V", "fetchCustomExit", "fetchCustomExit-aToIllA$ui_release", "fetchFocusProperties", "Landroidx/compose/ui/focus/FocusProperties;", "fetchFocusProperties$ui_release", "invalidateFocus", "invalidateFocus$ui_release", "onObservedReadsChanged", "onReset", "scheduleInvalidationForFocusEvents", "scheduleInvalidationForFocusEvents$ui_release", "FocusTargetElement", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class FocusTargetNode extends Modifier.Node implements FocusTargetModifierNode, ObserverModifierNode, ModifierLocalModifierNode {
private FocusStateImpl focusState = FocusStateImpl.Inactive;
private boolean isProcessingCustomEnter;
private boolean isProcessingCustomExit;
/* compiled from: FocusTargetNode.kt */
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[FocusStateImpl.values().length];
try {
iArr[FocusStateImpl.Active.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[FocusStateImpl.Captured.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[FocusStateImpl.ActiveParent.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[FocusStateImpl.Inactive.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public static /* synthetic */ void getFocusState$annotations() {
}
@Override // androidx.compose.ui.focus.FocusTargetModifierNode
public FocusStateImpl getFocusState() {
return this.focusState;
}
public void setFocusState(FocusStateImpl focusStateImpl) {
Intrinsics.checkNotNullParameter(focusStateImpl, "<set-?>");
this.focusState = focusStateImpl;
}
public final BeyondBoundsLayout getBeyondBoundsLayoutParent() {
return (BeyondBoundsLayout) getCurrent(androidx.compose.ui.layout.BeyondBoundsLayoutKt.getModifierLocalBeyondBoundsLayout());
}
@Override // androidx.compose.ui.node.ObserverModifierNode
public void onObservedReadsChanged() {
FocusStateImpl focusState = getFocusState();
invalidateFocus$ui_release();
if (focusState != getFocusState()) {
FocusEventModifierNodeKt.refreshFocusEventNodes(this);
}
}
@Override // androidx.compose.ui.Modifier.Node
public void onReset() {
int i = WhenMappings.$EnumSwitchMapping$0[getFocusState().ordinal()];
if (i == 1 || i == 2) {
DelegatableNodeKt.requireOwner(this).getFocusOwner().clearFocus(true);
return;
}
if (i == 3) {
scheduleInvalidationForFocusEvents$ui_release();
setFocusState(FocusStateImpl.Inactive);
} else {
if (i != 4) {
return;
}
scheduleInvalidationForFocusEvents$ui_release();
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r6v11 */
/* JADX WARN: Type inference failed for: r6v12, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r6v13, types: [java.lang.Object] */
/* JADX WARN: Type inference failed for: r6v14 */
/* JADX WARN: Type inference failed for: r6v15 */
/* JADX WARN: Type inference failed for: r6v16 */
/* JADX WARN: Type inference failed for: r6v17 */
/* JADX WARN: Type inference failed for: r6v20 */
/* JADX WARN: Type inference failed for: r6v21 */
/* JADX WARN: Type inference failed for: r6v8 */
/* JADX WARN: Type inference failed for: r6v9, types: [androidx.compose.ui.Modifier$Node] */
public final FocusProperties fetchFocusProperties$ui_release() {
NodeChain nodes;
FocusPropertiesImpl focusPropertiesImpl = new FocusPropertiesImpl();
FocusTargetNode focusTargetNode = this;
int m4091constructorimpl = NodeKind.m4091constructorimpl(2048);
int m4091constructorimpl2 = NodeKind.m4091constructorimpl(1024);
Modifier.Node node = focusTargetNode.getNode();
int i = m4091constructorimpl | m4091constructorimpl2;
if (!focusTargetNode.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node node2 = focusTargetNode.getNode();
LayoutNode requireLayoutNode = DelegatableNodeKt.requireLayoutNode(focusTargetNode);
loop0: while (requireLayoutNode != null) {
if ((requireLayoutNode.getNodes().getHead().getAggregateChildKindSet() & i) != 0) {
while (node2 != null) {
if ((node2.getKindSet() & i) != 0) {
if (node2 != node && (node2.getKindSet() & m4091constructorimpl2) != 0) {
break loop0;
}
if ((node2.getKindSet() & m4091constructorimpl) != 0) {
DelegatingNode delegatingNode = node2;
MutableVector mutableVector = null;
while (delegatingNode != 0) {
if (delegatingNode instanceof FocusPropertiesModifierNode) {
((FocusPropertiesModifierNode) delegatingNode).applyFocusProperties(focusPropertiesImpl);
} else if ((delegatingNode.getKindSet() & m4091constructorimpl) != 0 && (delegatingNode instanceof DelegatingNode)) {
Modifier.Node delegate = delegatingNode.getDelegate();
int i2 = 0;
delegatingNode = delegatingNode;
while (delegate != null) {
if ((delegate.getKindSet() & m4091constructorimpl) != 0) {
i2++;
if (i2 == 1) {
delegatingNode = delegate;
} else {
if (mutableVector == null) {
mutableVector = new MutableVector(new Modifier.Node[16], 0);
}
if (delegatingNode != 0) {
if (mutableVector != null) {
mutableVector.add(delegatingNode);
}
delegatingNode = 0;
}
if (mutableVector != null) {
mutableVector.add(delegate);
}
}
}
delegate = delegate.getChild();
delegatingNode = delegatingNode;
}
if (i2 == 1) {
}
}
delegatingNode = DelegatableNodeKt.pop(mutableVector);
}
}
}
node2 = node2.getParent();
}
}
requireLayoutNode = requireLayoutNode.getParent$ui_release();
node2 = (requireLayoutNode == null || (nodes = requireLayoutNode.getNodes()) == null) ? null : nodes.getTail();
}
return focusPropertiesImpl;
}
/* renamed from: fetchCustomEnter-aToIllA$ui_release, reason: not valid java name */
public final void m2346fetchCustomEnteraToIllA$ui_release(int focusDirection, Function1<? super FocusRequester, Unit> block) {
Intrinsics.checkNotNullParameter(block, "block");
if (this.isProcessingCustomEnter) {
return;
}
this.isProcessingCustomEnter = true;
try {
FocusRequester invoke = fetchFocusProperties$ui_release().getEnter().invoke(FocusDirection.m2316boximpl(focusDirection));
if (invoke != FocusRequester.INSTANCE.getDefault()) {
block.invoke(invoke);
}
} finally {
InlineMarker.finallyStart(1);
this.isProcessingCustomEnter = false;
InlineMarker.finallyEnd(1);
}
}
/* renamed from: fetchCustomExit-aToIllA$ui_release, reason: not valid java name */
public final void m2347fetchCustomExitaToIllA$ui_release(int focusDirection, Function1<? super FocusRequester, Unit> block) {
Intrinsics.checkNotNullParameter(block, "block");
if (this.isProcessingCustomExit) {
return;
}
this.isProcessingCustomExit = true;
try {
FocusRequester invoke = fetchFocusProperties$ui_release().getExit().invoke(FocusDirection.m2316boximpl(focusDirection));
if (invoke != FocusRequester.INSTANCE.getDefault()) {
block.invoke(invoke);
}
} finally {
InlineMarker.finallyStart(1);
this.isProcessingCustomExit = false;
InlineMarker.finallyEnd(1);
}
}
public final void invalidateFocus$ui_release() {
FocusProperties focusProperties;
int i = WhenMappings.$EnumSwitchMapping$0[getFocusState().ordinal()];
if (i == 1 || i == 2) {
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
ObserverModifierNodeKt.observeReads(this, new Function0<Unit>() { // from class: androidx.compose.ui.focus.FocusTargetNode$invalidateFocus$1
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public /* bridge */ /* synthetic */ Unit invoke() {
invoke2();
return Unit.INSTANCE;
}
/* JADX WARN: Type inference failed for: r1v2, types: [androidx.compose.ui.focus.FocusProperties, T] */
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2() {
objectRef.element = this.fetchFocusProperties$ui_release();
}
});
if (objectRef.element == 0) {
Intrinsics.throwUninitializedPropertyAccessException("focusProperties");
focusProperties = null;
} else {
focusProperties = (FocusProperties) objectRef.element;
}
if (focusProperties.getCanFocus()) {
return;
}
DelegatableNodeKt.requireOwner(this).getFocusOwner().clearFocus(true);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v0, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r0v1, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r0v10 */
/* JADX WARN: Type inference failed for: r0v11 */
/* JADX WARN: Type inference failed for: r0v12 */
/* JADX WARN: Type inference failed for: r0v13 */
/* JADX WARN: Type inference failed for: r0v14 */
/* JADX WARN: Type inference failed for: r0v15 */
/* JADX WARN: Type inference failed for: r0v7 */
/* JADX WARN: Type inference failed for: r0v8, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r0v9, types: [java.lang.Object] */
/* JADX WARN: Type inference failed for: r9v1 */
/* JADX WARN: Type inference failed for: r9v10 */
/* JADX WARN: Type inference failed for: r9v15 */
/* JADX WARN: Type inference failed for: r9v16 */
/* JADX WARN: Type inference failed for: r9v2, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r9v4 */
/* JADX WARN: Type inference failed for: r9v5, types: [androidx.compose.ui.Modifier$Node] */
/* JADX WARN: Type inference failed for: r9v6, types: [java.lang.Object] */
/* JADX WARN: Type inference failed for: r9v7 */
/* JADX WARN: Type inference failed for: r9v8 */
/* JADX WARN: Type inference failed for: r9v9 */
public final void scheduleInvalidationForFocusEvents$ui_release() {
NodeChain nodes;
DelegatingNode node = getNode();
int m4091constructorimpl = NodeKind.m4091constructorimpl(4096);
MutableVector mutableVector = null;
while (node != 0) {
if (node instanceof FocusEventModifierNode) {
FocusEventModifierNodeKt.invalidateFocusEvent((FocusEventModifierNode) node);
} else if ((node.getKindSet() & m4091constructorimpl) != 0 && (node instanceof DelegatingNode)) {
Modifier.Node delegate = node.getDelegate();
int i = 0;
node = node;
while (delegate != null) {
if ((delegate.getKindSet() & m4091constructorimpl) != 0) {
i++;
if (i == 1) {
node = delegate;
} else {
if (mutableVector == null) {
mutableVector = new MutableVector(new Modifier.Node[16], 0);
}
if (node != 0) {
if (mutableVector != null) {
mutableVector.add(node);
}
node = 0;
}
if (mutableVector != null) {
mutableVector.add(delegate);
}
}
}
delegate = delegate.getChild();
node = node;
}
if (i == 1) {
}
}
node = DelegatableNodeKt.pop(mutableVector);
}
FocusTargetNode focusTargetNode = this;
int m4091constructorimpl2 = NodeKind.m4091constructorimpl(4096) | NodeKind.m4091constructorimpl(1024);
if (!focusTargetNode.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node parent = focusTargetNode.getNode().getParent();
LayoutNode requireLayoutNode = DelegatableNodeKt.requireLayoutNode(focusTargetNode);
while (requireLayoutNode != null) {
if ((requireLayoutNode.getNodes().getHead().getAggregateChildKindSet() & m4091constructorimpl2) != 0) {
while (parent != null) {
if ((parent.getKindSet() & m4091constructorimpl2) != 0 && (NodeKind.m4091constructorimpl(1024) & parent.getKindSet()) == 0 && parent.getIsAttached()) {
int m4091constructorimpl3 = NodeKind.m4091constructorimpl(4096);
MutableVector mutableVector2 = null;
DelegatingNode delegatingNode = parent;
while (delegatingNode != 0) {
if (delegatingNode instanceof FocusEventModifierNode) {
FocusEventModifierNodeKt.invalidateFocusEvent((FocusEventModifierNode) delegatingNode);
} else if ((delegatingNode.getKindSet() & m4091constructorimpl3) != 0 && (delegatingNode instanceof DelegatingNode)) {
Modifier.Node delegate2 = delegatingNode.getDelegate();
int i2 = 0;
delegatingNode = delegatingNode;
while (delegate2 != null) {
if ((delegate2.getKindSet() & m4091constructorimpl3) != 0) {
i2++;
if (i2 == 1) {
delegatingNode = delegate2;
} else {
if (mutableVector2 == null) {
mutableVector2 = new MutableVector(new Modifier.Node[16], 0);
}
if (delegatingNode != 0) {
if (mutableVector2 != null) {
mutableVector2.add(delegatingNode);
}
delegatingNode = 0;
}
if (mutableVector2 != null) {
mutableVector2.add(delegate2);
}
}
}
delegate2 = delegate2.getChild();
delegatingNode = delegatingNode;
}
if (i2 == 1) {
}
}
delegatingNode = DelegatableNodeKt.pop(mutableVector2);
}
}
parent = parent.getParent();
}
}
requireLayoutNode = requireLayoutNode.getParent$ui_release();
parent = (requireLayoutNode == null || (nodes = requireLayoutNode.getNodes()) == null) ? null : nodes.getTail();
}
}
/* compiled from: FocusTargetNode.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\b\u0010\u0004\u001a\u00020\u0002H\u0016J\u0013\u0010\u0005\u001a\u00020\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0096\u0002J\b\u0010\t\u001a\u00020\nH\u0016J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u0002H\u0016J\f\u0010\u000e\u001a\u00020\f*\u00020\u000fH\u0016¨\u0006\u0010"}, d2 = {"Landroidx/compose/ui/focus/FocusTargetNode$FocusTargetElement;", "Landroidx/compose/ui/node/ModifierNodeElement;", "Landroidx/compose/ui/focus/FocusTargetNode;", "()V", "create", "equals", "", "other", "", "hashCode", "", "update", "", "node", "inspectableProperties", "Landroidx/compose/ui/platform/InspectorInfo;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public static final class FocusTargetElement extends ModifierNodeElement<FocusTargetNode> {
public static final FocusTargetElement INSTANCE = new FocusTargetElement();
@Override // androidx.compose.ui.node.ModifierNodeElement
public boolean equals(Object other) {
return other == this;
}
@Override // androidx.compose.ui.node.ModifierNodeElement
public int hashCode() {
return 1739042953;
}
@Override // androidx.compose.ui.node.ModifierNodeElement
public void update(FocusTargetNode node) {
Intrinsics.checkNotNullParameter(node, "node");
}
private FocusTargetElement() {
}
@Override // androidx.compose.ui.node.ModifierNodeElement
public FocusTargetNode create() {
return new FocusTargetNode();
}
@Override // androidx.compose.ui.node.ModifierNodeElement
public void inspectableProperties(InspectorInfo inspectorInfo) {
Intrinsics.checkNotNullParameter(inspectorInfo, "<this>");
inspectorInfo.setName("focusTarget");
}
}
}