package com.bytedance.sdk.openadsdk.dsz;

import android.content.Context;
import android.media.AudioManager;
import com.bytedance.sdk.openadsdk.utils.DeviceUtils;

/* JADX INFO: loaded from: classes2.dex */
public class vt {
    private final AudioManager fm;
    private int ro = -1;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private boolean f7381lb = false;

    public vt(Context context) {
        this.fm = (AudioManager) context.getApplicationContext().getSystemService("audio");
    }

    public int fm() {
        return this.ro;
    }

    public void fm(boolean z10) {
        fm(z10, false);
    }

    public void fm(boolean z10, boolean z11) {
        if (this.fm == null) {
            return;
        }
        int i10 = 0;
        if (z10) {
            int iWsy = DeviceUtils.wsy();
            if (iWsy != 0) {
                this.ro = iWsy;
            } else if (!z11) {
                return;
            }
            fm(3, 0, 0);
            this.f7381lb = true;
            return;
        }
        int iEf = this.ro;
        if (iEf == 0) {
            iEf = DeviceUtils.ef() / 15;
        } else {
            if (iEf == -1) {
                if (!z11) {
                    return;
                } else {
                    iEf = DeviceUtils.ef() / 15;
                }
            }
            this.ro = -1;
            fm(3, iEf, i10);
            this.f7381lb = true;
        }
        i10 = 1;
        this.ro = -1;
        fm(3, iEf, i10);
        this.f7381lb = true;
    }

    private void fm(int i10, int i11, int i12) {
        try {
            this.fm.setStreamVolume(i10, i11, i12);
        } catch (Throwable unused) {
        }
    }
}
