package com.google.android.gms.measurement.internal; 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.PersistableBundle; /* loaded from: classes.dex */ public final class zzkg extends zzki { private final AlarmManager zza; private zzam zzb; private Integer zzc; /* JADX INFO: Access modifiers changed from: protected */ public zzkg(zzks zzksVar) { super(zzksVar); this.zza = (AlarmManager) this.zzs.zzau().getSystemService("alarm"); } private final int zzf() { if (this.zzc == null) { String valueOf = String.valueOf(this.zzs.zzau().getPackageName()); this.zzc = Integer.valueOf((valueOf.length() != 0 ? "measurement".concat(valueOf) : new String("measurement")).hashCode()); } return this.zzc.intValue(); } private final PendingIntent zzh() { Context zzau = this.zzs.zzau(); return com.google.android.gms.internal.measurement.zzbs.zza(zzau, 0, new Intent().setClassName(zzau, "com.google.android.gms.measurement.AppMeasurementReceiver").setAction("com.google.android.gms.measurement.UPLOAD"), com.google.android.gms.internal.measurement.zzbs.zza); } private final zzam zzi() { if (this.zzb == null) { this.zzb = new zzkf(this, this.zzf.zzq()); } return this.zzb; } private final void zzj() { JobScheduler jobScheduler = (JobScheduler) this.zzs.zzau().getSystemService("jobscheduler"); if (jobScheduler != null) { jobScheduler.cancel(zzf()); } } public final void zza() { zzY(); this.zzs.zzay().zzj().zza("Unscheduling upload"); AlarmManager alarmManager = this.zza; if (alarmManager != null) { alarmManager.cancel(zzh()); } zzi().zzb(); zzj(); } @Override // com.google.android.gms.measurement.internal.zzki protected final boolean zzb() { AlarmManager alarmManager = this.zza; if (alarmManager != null) { alarmManager.cancel(zzh()); } zzj(); return false; } public final void zzd(long j) { zzY(); this.zzs.zzaw(); Context zzau = this.zzs.zzau(); if (!zzkz.zzai(zzau)) { this.zzs.zzay().zzc().zza("Receiver not registered/enabled"); } if (!zzkz.zzaj(zzau, false)) { this.zzs.zzay().zzc().zza("Service not registered/enabled"); } zza(); this.zzs.zzay().zzj().zzb("Scheduling upload, millis", Long.valueOf(j)); this.zzs.zzav().elapsedRealtime(); this.zzs.zzf(); if (j < Math.max(0L, zzdy.zzw.zza(null).longValue()) && !zzi().zze()) { zzi().zzd(j); } this.zzs.zzaw(); Context zzau2 = this.zzs.zzau(); ComponentName componentName = new ComponentName(zzau2, "com.google.android.gms.measurement.AppMeasurementJobService"); int zzf = zzf(); PersistableBundle persistableBundle = new PersistableBundle(); persistableBundle.putString("action", "com.google.android.gms.measurement.UPLOAD"); com.google.android.gms.internal.measurement.zzbt.zza(zzau2, new JobInfo.Builder(zzf, componentName).setMinimumLatency(j).setOverrideDeadline(j + j).setExtras(persistableBundle).build(), "com.google.android.gms", "UploadAlarm"); } }