package com.ss.android.ugc.aweme.shortvideo.ui.task;

import X.0CB;
import X.0CD;
import X.0CH;
import X.0CN;
import X.1hK;
import X.2cN;
import X.6Is;
import X.6r0;
import X.7lW;
import X.C0938Mhh;
import X.C0943Mhm;
import X.C0957Mi0;
import X.C0966Mi9;
import X.C1103MkM;
import X.C1104MkN;
import X.C1105MkO;
import X.C1106MkP;
import X.C3400NgJ;
import X.M12;
import X.MWE;
import android.content.Context;
import com.bytedance.covode.number.Covode;

public final class PreloadMediaDataTask implements 6Is, MWE {
    public final 1hK LIZ;
    public long LIZIZ;
    public 2cN LIZJ;
    public 2cN LIZLLL;
    public final 0CD LJ;

    static {
        Covode.recordClassIndex(113380);
    }

    public final boolean LIZIZ() {
        return true;
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    public final C3400NgJ LIZJ() {
        return C3400NgJ.P0;
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void onDestroy() {
        2cN r0 = this.LIZJ;
        if (r0 != null) {
            r0.dispose();
        }
        2cN r02 = this.LIZLLL;
        if (r02 != null) {
            r02.dispose();
        }
        C0938Mhh.LIZLLL.LIZ().LIZIZ.LIZJ();
    }

    public final void LIZ() {
        Context applicationContext = this.LIZ.getApplicationContext();
        if (7lW.LIZJ && applicationContext == null) {
            applicationContext = 7lW.LIZ;
        }
        C0966Mi9.LIZ(applicationContext, 6r0.LIZ());
        C0938Mhh LIZ2 = C0938Mhh.LIZLLL.LIZ();
        this.LIZJ = LIZ2.LIZ(new C0943Mhm(3, 30, 0), C0957Mi0.LIZ).LIZ(new C1103MkM(this), C1104MkN.LIZ);
        this.LIZLLL = LIZ2.LIZ(new C0943Mhm(4, 30, 0), C0957Mi0.LIZ).LIZ(C1105MkO.LIZ, C1106MkP.LIZ);
    }

    public PreloadMediaDataTask(0CD r2, 1hK r3, long j) {
        M12.LIZ(r2, r3);
        this.LJ = r2;
        this.LIZ = r3;
        this.LIZIZ = j;
        r2.LIZ(this);
    }
}
