package o;

import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.os.PersistableBundle;
import com.google.android.gms.common.internal.Preconditions;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.dt0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1047dt0 extends AbstractC2090oq0 {
    public JobScheduler c;

    @Override // o.AbstractC2090oq0
    public final boolean v() {
        return true;
    }

    public final void w(long j) {
        Kr0 kr0 = (Kr0) this.a;
        t();
        r();
        JobScheduler jobScheduler = this.c;
        if (jobScheduler != null && jobScheduler.getPendingJob("measurement-client".concat(String.valueOf(kr0.a.getPackageName())).hashCode()) != null) {
            Nq0 nq0 = kr0.f;
            Kr0.l(nq0);
            nq0.n.b("[sgtm] There's an existing pending job, skip this schedule.");
            return;
        }
        Wr0 wr0X = x();
        if (wr0X != Wr0.n) {
            Nq0 nq02 = kr0.f;
            Kr0.l(nq02);
            nq02.n.c(wr0X.name(), "[sgtm] Not eligible for Scion upload");
            return;
        }
        Nq0 nq03 = kr0.f;
        Kr0.l(nq03);
        nq03.n.c(Long.valueOf(j), "[sgtm] Scheduling Scion upload, millis");
        PersistableBundle persistableBundle = new PersistableBundle();
        persistableBundle.putString("action", "com.google.android.gms.measurement.SCION_UPLOAD");
        int iSchedule = ((JobScheduler) Preconditions.checkNotNull(this.c)).schedule(new JobInfo.Builder("measurement-client".concat(String.valueOf(kr0.a.getPackageName())).hashCode(), new ComponentName(kr0.a, "com.google.android.gms.measurement.AppMeasurementJobService")).setRequiredNetworkType(1).setMinimumLatency(j).setOverrideDeadline(j + j).setExtras(persistableBundle).build());
        Nq0 nq04 = kr0.f;
        Kr0.l(nq04);
        nq04.n.c(iSchedule == 1 ? "SUCCESS" : "FAILURE", "[sgtm] Scion upload job scheduled with result");
    }

    public final Wr0 x() {
        ServiceInfo serviceInfo;
        Kr0 kr0 = (Kr0) this.a;
        t();
        r();
        if (this.c == null) {
            return Wr0.s;
        }
        Boolean boolE = kr0.d.E("google_analytics_sgtm_upload_enabled");
        boolean z = false;
        if (!(boolE == null ? false : boolE.booleanValue())) {
            return Wr0.t;
        }
        if (kr0.q().j < 119000) {
            return Wr0.r;
        }
        Context context = kr0.a;
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null && (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementJobService"), 0)) != null) {
                if (serviceInfo.enabled) {
                    z = true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return !z ? Wr0.f402o : !kr0.o().z() ? Wr0.q : Wr0.n;
    }
}
