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

import X.0HH;
import X.7zm;
import X.805;
import X.8Zd;
import X.8Ze;
import X.8cV;
import X.8ec;
import X.8lp;
import X.9EH;
import X.9FH;
import X.9Ft;
import X.9Fx;
import X.C2917Q9a;
import X.C3026QDf;
import X.C3103QGe;
import X.ML9;
import X.OCa;
import X.QAB;
import X.QEL;
import X.QGG;
import X.QGN;
import X.QHV;
import X.QHW;
import X.TnA;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.List;

public class FrescoTask implements 9FH, 8Ze {
    public static volatile boolean LIZ;

    static {
        Covode.recordClassIndex(90831);
    }

    public String[] deps() {
        return null;
    }

    public boolean meetTrigger() {
        return true;
    }

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

    public int priority() {
        return 2;
    }

    public boolean serialExecute() {
        return false;
    }

    public int targetProcess() {
        return 1;
    }

    public List triggerOtherLegoComponents() {
        return null;
    }

    public 9Ft triggerType() {
        return 8Zd.LIZ(this);
    }

    public 9Fx scenesType() {
        return 9Fx.DEFAULT;
    }

    public 8lp threadType() {
        return 8lp.CPU;
    }

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

    public 8ec type() {
        if (ML9.LIZIZ.LIZ() || !TnA.LJFF.LJI()) {
            return 8ec.BACKGROUND;
        }
        return 8ec.MAIN;
    }

    public void run(Context context) {
        MethodCollector.i(1778);
        if (!LIZ) {
            synchronized (FrescoTask.class) {
                try {
                    if (!LIZ) {
                        if (ML9.LIZIZ.LIZ()) {
                            QAB.LJJIFFI.LIZIZ();
                            QAB.LJJIFFI.LIZJ();
                        }
                        Long.valueOf(System.currentTimeMillis());
                        805.LIZ(context);
                        OCa.LIZ = true;
                        7zm r0 = 7zm.LIZ;
                        if (r0 != null) {
                            C3026QDf.LIZ = r0;
                            C3026QDf.LIZIZ(5);
                            if (!ML9.LIZIZ.LIZ()) {
                                Context LIZ2 = 9EH.LJJIFFI.LIZ();
                                C2917Q9a q9a = new C2917Q9a();
                                if (!QHW.LIZJ) {
                                    QHW.LIZJ = true;
                                    QHW.LIZIZ = q9a;
                                    QHW.LIZLLL = LIZ2.getPackageName();
                                    QHW.LIZ.init(q9a);
                                }
                            }
                            QHV.LIZJ = false;
                            LIZ = true;
                            QGG.LIZ.LIZ((QGN) new QGN() {
                                static {
                                    Covode.recordClassIndex(90833);
                                }

                                public final void LIZ(C3103QGe qGe) {
                                    try {
                                        double suggestedTrimRatio = qGe.getSuggestedTrimRatio();
                                        if (C3103QGe.OnCloseToDalvikHeapLimit.getSuggestedTrimRatio() == suggestedTrimRatio || C3103QGe.OnSystemLowMemoryWhileAppInBackground.getSuggestedTrimRatio() == suggestedTrimRatio || C3103QGe.OnSystemLowMemoryWhileAppInForeground.getSuggestedTrimRatio() == suggestedTrimRatio) {
                                            QEL.LIZIZ().LJIIIIZZ().LIZ();
                                        }
                                    } catch (Exception e) {
                                        0HH.LIZ(e);
                                    }
                                }
                            });
                        } else {
                            IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
                            MethodCollector.o(1778);
                            throw illegalArgumentException;
                        }
                    }
                } catch (Exception e) {
                    8cV.LIZ(e, "[Lighten][Fresco][Initializer][Throwable]");
                    MethodCollector.o(1778);
                    throw e;
                } catch (Throwable th) {
                    MethodCollector.o(1778);
                    throw th;
                }
            }
            MethodCollector.o(1778);
            return;
        }
        MethodCollector.o(1778);
    }
}
