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

import X.0HH;
import X.2kf;
import X.49p;
import X.AnonymousClass9EH;
import X.C10977wG;
import X.C10987wH;
import X.C10997wI;
import X.C11537xA;
import X.C25518ec;
import X.C25718ew;
import X.C42869Ft;
import X.C42909Fx;
import android.content.Context;
import android.os.Build;
import com.bytedance.covode.number.Covode;
import java.util.List;

public class AOTOptimizeService implements C10997wI {
    public static boolean LIZIZ;
    public C10977wG LIZ;

    static {
        Covode.recordClassIndex(90362);
    }

    public boolean meetTrigger() {
        return true;
    }

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

    public int targetProcess() {
        return 1048575;
    }

    public List triggerOtherLegoComponents() {
        return null;
    }

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

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

    public final C25518ec LIZ() {
        if (C11537xA.LIZIZ().booleanValue()) {
            return C25518ec.BOOT_FINISH;
        }
        return C25518ec.APP_BACKGROUND;
    }

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

    private boolean LIZJ() {
        Context LIZ2 = AnonymousClass9EH.LJJIFFI.LIZ();
        if (!49p.LIZIZ().LIZ(LIZ2, "aot_release_build_version").equals(C25718ew.LIZ(LIZ2).LIZ("release_build", "default_version"))) {
            return true;
        }
        return false;
    }

    public final boolean LIZIZ() {
        if (!C11537xA.LIZIZ().booleanValue() && Build.VERSION.SDK_INT >= 24 && LIZJ() && !LIZIZ) {
            return true;
        }
        return false;
    }

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

    public final void LIZ(Context context) {
        if (LIZIZ()) {
            2kf.LIZ("startWatchingForOptimize");
            if (this.LIZ == null) {
                this.LIZ = new C10977wG(this, context, 0HH.LIZ("%s/%s/%s", new Object[]{"/data/misc/profiles/cur/0", context.getPackageName(), "primary.prof"}));
            }
            this.LIZ.startWatching();
        }
    }
}
