package androidx.room;

import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import com.google.android.gms.measurement.internal.y0;
import java.io.File;
import java.util.ArrayList;
import java.util.concurrent.locks.ReentrantLock;

/* JADX INFO: loaded from: classes.dex */
public final class x implements n5.p {

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f4197c;

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

    public x(y0 y0Var, String str) {
        this.f4195a = y0Var;
        com.google.android.gms.common.internal.w.checkNotEmpty(str);
        this.f4197c = str;
    }

    @Override // n5.p
    public final boolean a() {
        this.f4196b = ((ConnectivityManager) ((t5.h) this.f4198d).get()).getActiveNetwork() != null;
        try {
            ((ConnectivityManager) ((t5.h) this.f4198d).get()).registerDefaultNetworkCallback((ConnectivityManager.NetworkCallback) this.f4195a);
            return true;
        } catch (RuntimeException unused) {
            return false;
        }
    }

    @Override // n5.p
    public final void b() {
        ((ConnectivityManager) ((t5.h) this.f4198d).get()).unregisterNetworkCallback((ConnectivityManager.NetworkCallback) this.f4195a);
    }

    public final void c() {
        x4.e.e((x4.e) this.f4198d, this, false);
    }

    public final File d() {
        File file;
        synchronized (((x4.e) this.f4198d)) {
            try {
                Object obj = this.f4197c;
                if (((x4.c) obj).f34717f != this) {
                    throw new IllegalStateException();
                }
                if (!((x4.c) obj).f34716e) {
                    ((boolean[]) this.f4195a)[0] = true;
                }
                file = ((x4.c) obj).f34715d[0];
                ((x4.e) this.f4198d).f34725a.mkdirs();
            } catch (Throwable th) {
                throw th;
            }
        }
        return file;
    }

    public final void e(double d10, double d11) {
        boolean z10 = this.f4196b;
        Object obj = this.f4197c;
        double d12 = 1.0d;
        if (!z10) {
            d12 = 1.0d / (((((double[]) obj)[7] * d11) + (((double[]) obj)[3] * d10)) + ((double[]) obj)[15]);
        }
        double d13 = ((((double[]) obj)[4] * d11) + (((double[]) obj)[0] * d10) + ((double[]) obj)[12]) * d12;
        double d14 = ((((double[]) obj)[5] * d11) + (((double[]) obj)[1] * d10) + ((double[]) obj)[13]) * d12;
        Object obj2 = this.f4198d;
        if (d13 < ((double[]) obj2)[0]) {
            ((double[]) obj2)[0] = d13;
        } else if (d13 > ((double[]) obj2)[1]) {
            ((double[]) obj2)[1] = d13;
        }
        if (d14 < ((double[]) obj2)[2]) {
            ((double[]) obj2)[2] = d14;
        } else if (d14 > ((double[]) obj2)[3]) {
            ((double[]) obj2)[3] = d14;
        }
    }

    public final String f() {
        if (!this.f4196b) {
            this.f4196b = true;
            this.f4198d = ((y0) this.f4195a).F().getString((String) this.f4197c, null);
        }
        return (String) this.f4198d;
    }

    public final void g(String str) {
        SharedPreferences.Editor editorEdit = ((y0) this.f4195a).F().edit();
        editorEdit.putString((String) this.f4197c, str);
        editorEdit.apply();
        this.f4198d = str;
    }

    public x() {
        this.f4197c = new ArrayList();
        this.f4198d = null;
        this.f4195a = ma.l.f30533b;
        this.f4196b = false;
    }

    public x(xyz.stream.api.y yVar, n5.o oVar) {
        this.f4195a = new m4.e(this, 1);
        this.f4198d = yVar;
        this.f4197c = oVar;
    }

    public x(int i10) {
        this.f4197c = new ReentrantLock();
        this.f4198d = new long[i10];
        this.f4195a = new boolean[i10];
    }

    public x(io.flutter.plugin.editing.m mVar, boolean z10, double[] dArr, double[] dArr2) {
        this.f4195a = mVar;
        this.f4196b = z10;
        this.f4197c = dArr;
        this.f4198d = dArr2;
    }

    public x(x4.e eVar, x4.c cVar) {
        this.f4198d = eVar;
        this.f4197c = cVar;
        this.f4195a = cVar.f34716e ? null : new boolean[eVar.f34731g];
    }
}
