package com.ss.android.ugc.aweme.shortvideo.WorkSpace;

import X.4N2;
import X.80k;
import X.8Kc;
import X.8r0;
import X.8r1;
import X.C45806qQ;
import X.C45986qi;
import X.C45996qj;
import X.C46026qm;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.abmock.SettingsManager;
import java.io.File;

public class OldImpl implements WorkspaceImpl, C45996qj {
    public static final Parcelable.Creator<OldImpl> CREATOR = new C45986qi();
    public int LIZ;
    public String LIZIZ = C46026qm.LIZJ;
    public String LIZJ;
    public String LIZLLL;
    public String LJ;
    public String LJFF;
    public String LJI;
    public String LJII;
    public String LJIIIIZZ;
    public String LJIIIZ;
    public String LJIIJ;
    public String LJIIJJI;
    public String LJIIL;
    public String LJIILIIL;
    public String LJIILJJIL;
    public Workspace LJIILL;
    public Handler LJIILLIIL = new Handler(Looper.getMainLooper());

    public int describeContents() {
        return 0;
    }

    public final String LJ() {
        return this.LJI;
    }

    public final File LJFF() {
        return new File(this.LIZIZ);
    }

    public final void LJI() {
        this.LJI = null;
        this.LJIILJJIL = null;
    }

    static {
        Covode.recordClassIndex(108164);
    }

    public OldImpl() {
    }

    public final File LIZJ() {
        if (TextUtils.isEmpty(this.LIZLLL)) {
            this.LIZLLL = C46026qm.LIZ("-concat-v");
        }
        return new File(this.LIZLLL);
    }

    public final File LIZLLL() {
        if (TextUtils.isEmpty(this.LJ)) {
            this.LJ = C46026qm.LIZ("-concat-a");
        }
        return new File(this.LJ);
    }

    public final void LJIIIIZZ() {
        if (LJFF().exists()) {
            80k.LIZ(LJFF());
        }
        LJII();
    }

    public final File LJIIIZ() {
        if (this.LJIIIZ == null) {
            this.LJIIIZ = new C45806qQ().LIZ(LIZJ().getPath());
        }
        return new File(this.LJIIIZ);
    }

    public final File LJIIJ() {
        if (this.LJIIJ == null) {
            this.LJIIJ = new C45806qQ().LIZIZ(LIZLLL().getPath());
        }
        return new File(this.LJIIJ);
    }

    public final File LJIIJJI() {
        if (this.LJIIJJI == null) {
            this.LJIIJJI = new C45806qQ().LIZJ(LIZJ().getPath());
        }
        return new File(this.LJIIJJI);
    }

    public final void LJII() {
        if (this.LJIIIIZZ == null) {
            this.LJIIIIZZ = new File(this.LJI + ".wav").getPath();
        }
        File file = new File(this.LJIIIIZZ);
        if (file.exists()) {
            LIZ(file);
        }
        if (this.LJII == null) {
            this.LJII = new File(C46026qm.LIZIZ, "mix.wav").getPath();
        }
        File file2 = new File(this.LJII);
        if (file2.exists()) {
            LIZ(file2);
        }
    }

    public final void LIZ(Workspace workspace) {
        this.LJIILL = workspace;
    }

    public final void LIZ(String str) {
        this.LIZIZ = str;
    }

    public final void LIZIZ(String str) {
        LJI();
        this.LJI = str;
    }

    public final File LIZJ(String str) {
        String str2 = C46026qm.LJFF;
        if (!80k.LIZ(str2)) {
            80k.LIZ(str2, false);
        }
        this.LJIIL = str2 + C46026qm.LIZIZ("-bgv-v");
        return new File(this.LJIIL);
    }

    public final File LIZLLL(String str) {
        String str2 = C46026qm.LJFF;
        if (!80k.LIZ(str2)) {
            80k.LIZ(str2, false);
        }
        this.LJIILIIL = str2 + C46026qm.LIZIZ("-bgv-a");
        return new File(this.LJIILIIL);
    }

    public OldImpl(Parcel parcel) {
        this.LIZ = parcel.readInt();
        this.LIZIZ = parcel.readString();
        this.LIZJ = parcel.readString();
        this.LIZLLL = parcel.readString();
        this.LJ = parcel.readString();
        this.LJFF = parcel.readString();
        this.LJI = parcel.readString();
        this.LJIIIIZZ = parcel.readString();
        this.LJII = parcel.readString();
        this.LJIIIZ = parcel.readString();
        this.LJIILJJIL = parcel.readString();
    }

    public static boolean LIZ(File file) {
        8r1 r3;
        MethodCollector.i(882);
        try {
            if (8Kc.LIZIZ()) {
                r3 = (8r1) SettingsManager.LIZ().LIZ("storage_intercepter_key", 8r1.class, 4N2.LIZ);
            } else {
                r3 = 4N2.LIZ;
            }
            if (8r0.LIZ(file.getAbsolutePath(), r3)) {
                8r0.LIZ(file, new RuntimeException(), "exception_delete_log", 8r0.LIZ(r3));
            }
            if (8r0.LIZJ(file.getAbsolutePath(), r3)) {
                8r0.LIZ(file, new RuntimeException(), "exception_handle", 8r0.LIZ(r3));
                MethodCollector.o(882);
                return false;
            }
        } catch (Throwable unused) {
        }
        boolean delete = file.delete();
        MethodCollector.o(882);
        return delete;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.LIZ);
        parcel.writeString(this.LIZIZ);
        parcel.writeString(this.LIZJ);
        parcel.writeString(this.LIZLLL);
        parcel.writeString(this.LJ);
        parcel.writeString(this.LJFF);
        parcel.writeString(this.LJI);
        parcel.writeString(this.LJIIIIZZ);
        parcel.writeString(this.LJII);
        parcel.writeString(this.LJIIIZ);
        parcel.writeString(this.LJIILJJIL);
    }
}
