84 lines
3.2 KiB
Java
84 lines
3.2 KiB
Java
package o;
|
|
|
|
import android.app.job.JobInfo;
|
|
import android.app.job.JobScheduler;
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.os.PersistableBundle;
|
|
import android.util.Base64;
|
|
import com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.Charset;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
import java.util.zip.Adler32;
|
|
import o.GwU;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class YzQ implements cNI {
|
|
private final Context b;
|
|
private final GwU d;
|
|
private final siG e;
|
|
|
|
public YzQ(Context context, siG sig, GwU gwU) {
|
|
this.b = context;
|
|
this.e = sig;
|
|
this.d = gwU;
|
|
}
|
|
|
|
@Override // o.cNI
|
|
public final void a(AbstractC3038apv abstractC3038apv, int i) {
|
|
ComponentName componentName = new ComponentName(this.b, (Class<?>) JobInfoSchedulerService.class);
|
|
JobScheduler jobScheduler = (JobScheduler) this.b.getSystemService("jobscheduler");
|
|
Adler32 adler32 = new Adler32();
|
|
adler32.update(this.b.getPackageName().getBytes(Charset.forName("UTF-8")));
|
|
adler32.update(abstractC3038apv.a().getBytes(Charset.forName("UTF-8")));
|
|
adler32.update(ByteBuffer.allocate(4).putInt(C0647Lgu.e(abstractC3038apv.c())).array());
|
|
if (abstractC3038apv.d() != null) {
|
|
adler32.update(abstractC3038apv.d());
|
|
}
|
|
int value = (int) adler32.getValue();
|
|
Iterator<JobInfo> it = jobScheduler.getAllPendingJobs().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
JobInfo next = it.next();
|
|
int i2 = next.getExtras().getInt("attemptNumber");
|
|
if (next.getId() == value) {
|
|
if (i2 >= i) {
|
|
new Object[]{abstractC3038apv};
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
long d = this.e.d(abstractC3038apv);
|
|
GwU gwU = this.d;
|
|
JobInfo.Builder builder = new JobInfo.Builder(value, componentName);
|
|
EnumC10854eQq c = abstractC3038apv.c();
|
|
builder.setMinimumLatency(gwU.a(c, d, i));
|
|
Set<GwU.RVV> c2 = gwU.c().get(c).c();
|
|
if (c2.contains(GwU.RVV.NETWORK_UNMETERED)) {
|
|
builder.setRequiredNetworkType(2);
|
|
} else {
|
|
builder.setRequiredNetworkType(1);
|
|
}
|
|
if (c2.contains(GwU.RVV.DEVICE_CHARGING)) {
|
|
builder.setRequiresCharging(true);
|
|
}
|
|
if (c2.contains(GwU.RVV.DEVICE_IDLE)) {
|
|
builder.setRequiresDeviceIdle(true);
|
|
}
|
|
PersistableBundle persistableBundle = new PersistableBundle();
|
|
persistableBundle.putInt("attemptNumber", i);
|
|
persistableBundle.putString("backendName", abstractC3038apv.a());
|
|
persistableBundle.putInt("priority", C0647Lgu.e(abstractC3038apv.c()));
|
|
if (abstractC3038apv.d() != null) {
|
|
persistableBundle.putString("extras", Base64.encodeToString(abstractC3038apv.d(), 0));
|
|
}
|
|
builder.setExtras(persistableBundle);
|
|
new Object[]{abstractC3038apv, Integer.valueOf(value), Long.valueOf(this.d.a(abstractC3038apv.c(), d, i)), Long.valueOf(d), Integer.valueOf(i)};
|
|
jobScheduler.schedule(builder.build());
|
|
}
|
|
}
|