99 lines
3.4 KiB
Java
99 lines
3.4 KiB
Java
package com.google.android.gms.measurement.internal;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.app.AlarmManager;
|
|
import android.app.PendingIntent;
|
|
import android.app.job.JobInfo;
|
|
import android.app.job.JobScheduler;
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Build;
|
|
import android.os.PersistableBundle;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zzfk extends zzfn {
|
|
private final AlarmManager d;
|
|
private final zzy e;
|
|
private Integer f;
|
|
|
|
protected zzfk(zzfo zzfoVar) {
|
|
super(zzfoVar);
|
|
this.d = (AlarmManager) b().getSystemService("alarm");
|
|
this.e = new zzfl(this, zzfoVar.s(), zzfoVar);
|
|
}
|
|
|
|
private final int v() {
|
|
if (this.f == null) {
|
|
String valueOf = String.valueOf(b().getPackageName());
|
|
this.f = Integer.valueOf((valueOf.length() != 0 ? "measurement".concat(valueOf) : new String("measurement")).hashCode());
|
|
}
|
|
return this.f.intValue();
|
|
}
|
|
|
|
private final PendingIntent w() {
|
|
Context b = b();
|
|
return PendingIntent.getBroadcast(b, 0, new Intent().setClassName(b, "com.google.android.gms.measurement.AppMeasurementReceiver").setAction("com.google.android.gms.measurement.UPLOAD"), 0);
|
|
}
|
|
|
|
@TargetApi(24)
|
|
private final void x() {
|
|
JobScheduler jobScheduler = (JobScheduler) b().getSystemService("jobscheduler");
|
|
int v = v();
|
|
e().B().a("Cancelling job. JobID", Integer.valueOf(v));
|
|
jobScheduler.cancel(v);
|
|
}
|
|
|
|
public final void a(long j) {
|
|
r();
|
|
c();
|
|
Context b = b();
|
|
if (!zzbm.a(b)) {
|
|
e().A().a("Receiver not registered/enabled");
|
|
}
|
|
if (!zzfy.a(b, false)) {
|
|
e().A().a("Service not registered/enabled");
|
|
}
|
|
u();
|
|
long b2 = d().b() + j;
|
|
if (j < Math.max(0L, zzai.H.a().longValue()) && !this.e.c()) {
|
|
e().B().a("Scheduling upload with DelayedRunnable");
|
|
this.e.a(j);
|
|
}
|
|
c();
|
|
if (Build.VERSION.SDK_INT < 24) {
|
|
e().B().a("Scheduling upload with AlarmManager");
|
|
this.d.setInexactRepeating(2, b2, Math.max(zzai.C.a().longValue(), j), w());
|
|
return;
|
|
}
|
|
e().B().a("Scheduling upload with JobScheduler");
|
|
Context b3 = b();
|
|
ComponentName componentName = new ComponentName(b3, "com.google.android.gms.measurement.AppMeasurementJobService");
|
|
int v = v();
|
|
PersistableBundle persistableBundle = new PersistableBundle();
|
|
persistableBundle.putString("action", "com.google.android.gms.measurement.UPLOAD");
|
|
JobInfo build = new JobInfo.Builder(v, componentName).setMinimumLatency(j).setOverrideDeadline(j << 1).setExtras(persistableBundle).build();
|
|
e().B().a("Scheduling job. JobID", Integer.valueOf(v));
|
|
com.google.android.gms.internal.measurement.zzdi.a(b3, build, "com.google.android.gms", "UploadAlarm");
|
|
}
|
|
|
|
@Override // com.google.android.gms.measurement.internal.zzfn
|
|
protected final boolean s() {
|
|
this.d.cancel(w());
|
|
if (Build.VERSION.SDK_INT < 24) {
|
|
return false;
|
|
}
|
|
x();
|
|
return false;
|
|
}
|
|
|
|
public final void u() {
|
|
r();
|
|
this.d.cancel(w());
|
|
this.e.a();
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
x();
|
|
}
|
|
}
|
|
}
|