package com.bytedance.storagehandler;

import X.4Sh;
import X.C33148qv;
import X.C33168qx;
import android.os.SystemClock;
import com.bytedance.android.bytehook.ByteHook;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.librarian.Librarian;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class StorageFilter {
    public static final Object LIZ = new Object();
    public static volatile List<C33168qx> LIZIZ;

    public static native void configStack(int i, boolean z);

    public static native void init(String str);

    public static native void test();

    static {
        Covode.recordClassIndex(38125);
        ByteHook.init();
        long uptimeMillis = SystemClock.uptimeMillis();
        Librarian.LIZ("storagehandlerlib");
        4Sh.LIZ(uptimeMillis, "storagehandlerlib");
    }

    public static boolean onDelete(String str) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        for (C33168qx next : list) {
            if (next != null && !next.LIZ(str)) {
                return false;
            }
        }
        return true;
    }

    public static boolean onMkdir(String str) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static boolean onOpen(String str) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static void LIZ(C33168qx r5) {
        MethodCollector.i(6500);
        ArrayList arrayList = new ArrayList();
        synchronized (LIZ) {
            try {
                if (LIZIZ != null) {
                    for (C33168qx add : LIZIZ) {
                        arrayList.add(add);
                    }
                }
                arrayList.add(r5);
                LIZIZ = arrayList;
            } finally {
                MethodCollector.o(6500);
            }
        }
    }

    public static boolean onDeleteNative(String str, String str2) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        for (C33168qx next : list) {
            if (next != null && !next.LIZ(str, str2)) {
                return false;
            }
        }
        return true;
    }

    public static boolean onMkdirNative(String str, String str2) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static boolean onMkfifoNative(String str, String str2) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static boolean onOpenNative(String str, String str2) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static boolean onLinkNative(String str, String str2, String str3) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static boolean onRenameNative(String str, String str2, String str3) {
        List<C33168qx> list = LIZIZ;
        if (list == null) {
            return true;
        }
        Iterator<C33168qx> it = list.iterator();
        while (it.hasNext()) {
            it.next();
        }
        return true;
    }

    public static void onIntercepted(String str, String str2, String str3, int i, int i2) {
        List<C33168qx> list = LIZIZ;
        if (list != null) {
            for (C33168qx next : list) {
                if (next != null) {
                    C33148qv.values();
                    next.LIZIZ(str, str3);
                }
            }
        }
    }
}
