package com.seewo.factoryaging.boot;

import android.content.SharedPreferences;
import android.os.Build;
import android.util.Log;
import com.cvte.vman.VmanMiddleWare;
import com.seewo.factoryaging.FactoryAgingApplication;
import com.seewo.vcommons.data.c;
import j.i;
import j.k;
import j.p0.d.r;
import j.p0.d.s;

/* JADX INFO: compiled from: BootHelper.kt */
/* JADX INFO: loaded from: classes.dex */
public final class b {
    public static final b a = new b();
    private static final i b = k.b(a.b);

    /* JADX INFO: compiled from: BootHelper.kt */
    static final class a extends s implements j.p0.c.a<SharedPreferences> {
        public static final a b = new a();

        a() {
            super(0);
        }

        @Override // j.p0.c.a
        /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
        public final SharedPreferences invoke() {
            return FactoryAgingApplication.e.d().getApplicationContext().getSharedPreferences("boot_aging_sp", 0);
        }
    }

    private b() {
    }

    private final SharedPreferences b() {
        Object value = b.getValue();
        r.e(value, "<get-mSp>(...)");
        return (SharedPreferences) value;
    }

    public final boolean a() {
        try {
            boolean z = b().getBoolean("aging_status", false);
            Log.d("BootHelper", "getAgingStatus: " + z);
            return z;
        } catch (Exception e) {
            Log.e("BootHelper", "getAgingStatus: ", e);
            return false;
        }
    }

    public final boolean c() {
        return c.j("persist.sys.aging.auto.start", Build.VERSION.SDK_INT >= 33);
    }

    public final boolean d() {
        return c.j("sys.aging.hard.poweroff", false);
    }

    public final boolean e() {
        boolean zC = c();
        Log.d("BootHelper", "isNeedStartup: isAgingAutoStartEnable = " + zC);
        if (!zC) {
            return false;
        }
        boolean zA = a();
        Log.d("BootHelper", "isNeedStartup: agingStatus = " + zA);
        return zA;
    }

    public final void f(boolean z) {
        try {
            c.p(z);
            VmanMiddleWare.getInstance().getAudioCtrl().setBurnAudioSatus(z);
            b().edit().putBoolean("aging_status", z).apply();
            if (z) {
                return;
            }
            g(false);
        } catch (Exception e) {
            Log.e("BootHelper", "saveAgingStatus: ", e);
        }
    }

    public final boolean g(boolean z) {
        return c.r("sys.aging.hard.poweroff", String.valueOf(z));
    }
}
