package o;

import android.app.job.JobParameters;
import android.app.job.JobWorkItem;
import android.os.AsyncTask;
import androidx.core.app.JobIntentService;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class WI extends AsyncTask {
    public final /* synthetic */ JobIntentService a;

    public WI(JobIntentService jobIntentService) {
        this.a = jobIntentService;
    }

    @Override // android.os.AsyncTask
    public final Object doInBackground(Object[] objArr) {
        ZI c0705aJ;
        while (true) {
            JobIntentService jobIntentService = this.a;
            JobServiceEngineC0801bJ jobServiceEngineC0801bJ = jobIntentService.l;
            if (jobServiceEngineC0801bJ != null) {
                synchronized (jobServiceEngineC0801bJ.b) {
                    try {
                        JobParameters jobParameters = jobServiceEngineC0801bJ.c;
                        if (jobParameters != null) {
                            JobWorkItem jobWorkItemDequeueWork = jobParameters.dequeueWork();
                            if (jobWorkItemDequeueWork != null) {
                                jobWorkItemDequeueWork.getIntent().setExtrasClassLoader(jobServiceEngineC0801bJ.a.getClassLoader());
                                c0705aJ = new C0705aJ(jobServiceEngineC0801bJ, jobWorkItemDequeueWork);
                            }
                        }
                    } finally {
                    }
                }
            } else {
                synchronized (jobIntentService.p) {
                    try {
                        c0705aJ = jobIntentService.p.size() > 0 ? (ZI) jobIntentService.p.remove(0) : null;
                    } finally {
                    }
                }
            }
            if (c0705aJ == null) {
                return null;
            }
            JobIntentService jobIntentService2 = this.a;
            c0705aJ.getIntent();
            jobIntentService2.b();
            c0705aJ.a();
        }
    }

    @Override // android.os.AsyncTask
    public final void onCancelled(Object obj) {
        this.a.c();
    }

    @Override // android.os.AsyncTask
    public final void onPostExecute(Object obj) {
        this.a.c();
    }
}
