package g0;

import android.media.AudioRecord;

/* JADX INFO: renamed from: g0.k, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0487k implements InterfaceC0480d {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final a f4052e = new a(null);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final C0485i f4053a = new C0485i();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private AudioRecord f4054b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private volatile boolean f4055c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private volatile boolean f4056d;

    /* JADX INFO: renamed from: g0.k$a */
    public static final class a {
        public /* synthetic */ a(kotlin.jvm.internal.g gVar) {
            this();
        }

        private a() {
        }
    }

    protected final AudioRecord a() {
        return this.f4054b;
    }

    public final boolean b() {
        return this.f4056d;
    }

    public final void c(int i2) {
        if (this.f4055c || !this.f4056d) {
            Q0.e.a("PauseAudioRecorder", "pause: already paused");
            return;
        }
        Q0.e.a("PauseAudioRecorder", "pause: reason=" + i2);
        this.f4055c = true;
        AudioRecord audioRecord = this.f4054b;
        if (audioRecord != null) {
            audioRecord.stop();
        }
    }

    public final void d() {
        if (this.f4055c) {
            this.f4055c = false;
            AudioRecord audioRecord = this.f4054b;
            if (audioRecord != null) {
                audioRecord.startRecording();
            }
        }
    }

    protected final void e(AudioRecord audioRecord) {
        this.f4054b = audioRecord;
    }

    public final void f(boolean z2) {
        this.f4056d = z2;
    }

    @Override // g0.InterfaceC0480d
    public int read(byte[] audioData, int i2, int i3) {
        kotlin.jvm.internal.l.e(audioData, "audioData");
        if (this.f4055c) {
            return this.f4053a.a(audioData, i2, i3);
        }
        return -1;
    }
}
