Primer paso de la investigacion. Se aportan el .apk, las carpetas con el apk extraido y el apk descompilado. El archivo API_DOCUMENTATION.md es un archivo donde se anotaran los descubrimientos del funcionamiento de la API, y los .py son scripts para probar la funcionalidad de la API con los métodos que vayamos encontrando. Finalmente, los archivos .js son scripts de Frida para extraer informacion de la APP durante la ejecucion.
This commit is contained in:
378
apk_decompiled/sources/kotlin/io/FileTreeWalk.java
Normal file
378
apk_decompiled/sources/kotlin/io/FileTreeWalk.java
Normal file
@@ -0,0 +1,378 @@
|
||||
package kotlin.io;
|
||||
|
||||
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
||||
import com.google.firebase.remoteconfig.RemoteConfigConstants;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Iterator;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.NoWhenBranchMatchedException;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.AbstractIterator;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.jvm.internal.SourceDebugExtension;
|
||||
import kotlin.sequences.Sequence;
|
||||
|
||||
@Metadata(d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010(\n\u0002\b\u0006\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0003\u001a\u001b\u001cB\u0019\b\u0010\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006B\u0089\u0001\b\u0002\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\u0014\u0010\u0007\u001a\u0010\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\t\u0018\u00010\b\u0012\u0014\u0010\n\u001a\u0010\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u000b\u0018\u00010\b\u00128\u0010\f\u001a4\u0012\u0013\u0012\u00110\u0002¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0013\u0012\u00110\u0011¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0012\u0012\u0004\u0012\u00020\u000b\u0018\u00010\r\u0012\b\b\u0002\u0010\u0013\u001a\u00020\u0014¢\u0006\u0002\u0010\u0015J\u000f\u0010\u0016\u001a\b\u0012\u0004\u0012\u00020\u00020\u0017H\u0096\u0002J\u000e\u0010\u0013\u001a\u00020\u00002\u0006\u0010\u0018\u001a\u00020\u0014J\u001a\u0010\u0007\u001a\u00020\u00002\u0012\u0010\u0019\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\t0\bJ \u0010\f\u001a\u00020\u00002\u0018\u0010\u0019\u001a\u0014\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u0011\u0012\u0004\u0012\u00020\u000b0\rJ\u001a\u0010\n\u001a\u00020\u00002\u0012\u0010\u0019\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u000b0\bR\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0007\u001a\u0010\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\t\u0018\u00010\bX\u0082\u0004¢\u0006\u0002\n\u0000R@\u0010\f\u001a4\u0012\u0013\u0012\u00110\u0002¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0013\u0012\u00110\u0011¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0012\u0012\u0004\u0012\u00020\u000b\u0018\u00010\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\n\u001a\u0010\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u000b\u0018\u00010\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0002X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001d"}, d2 = {"Lkotlin/io/FileTreeWalk;", "Lkotlin/sequences/Sequence;", "Ljava/io/File;", "start", "direction", "Lkotlin/io/FileWalkDirection;", "(Ljava/io/File;Lkotlin/io/FileWalkDirection;)V", "onEnter", "Lkotlin/Function1;", "", "onLeave", "", "onFail", "Lkotlin/Function2;", "Lkotlin/ParameterName;", AppMeasurementSdk.ConditionalUserProperty.NAME, "f", "Ljava/io/IOException;", "e", "maxDepth", "", "(Ljava/io/File;Lkotlin/io/FileWalkDirection;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;I)V", "iterator", "", "depth", "function", "DirectoryState", "FileTreeWalkIterator", "WalkState", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class FileTreeWalk implements Sequence<File> {
|
||||
private final FileWalkDirection direction;
|
||||
private final int maxDepth;
|
||||
private final Function1<File, Boolean> onEnter;
|
||||
private final Function2<File, IOException, Unit> onFail;
|
||||
private final Function1<File, Unit> onLeave;
|
||||
private final File start;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\"\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004¨\u0006\u0005"}, d2 = {"Lkotlin/io/FileTreeWalk$DirectoryState;", "Lkotlin/io/FileTreeWalk$WalkState;", "rootDir", "Ljava/io/File;", "(Ljava/io/File;)V", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
@SourceDebugExtension({"SMAP\nFileTreeWalk.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FileTreeWalk.kt\nkotlin/io/FileTreeWalk$DirectoryState\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,273:1\n1#2:274\n*E\n"})
|
||||
/* loaded from: classes3.dex */
|
||||
public static abstract class DirectoryState extends WalkState {
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public DirectoryState(File rootDir) {
|
||||
super(rootDir);
|
||||
Intrinsics.checkNotNullParameter(rootDir, "rootDir");
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0082\u0004\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0003\r\u000e\u000fB\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0007\u001a\u00020\bH\u0014J\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\u0002H\u0002J\u000b\u0010\f\u001a\u0004\u0018\u00010\u0002H\u0082\u0010R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Lkotlin/io/FileTreeWalk$FileTreeWalkIterator;", "Lkotlin/collections/AbstractIterator;", "Ljava/io/File;", "(Lkotlin/io/FileTreeWalk;)V", RemoteConfigConstants.ResponseFieldKey.STATE, "Ljava/util/ArrayDeque;", "Lkotlin/io/FileTreeWalk$WalkState;", "computeNext", "", "directoryState", "Lkotlin/io/FileTreeWalk$DirectoryState;", "root", "gotoNext", "BottomUpDirectoryState", "SingleFileState", "TopDownDirectoryState", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class FileTreeWalkIterator extends AbstractIterator<File> {
|
||||
private final ArrayDeque<WalkState> state;
|
||||
|
||||
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0004\b\u0082\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\n\u0010\r\u001a\u0004\u0018\u00010\u0003H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\t\u001a\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\nX\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u000bR\u000e\u0010\f\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lkotlin/io/FileTreeWalk$FileTreeWalkIterator$BottomUpDirectoryState;", "Lkotlin/io/FileTreeWalk$DirectoryState;", "rootDir", "Ljava/io/File;", "(Lkotlin/io/FileTreeWalk$FileTreeWalkIterator;Ljava/io/File;)V", "failed", "", "fileIndex", "", "fileList", "", "[Ljava/io/File;", "rootVisited", "step", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class BottomUpDirectoryState extends DirectoryState {
|
||||
private boolean failed;
|
||||
private int fileIndex;
|
||||
private File[] fileList;
|
||||
private boolean rootVisited;
|
||||
final /* synthetic */ FileTreeWalkIterator this$0;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public BottomUpDirectoryState(FileTreeWalkIterator fileTreeWalkIterator, File rootDir) {
|
||||
super(rootDir);
|
||||
Intrinsics.checkNotNullParameter(rootDir, "rootDir");
|
||||
this.this$0 = fileTreeWalkIterator;
|
||||
}
|
||||
|
||||
@Override // kotlin.io.FileTreeWalk.WalkState
|
||||
public File step() {
|
||||
if (!this.failed && this.fileList == null) {
|
||||
Function1 function1 = FileTreeWalk.this.onEnter;
|
||||
if (function1 != null && !((Boolean) function1.invoke(getRoot())).booleanValue()) {
|
||||
return null;
|
||||
}
|
||||
File[] listFiles = getRoot().listFiles();
|
||||
this.fileList = listFiles;
|
||||
if (listFiles == null) {
|
||||
Function2 function2 = FileTreeWalk.this.onFail;
|
||||
if (function2 != null) {
|
||||
function2.invoke(getRoot(), new AccessDeniedException(getRoot(), null, "Cannot list files in a directory", 2, null));
|
||||
}
|
||||
this.failed = true;
|
||||
}
|
||||
}
|
||||
File[] fileArr = this.fileList;
|
||||
if (fileArr != null) {
|
||||
int i = this.fileIndex;
|
||||
Intrinsics.checkNotNull(fileArr);
|
||||
if (i < fileArr.length) {
|
||||
File[] fileArr2 = this.fileList;
|
||||
Intrinsics.checkNotNull(fileArr2);
|
||||
int i4 = this.fileIndex;
|
||||
this.fileIndex = i4 + 1;
|
||||
return fileArr2[i4];
|
||||
}
|
||||
}
|
||||
if (!this.rootVisited) {
|
||||
this.rootVisited = true;
|
||||
return getRoot();
|
||||
}
|
||||
Function1 function12 = FileTreeWalk.this.onLeave;
|
||||
if (function12 != null) {
|
||||
function12.invoke(getRoot());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\n\u0010\u0007\u001a\u0004\u0018\u00010\u0003H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\b"}, d2 = {"Lkotlin/io/FileTreeWalk$FileTreeWalkIterator$SingleFileState;", "Lkotlin/io/FileTreeWalk$WalkState;", "rootFile", "Ljava/io/File;", "(Lkotlin/io/FileTreeWalk$FileTreeWalkIterator;Ljava/io/File;)V", "visited", "", "step", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
@SourceDebugExtension({"SMAP\nFileTreeWalk.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FileTreeWalk.kt\nkotlin/io/FileTreeWalk$FileTreeWalkIterator$SingleFileState\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,273:1\n1#2:274\n*E\n"})
|
||||
/* loaded from: classes3.dex */
|
||||
public final class SingleFileState extends WalkState {
|
||||
final /* synthetic */ FileTreeWalkIterator this$0;
|
||||
private boolean visited;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public SingleFileState(FileTreeWalkIterator fileTreeWalkIterator, File rootFile) {
|
||||
super(rootFile);
|
||||
Intrinsics.checkNotNullParameter(rootFile, "rootFile");
|
||||
this.this$0 = fileTreeWalkIterator;
|
||||
}
|
||||
|
||||
@Override // kotlin.io.FileTreeWalk.WalkState
|
||||
public File step() {
|
||||
if (this.visited) {
|
||||
return null;
|
||||
}
|
||||
this.visited = true;
|
||||
return getRoot();
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\n\u0010\f\u001a\u0004\u0018\u00010\u0003H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\u0007\u001a\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\bX\u0082\u000e¢\u0006\u0004\n\u0002\u0010\tR\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lkotlin/io/FileTreeWalk$FileTreeWalkIterator$TopDownDirectoryState;", "Lkotlin/io/FileTreeWalk$DirectoryState;", "rootDir", "Ljava/io/File;", "(Lkotlin/io/FileTreeWalk$FileTreeWalkIterator;Ljava/io/File;)V", "fileIndex", "", "fileList", "", "[Ljava/io/File;", "rootVisited", "", "step", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class TopDownDirectoryState extends DirectoryState {
|
||||
private int fileIndex;
|
||||
private File[] fileList;
|
||||
private boolean rootVisited;
|
||||
final /* synthetic */ FileTreeWalkIterator this$0;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public TopDownDirectoryState(FileTreeWalkIterator fileTreeWalkIterator, File rootDir) {
|
||||
super(rootDir);
|
||||
Intrinsics.checkNotNullParameter(rootDir, "rootDir");
|
||||
this.this$0 = fileTreeWalkIterator;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:29:0x007e, code lost:
|
||||
|
||||
if (r0.length == 0) goto L31;
|
||||
*/
|
||||
@Override // kotlin.io.FileTreeWalk.WalkState
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public java.io.File step() {
|
||||
/*
|
||||
r9 = this;
|
||||
boolean r0 = r9.rootVisited
|
||||
r1 = 0
|
||||
if (r0 != 0) goto L28
|
||||
kotlin.io.FileTreeWalk$FileTreeWalkIterator r0 = r9.this$0
|
||||
kotlin.io.FileTreeWalk r0 = kotlin.io.FileTreeWalk.this
|
||||
kotlin.jvm.functions.Function1 r0 = kotlin.io.FileTreeWalk.access$getOnEnter$p(r0)
|
||||
if (r0 == 0) goto L20
|
||||
java.io.File r2 = r9.getRoot()
|
||||
java.lang.Object r0 = r0.invoke(r2)
|
||||
java.lang.Boolean r0 = (java.lang.Boolean) r0
|
||||
boolean r0 = r0.booleanValue()
|
||||
if (r0 != 0) goto L20
|
||||
return r1
|
||||
L20:
|
||||
r0 = 1
|
||||
r9.rootVisited = r0
|
||||
java.io.File r9 = r9.getRoot()
|
||||
return r9
|
||||
L28:
|
||||
java.io.File[] r0 = r9.fileList
|
||||
if (r0 == 0) goto L47
|
||||
int r2 = r9.fileIndex
|
||||
kotlin.jvm.internal.Intrinsics.checkNotNull(r0)
|
||||
int r0 = r0.length
|
||||
if (r2 >= r0) goto L35
|
||||
goto L47
|
||||
L35:
|
||||
kotlin.io.FileTreeWalk$FileTreeWalkIterator r0 = r9.this$0
|
||||
kotlin.io.FileTreeWalk r0 = kotlin.io.FileTreeWalk.this
|
||||
kotlin.jvm.functions.Function1 r0 = kotlin.io.FileTreeWalk.access$getOnLeave$p(r0)
|
||||
if (r0 == 0) goto L46
|
||||
java.io.File r9 = r9.getRoot()
|
||||
r0.invoke(r9)
|
||||
L46:
|
||||
return r1
|
||||
L47:
|
||||
java.io.File[] r0 = r9.fileList
|
||||
if (r0 != 0) goto L92
|
||||
java.io.File r0 = r9.getRoot()
|
||||
java.io.File[] r0 = r0.listFiles()
|
||||
r9.fileList = r0
|
||||
if (r0 != 0) goto L76
|
||||
kotlin.io.FileTreeWalk$FileTreeWalkIterator r0 = r9.this$0
|
||||
kotlin.io.FileTreeWalk r0 = kotlin.io.FileTreeWalk.this
|
||||
kotlin.jvm.functions.Function2 r0 = kotlin.io.FileTreeWalk.access$getOnFail$p(r0)
|
||||
if (r0 == 0) goto L76
|
||||
java.io.File r2 = r9.getRoot()
|
||||
kotlin.io.AccessDeniedException r3 = new kotlin.io.AccessDeniedException
|
||||
java.io.File r4 = r9.getRoot()
|
||||
r7 = 2
|
||||
r8 = 0
|
||||
r5 = 0
|
||||
java.lang.String r6 = "Cannot list files in a directory"
|
||||
r3.<init>(r4, r5, r6, r7, r8)
|
||||
r0.invoke(r2, r3)
|
||||
L76:
|
||||
java.io.File[] r0 = r9.fileList
|
||||
if (r0 == 0) goto L80
|
||||
kotlin.jvm.internal.Intrinsics.checkNotNull(r0)
|
||||
int r0 = r0.length
|
||||
if (r0 != 0) goto L92
|
||||
L80:
|
||||
kotlin.io.FileTreeWalk$FileTreeWalkIterator r0 = r9.this$0
|
||||
kotlin.io.FileTreeWalk r0 = kotlin.io.FileTreeWalk.this
|
||||
kotlin.jvm.functions.Function1 r0 = kotlin.io.FileTreeWalk.access$getOnLeave$p(r0)
|
||||
if (r0 == 0) goto L91
|
||||
java.io.File r9 = r9.getRoot()
|
||||
r0.invoke(r9)
|
||||
L91:
|
||||
return r1
|
||||
L92:
|
||||
java.io.File[] r0 = r9.fileList
|
||||
kotlin.jvm.internal.Intrinsics.checkNotNull(r0)
|
||||
int r1 = r9.fileIndex
|
||||
int r2 = r1 + 1
|
||||
r9.fileIndex = r2
|
||||
r9 = r0[r1]
|
||||
return r9
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: kotlin.io.FileTreeWalk.FileTreeWalkIterator.TopDownDirectoryState.step():java.io.File");
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public /* synthetic */ class WhenMappings {
|
||||
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
||||
|
||||
static {
|
||||
int[] iArr = new int[FileWalkDirection.values().length];
|
||||
try {
|
||||
iArr[FileWalkDirection.TOP_DOWN.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
iArr[FileWalkDirection.BOTTOM_UP.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
$EnumSwitchMapping$0 = iArr;
|
||||
}
|
||||
}
|
||||
|
||||
public FileTreeWalkIterator() {
|
||||
ArrayDeque<WalkState> arrayDeque = new ArrayDeque<>();
|
||||
this.state = arrayDeque;
|
||||
if (FileTreeWalk.this.start.isDirectory()) {
|
||||
arrayDeque.push(directoryState(FileTreeWalk.this.start));
|
||||
} else if (FileTreeWalk.this.start.isFile()) {
|
||||
arrayDeque.push(new SingleFileState(this, FileTreeWalk.this.start));
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
private final DirectoryState directoryState(File root) {
|
||||
int i = WhenMappings.$EnumSwitchMapping$0[FileTreeWalk.this.direction.ordinal()];
|
||||
if (i == 1) {
|
||||
return new TopDownDirectoryState(this, root);
|
||||
}
|
||||
if (i == 2) {
|
||||
return new BottomUpDirectoryState(this, root);
|
||||
}
|
||||
throw new NoWhenBranchMatchedException();
|
||||
}
|
||||
|
||||
private final File gotoNext() {
|
||||
File step;
|
||||
while (true) {
|
||||
WalkState peek = this.state.peek();
|
||||
if (peek == null) {
|
||||
return null;
|
||||
}
|
||||
step = peek.step();
|
||||
if (step == null) {
|
||||
this.state.pop();
|
||||
} else {
|
||||
if (Intrinsics.areEqual(step, peek.getRoot()) || !step.isDirectory() || this.state.size() >= FileTreeWalk.this.maxDepth) {
|
||||
break;
|
||||
}
|
||||
this.state.push(directoryState(step));
|
||||
}
|
||||
}
|
||||
return step;
|
||||
}
|
||||
|
||||
@Override // kotlin.collections.AbstractIterator
|
||||
public void computeNext() {
|
||||
File gotoNext = gotoNext();
|
||||
if (gotoNext != null) {
|
||||
setNext(gotoNext);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\"\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\n\u0010\u0007\u001a\u0004\u0018\u00010\u0003H&R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"Lkotlin/io/FileTreeWalk$WalkState;", "", "root", "Ljava/io/File;", "(Ljava/io/File;)V", "getRoot", "()Ljava/io/File;", "step", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public static abstract class WalkState {
|
||||
private final File root;
|
||||
|
||||
public WalkState(File root) {
|
||||
Intrinsics.checkNotNullParameter(root, "root");
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
public final File getRoot() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public abstract File step();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private FileTreeWalk(File file, FileWalkDirection fileWalkDirection, Function1<? super File, Boolean> function1, Function1<? super File, Unit> function12, Function2<? super File, ? super IOException, Unit> function2, int i) {
|
||||
this.start = file;
|
||||
this.direction = fileWalkDirection;
|
||||
this.onEnter = function1;
|
||||
this.onLeave = function12;
|
||||
this.onFail = function2;
|
||||
this.maxDepth = i;
|
||||
}
|
||||
|
||||
@Override // kotlin.sequences.Sequence
|
||||
public Iterator<File> iterator() {
|
||||
return new FileTreeWalkIterator();
|
||||
}
|
||||
|
||||
public final FileTreeWalk maxDepth(int depth) {
|
||||
if (depth > 0) {
|
||||
return new FileTreeWalk(this.start, this.direction, this.onEnter, this.onLeave, this.onFail, depth);
|
||||
}
|
||||
throw new IllegalArgumentException("depth must be positive, but was " + depth + '.');
|
||||
}
|
||||
|
||||
public final FileTreeWalk onEnter(Function1<? super File, Boolean> function) {
|
||||
Intrinsics.checkNotNullParameter(function, "function");
|
||||
return new FileTreeWalk(this.start, this.direction, function, this.onLeave, this.onFail, this.maxDepth);
|
||||
}
|
||||
|
||||
public final FileTreeWalk onFail(Function2<? super File, ? super IOException, Unit> function) {
|
||||
Intrinsics.checkNotNullParameter(function, "function");
|
||||
return new FileTreeWalk(this.start, this.direction, this.onEnter, this.onLeave, function, this.maxDepth);
|
||||
}
|
||||
|
||||
public final FileTreeWalk onLeave(Function1<? super File, Unit> function) {
|
||||
Intrinsics.checkNotNullParameter(function, "function");
|
||||
return new FileTreeWalk(this.start, this.direction, this.onEnter, function, this.onFail, this.maxDepth);
|
||||
}
|
||||
|
||||
public /* synthetic */ FileTreeWalk(File file, FileWalkDirection fileWalkDirection, Function1 function1, Function1 function12, Function2 function2, int i, int i4, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this(file, (i4 & 2) != 0 ? FileWalkDirection.TOP_DOWN : fileWalkDirection, function1, function12, function2, (i4 & 32) != 0 ? Integer.MAX_VALUE : i);
|
||||
}
|
||||
|
||||
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
||||
public FileTreeWalk(File start, FileWalkDirection direction) {
|
||||
this(start, direction, null, null, null, 0, 32, null);
|
||||
Intrinsics.checkNotNullParameter(start, "start");
|
||||
Intrinsics.checkNotNullParameter(direction, "direction");
|
||||
}
|
||||
|
||||
public /* synthetic */ FileTreeWalk(File file, FileWalkDirection fileWalkDirection, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this(file, (i & 2) != 0 ? FileWalkDirection.TOP_DOWN : fileWalkDirection);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user