package com.ifpdos.autotest.o0;

import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.SystemProperties;
import android.util.Log;
import d.g0;
import d.i;
import d.k;
import d.n;
import d.n0.c.s;
import d.n0.c.t;
import d.q;
import d.r;

/* JADX INFO: compiled from: CommonUtil.kt */
/* JADX INFO: loaded from: classes.dex */
@n
public final class e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final e f2286a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private static boolean f2287b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private static final boolean f2288c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private static final HandlerThread f2289d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private static final i f2290e;

    /* JADX INFO: compiled from: CommonUtil.kt */
    @n
    static final class a extends t implements d.n0.b.a<Handler> {

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

        a() {
            super(0);
        }

        @Override // d.n0.b.a
        /* JADX INFO: renamed from: c, reason: merged with bridge method [inline-methods] */
        public final Handler a() {
            e.f2289d.start();
            return new Handler(e.f2289d.getLooper());
        }
    }

    /* JADX INFO: compiled from: CommonUtil.kt */
    @n
    static final class b extends t implements d.n0.b.a<g0> {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        final /* synthetic */ Context f2292d;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(Context context) {
            super(0);
            this.f2292d = context;
        }

        @Override // d.n0.b.a
        public /* bridge */ /* synthetic */ g0 a() {
            c();
            return g0.f2578a;
        }

        public final void c() {
            com.ifpdos.autotest.k0.g.b.f2053a.g(this.f2292d);
            if (e.d()) {
                com.ifpdos.autotest.okhttp.e.l(false);
            }
        }
    }

    static {
        e eVar = new e();
        f2286a = eVar;
        f2288c = f() && !eVar.c() && com.ifpdos.autotest.k0.g.d.a();
        f2289d = new HandlerThread("CommonUtil");
        f2290e = k.b(a.f2291d);
    }

    private e() {
    }

    private final Handler b() {
        return (Handler) f2290e.getValue();
    }

    public static final boolean d() {
        return f2288c;
    }

    public static final boolean e() {
        Object objA;
        try {
            q.a aVar = q.f2687c;
            String str = SystemProperties.get("persist.sys.wb.temp.mode", "");
            Log.i("CommonUtil", "isMultiTempMode prop = " + str);
            objA = q.a(Boolean.valueOf(d.s0.q.l("multi", str, true)));
        } catch (Throwable th) {
            q.a aVar2 = q.f2687c;
            objA = q.a(r.a(th));
        }
        Boolean bool = Boolean.FALSE;
        if (q.c(objA)) {
            objA = bool;
        }
        return ((Boolean) objA).booleanValue();
    }

    public static final boolean f() {
        Object objA;
        try {
            q.a aVar = q.f2687c;
            objA = q.a(Boolean.valueOf(com.ifpdos.autotest.okhttp.e.j()));
        } catch (Throwable th) {
            q.a aVar2 = q.f2687c;
            objA = q.a(r.a(th));
        }
        Boolean bool = Boolean.FALSE;
        if (q.c(objA)) {
            objA = bool;
        }
        return ((Boolean) objA).booleanValue();
    }

    public static final void h() {
        Log.i("CommonUtil", "setWbRunning");
        f2287b = true;
        SystemProperties.set("sys.wb.run.state", "1");
    }

    public static final void i(Context context) {
        s.e(context, "context");
        e eVar = f2286a;
        Log.i("CommonUtil", "stopWbRunning");
        f2287b = false;
        SystemProperties.set("sys.wb.run.state", "0");
        f.b(eVar.b(), 500L, new b(context));
    }

    public final boolean c() {
        Object objA;
        try {
            q.a aVar = q.f2687c;
            boolean z = true;
            if (SystemProperties.getInt("ro.dritect_ethernet_port", 1) == 0) {
                z = false;
            }
            objA = q.a(Boolean.valueOf(z));
        } catch (Throwable th) {
            q.a aVar2 = q.f2687c;
            objA = q.a(r.a(th));
        }
        Boolean bool = Boolean.FALSE;
        if (q.c(objA)) {
            objA = bool;
        }
        return ((Boolean) objA).booleanValue();
    }

    public final boolean g() {
        return f2287b;
    }
}
