package com.google.android.play.core.e;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;
import com.google.android.play.core.b.aq;
import com.google.android.play.core.b.au;
import com.google.android.play.core.b.b;
import com.google.android.play.core.b.l;
import com.google.android.play.core.d.q;
import com.google.android.play.core.tasks.e;
import com.google.android.play.core.tasks.g;
import com.google.android.play.core.tasks.p;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public final class t {
    public static final b LIZ = new b("SplitInstallService");
    public static final Intent LIZLLL = new Intent("com.google.android.play.core.splitinstall.BIND_SPLIT_INSTALL_SERVICE").setPackage("com.android.vending");
    public final String LIZIZ;
    public l<aq> LIZJ;

    static {
        Covode.recordClassIndex(44392);
    }

    public t(Context context) {
        this.LIZIZ = context.getPackageName();
        if (au.LIZ(context)) {
            this.LIZJ = new l<>(q.LIZ(context), LIZ, "SplitInstallService", LIZLLL, l.LIZ);
        }
    }

    public static /* synthetic */ ArrayList LIZ(Collection collection) {
        ArrayList arrayList = new ArrayList(collection.size());
        Iterator it = collection.iterator();
        while (it.hasNext()) {
            Bundle bundle = new Bundle();
            bundle.putString("language", (String) it.next());
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static /* synthetic */ Bundle LIZIZ() {
        Bundle bundle = new Bundle();
        bundle.putInt("playcore_version_code", 10900);
        return bundle;
    }

    public static <T> e<T> LIZJ() {
        LIZ.LIZIZ("onError(%d)", -14);
        return g.LIZ((Exception) new a(-14));
    }

    public final e<List<f>> LIZ() {
        if (this.LIZJ == null) {
            return LIZJ();
        }
        LIZ.LIZJ("getSessionStates", new Object[0]);
        p pVar = new p();
        this.LIZJ.LIZ(new n(this, pVar, pVar));
        return pVar.LIZ;
    }

    public final e<Void> LIZ(int i) {
        if (this.LIZJ == null) {
            return LIZJ();
        }
        LIZ.LIZJ("cancelInstall(%d)", Integer.valueOf(i));
        p pVar = new p();
        this.LIZJ.LIZ(new o(this, pVar, i, pVar));
        return pVar.LIZ;
    }

    public final e<Integer> LIZ(Collection<String> collection, Collection<String> collection2) {
        if (this.LIZJ == null) {
            return LIZJ();
        }
        Collection<String> collection3 = collection;
        Collection<String> collection4 = collection2;
        LIZ.LIZJ("startInstall(%s,%s)", collection3, collection4);
        p pVar = new p();
        this.LIZJ.LIZ(new m(this, pVar, collection3, collection4, pVar));
        return pVar.LIZ;
    }
}
