package com.ss.android.ugc.aweme.legoImp.task;

import X.4Ms;
import X.AnonymousClass9EH;
import X.C11517x8;
import X.C11817xc;
import X.C22428Zd;
import X.C22438Ze;
import X.C25518ec;
import X.C42869Ft;
import X.C42909Fx;
import X.TnA;
import android.content.Context;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import java.io.File;
import java.util.List;
import kotlin.h.b.n;

public final class InitCovodeTask implements C22438Ze {
    public final boolean LIZ;

    static {
        Covode.recordClassIndex(90458);
    }

    public final String prefix() {
        return "task_";
    }

    public final boolean serialExecute() {
        return false;
    }

    public final int targetProcess() {
        return 1048575;
    }

    public final List triggerOtherLegoComponents() {
        return null;
    }

    public final C42869Ft triggerType() {
        return C22428Zd.LIZ(this);
    }

    public final C42909Fx scenesType() {
        return C42909Fx.DEFAULT;
    }

    public final C25518ec type() {
        return C25518ec.BACKGROUND;
    }

    public final String key() {
        return getClass().getSimpleName();
    }

    public final boolean meetTrigger() {
        if (!((Boolean) TnA.LIZIZ.getValue()).booleanValue()) {
            return true;
        }
        if (!this.LIZ) {
            LIZ(AnonymousClass9EH.LJJIFFI.LIZ());
        }
        return this.LIZ;
    }

    public final void run(Context context) {
        LIZ(context);
    }

    public InitCovodeTask(boolean z) {
        this.LIZ = z;
    }

    private final void LIZ(Context context) {
        File LIZ2;
        String path;
        C11517x8 r2 = new C11517x8(context);
        r2.LIZ(C11817xc.LIZ(context));
        r2.LIZIZ = this.LIZ;
        if (!(!this.LIZ || !n.LIZ((Object) AnonymousClass9EH.LJIJI, (Object) "local_test") || context == null || (LIZ2 = LIZ(context, "covode")) == null || (path = LIZ2.getPath()) == null)) {
            r2.LIZ(path);
        }
        Covode.startCollecting(r2);
    }

    public static File LIZ(Context context, String str) {
        if (!TextUtils.isEmpty(str)) {
            return context.getExternalFilesDir(str);
        }
        if (4Ms.LIZLLL != null && 4Ms.LJ) {
            return 4Ms.LIZLLL;
        }
        File externalFilesDir = context.getExternalFilesDir(str);
        4Ms.LIZLLL = externalFilesDir;
        return externalFilesDir;
    }
}
