package com.google.firebase.messaging;

import android.content.Context;
import android.content.Intent;
import android.util.Base64;

/* JADX INFO: loaded from: classes2.dex */
public final class j {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Object f24191c = new Object();

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static p0 f24192d;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Context f24193a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final m.a f24194b = new m.a(17);

    public j(Context context) {
        this.f24193a = context;
    }

    public static w8.t a(Context context, Intent intent, boolean z10) {
        p0 p0Var;
        synchronized (f24191c) {
            try {
                if (f24192d == null) {
                    f24192d = new p0(context);
                }
                p0Var = f24192d;
            } finally {
            }
        }
        if (!z10) {
            return p0Var.b(intent).e(new m.a(19), new oa.a(15));
        }
        if (a0.a().c(context)) {
            synchronized (m0.f24220b) {
                try {
                    m0.a(context);
                    boolean booleanExtra = intent.getBooleanExtra("com.google.firebase.iid.WakeLockHolder.wakefulintent", false);
                    intent.putExtra("com.google.firebase.iid.WakeLockHolder.wakefulintent", true);
                    if (!booleanExtra) {
                        m0.f24221c.a(m0.f24219a);
                    }
                    p0Var.b(intent).b(new androidx.core.app.e(intent, 27));
                } finally {
                }
            }
        } else {
            p0Var.b(intent);
        }
        return w8.k.e(-1);
    }

    public final w8.t b(Intent intent) {
        String stringExtra = intent.getStringExtra("gcm.rawData64");
        if (stringExtra != null) {
            intent.putExtra("rawData", Base64.decode(stringExtra, 0));
            intent.removeExtra("gcm.rawData64");
        }
        boolean zL = com.bumptech.glide.g.l();
        Context context = this.f24193a;
        boolean z10 = zL && context.getApplicationInfo().targetSdkVersion >= 26;
        boolean z11 = (intent.getFlags() & 268435456) != 0;
        if (z10 && !z11) {
            return a(context, intent, z11);
        }
        androidx.media3.datasource.c cVar = new androidx.media3.datasource.c(context, intent, 2);
        m.a aVar = this.f24194b;
        return w8.k.c(cVar, aVar).f(aVar, new i(context, intent, z11));
    }
}
