package com.google.firebase.messaging; import android.app.ActivityManager; import android.app.KeyguardManager; import android.app.NotificationManager; import android.content.Context; import android.graphics.Bitmap; import android.os.Process; import android.os.SystemClock; import android.util.Log; import androidx.core.app.m; import com.google.android.gms.common.util.PlatformVersion; import com.google.android.gms.tasks.Tasks; import com.google.firebase.messaging.d; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /* loaded from: classes2.dex */ class f { /* renamed from: a, reason: collision with root package name */ private final ExecutorService f5575a; /* renamed from: b, reason: collision with root package name */ private final Context f5576b; /* renamed from: c, reason: collision with root package name */ private final h0 f5577c; public f(Context context, h0 h0Var, ExecutorService executorService) { this.f5575a = executorService; this.f5576b = context; this.f5577c = h0Var; } private boolean b() { if (((KeyguardManager) this.f5576b.getSystemService("keyguard")).inKeyguardRestrictedInputMode()) { return false; } if (!PlatformVersion.isAtLeastLollipop()) { SystemClock.sleep(10L); } int myPid = Process.myPid(); List runningAppProcesses = ((ActivityManager) this.f5576b.getSystemService("activity")).getRunningAppProcesses(); if (runningAppProcesses == null) { return false; } for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) { if (runningAppProcessInfo.pid == myPid) { return runningAppProcessInfo.importance == 100; } } return false; } private void c(d.a aVar) { if (Log.isLoggable("FirebaseMessaging", 3)) { Log.d("FirebaseMessaging", "Showing notification"); } ((NotificationManager) this.f5576b.getSystemService("notification")).notify(aVar.f5565b, aVar.f5566c, aVar.f5564a.b()); } private d0 d() { d0 I = d0.I(this.f5577c.p("gcm.n.image")); if (I != null) { I.R(this.f5575a); } return I; } private void e(m.e eVar, d0 d0Var) { if (d0Var == null) { return; } try { Bitmap bitmap = (Bitmap) Tasks.await(d0Var.O(), 5L, TimeUnit.SECONDS); eVar.o(bitmap); eVar.w(new m.b().i(bitmap).h(null)); } catch (InterruptedException unused) { Log.w("FirebaseMessaging", "Interrupted while downloading image, showing notification without it"); d0Var.close(); Thread.currentThread().interrupt(); } catch (ExecutionException e10) { Log.w("FirebaseMessaging", "Failed to download image: " + e10.getCause()); } catch (TimeoutException unused2) { Log.w("FirebaseMessaging", "Failed to download image in time, showing notification without it"); d0Var.close(); } } boolean a() { if (this.f5577c.a("gcm.n.noui")) { return true; } if (b()) { return false; } d0 d10 = d(); d.a e10 = d.e(this.f5576b, this.f5577c); e(e10.f5564a, d10); c(e10); return true; } }