package com.ss.android.ugc.aweme.tools.cutsamemv;

import X.6ZR;
import X.80Q;
import X.C5213OMu;
import X.C5214OMv;
import X.C5215OMw;
import X.M12;
import X.QZL;
import android.content.Intent;
import com.bytedance.covode.number.Covode;
import com.bytedance.helios.sdk.utils.ServiceLifecycle;
import com.ss.android.ugc.aweme.download.component_api.DownloadServiceManager;
import com.ss.android.ugc.cut_downloader.AbsDownloadService;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.h.b.n;

public final class CutSameSdkDownloadService extends AbsDownloadService {
    public static final C5214OMv LIZIZ = new C5214OMv((byte) 0);
    public final Map<String, Integer> LIZ = new LinkedHashMap();

    static {
        Covode.recordClassIndex(119197);
    }

    public final int onStartCommand(Intent intent, int i, int i2) {
        ServiceLifecycle.onStartCommand(this, intent, i, i2);
        return super.onStartCommand(intent, i, i2);
    }

    public final void LIZ(String str, String str2, C5215OMw oMw) {
        M12.LIZ(str, oMw);
        StringBuilder sb = new StringBuilder();
        File cacheDir = getCacheDir();
        n.LIZIZ(cacheDir, "");
        sb.append(cacheDir.getAbsolutePath());
        sb.append("/cutsamezip");
        String sb2 = sb.toString();
        new File(sb2).mkdirs();
        StringBuilder sb3 = new StringBuilder();
        String LIZ2 = 80Q.LIZ(str);
        if (LIZ2 == null) {
            LIZ2 = String.valueOf(System.currentTimeMillis());
        }
        sb3.append(LIZ2);
        sb3.append(".zip");
        String sb4 = sb3.toString();
        QZL with = DownloadServiceManager.INSTANCE.getDownloadService().with(str);
        with.LJFF = sb2;
        with.LIZJ = sb4;
        with.LJIJ = str2;
        with.LIZ(3);
        with.LIZ("cutsame_template");
        with.LJJIIJZLJL = new C5213OMu(this, oMw);
        with.LIZ(true);
        with.LIZLLL();
        int LJFF = with.LJFF();
        6ZR.LIZLLL("CutSameSdkDownload, start : downloadId=" + LJFF + ", url=" + str + ", path=" + sb2 + '/' + sb4);
        this.LIZ.put(str, Integer.valueOf(LJFF));
    }
}
