package com.google.android.gms.internal.ads;

import android.content.Context;
import android.media.AudioManager;

/* JADX INFO: loaded from: classes2.dex */
public final class f40 implements AudioManager.OnAudioFocusChangeListener {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final e40 f11014b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f11015c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f11016d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f11017e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public float f11018f = 1.0f;

    public f40(Context context, e40 e40Var) {
        this.f11013a = (AudioManager) context.getSystemService("audio");
        this.f11014b = e40Var;
    }

    public final void a() {
        boolean z10 = this.f11016d;
        e40 e40Var = this.f11014b;
        AudioManager audioManager = this.f11013a;
        if (!z10 || this.f11017e || this.f11018f <= 0.0f) {
            if (this.f11015c) {
                if (audioManager != null) {
                    this.f11015c = audioManager.abandonAudioFocus(this) == 0;
                }
                e40Var.zzq();
                return;
            }
            return;
        }
        if (this.f11015c) {
            return;
        }
        if (audioManager != null) {
            this.f11015c = audioManager.requestAudioFocus(this, 3, 2) == 1;
        }
        e40Var.zzq();
    }

    @Override // android.media.AudioManager.OnAudioFocusChangeListener
    public final void onAudioFocusChange(int i10) {
        this.f11015c = i10 > 0;
        this.f11014b.zzq();
    }
}
