package com.seewo.ota.update.device.model.vman;

import android.content.Context;
import android.util.Log;
import androidx.annotation.Keep;
import com.cvte.vman.entity.EntityFwMcu;
import com.cvte.vman.impl.FwUpgradeManager;
import com.google.gson.reflect.TypeToken;
import com.seewo.ota.R;
import com.seewo.ota.util.v;
import com.seewo.ota.v.s.s.q0;
import com.seewo.vcommons.data.d;
import f.e0.s;
import f.e0.t;
import f.i;
import f.u.f;
import f.z.d.g;
import f.z.d.k;
import java.util.List;

/* JADX INFO: compiled from: McuVmanUpdateTask.kt */
/* JADX INFO: loaded from: classes.dex */
@i
@Keep
public final class McuVmanUpdateTask extends BaseVmanUpdateTask<EntityFwMcu> {
    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public McuVmanUpdateTask(Context context, q0 q0Var) {
        super(context, new TypeToken<EntityFwMcu>() { // from class: com.seewo.ota.update.device.model.vman.McuVmanUpdateTask.1
        }, q0Var);
        k.e(context, "context");
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask
    public void checkVersion(List<EntityFwMcu> list) {
        k.e(list, "waitUpgradeQueue");
        List<EntityFwMcu> fwMcuList = FwUpgradeManager.getInstance().getFwMcuList();
        k.d(fwMcuList, "getInstance().fwMcuList");
        for (EntityFwMcu entityFwMcu : fwMcuList) {
            String fwVersion = FwUpgradeManager.getInstance().getFwVersion(entityFwMcu.fwMcuType);
            k.d(fwVersion, "getInstance().getFwVersion(entityFwMcu.fwMcuType)");
            String string = t.d0(fwVersion).toString();
            Log.i(getName(), "checkVersions: " + entityFwMcu + " currentVersion: '" + string + '\'');
            if (entityFwMcu.isSupportOtaUpgrade && !f.g(com.seewo.ota.util.k.a(), string) && !f.g(com.seewo.ota.util.k.a(), entityFwMcu.otaMcuBasicBinVersion) && !s.d(string, entityFwMcu.otaMcuBasicBinVersion, true)) {
                String str = entityFwMcu.otaUpgradeMcuBinPath;
                k.d(str, "entityFwMcu.otaUpgradeMcuBinPath");
                if (fileExists(str)) {
                    k.d(entityFwMcu, "entityFwMcu");
                    list.add(entityFwMcu);
                }
            }
        }
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask, com.seewo.ota.v.s.s.r0
    public String getBeforeUpdateTip() {
        String string = this.mContext.getResources().getString(R.string.before_update_mcu_tips);
        k.d(string, "mContext.resources.getSt…g.before_update_mcu_tips)");
        return string;
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask, com.seewo.ota.v.s.s.r0
    public String getUpdateTip() {
        String string = this.mContext.getString(R.string.auto_upgrade_mcu_point);
        k.d(string, "mContext.getString(R.str…g.auto_upgrade_mcu_point)");
        return string;
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask, com.seewo.ota.v.s.s.r0
    public /* bridge */ /* synthetic */ String isInExceptionalState() {
        return super.isInExceptionalState();
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask
    public boolean isSupportOtaUpgrade() {
        if (d.i("persist.sys.ota.support_mcu_upgrade", 0) != 1) {
            return true;
        }
        Log.d(getName(), "isSupportOtaUpgrade: disable by property.");
        return false;
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask
    public /* bridge */ /* synthetic */ Object upgrade(EntityFwMcu entityFwMcu, f.w.d dVar) {
        return upgrade2(entityFwMcu, (f.w.d<? super Boolean>) dVar);
    }

    public /* synthetic */ McuVmanUpdateTask(Context context, q0 q0Var, int i2, g gVar) {
        this(context, (i2 & 2) != 0 ? null : q0Var);
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask
    public boolean needReboot(EntityFwMcu entityFwMcu) {
        k.e(entityFwMcu, "entity");
        return entityFwMcu.needRebootWhenUpgraded;
    }

    /* JADX INFO: renamed from: upgrade, reason: avoid collision after fix types in other method */
    public Object upgrade2(EntityFwMcu entityFwMcu, f.w.d<? super Boolean> dVar) {
        int i2 = entityFwMcu.fwMcuType;
        String str = entityFwMcu.otaUpgradeMcuBinPath;
        k.d(str, "entity.otaUpgradeMcuBinPath");
        return v.a(i2, str, dVar);
    }
}
