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

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Keep;
import com.cvte.vman.entity.EntityFwTouch;
import com.cvte.vman.impl.FwTouchCtrlManager;
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.i;
import f.u.f;
import f.z.d.g;
import f.z.d.k;
import java.util.List;

/* JADX INFO: compiled from: TouchVmanUpdateTask.kt */
/* JADX INFO: loaded from: classes.dex */
@i
@Keep
public final class TouchVmanUpdateTask extends BaseVmanUpdateTask<EntityFwTouch> {
    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Multi-variable type inference failed */
    public TouchVmanUpdateTask(Context context) {
        this(context, null, 2, 0 == true ? 1 : 0);
        k.e(context, "context");
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public TouchVmanUpdateTask(Context context, q0 q0Var) {
        super(context, new TypeToken<EntityFwTouch>() { // from class: com.seewo.ota.update.device.model.vman.TouchVmanUpdateTask.1
        }, q0Var);
        k.e(context, "context");
    }

    @Override // com.seewo.ota.update.device.model.vman.BaseVmanUpdateTask
    public void checkVersion(List<EntityFwTouch> list) {
        k.e(list, "waitUpgradeQueue");
        List<EntityFwTouch> fwTouchList = FwTouchCtrlManager.getInstance().getFwTouchList();
        k.d(fwTouchList, "getInstance().fwTouchList");
        for (EntityFwTouch entityFwTouch : fwTouchList) {
            Log.i(getName(), "checkVersions: " + entityFwTouch);
            if (entityFwTouch.isSupportOtaUpgrade && !f.g(com.seewo.ota.util.k.a(), entityFwTouch.touchCurrentVersion) && !f.g(com.seewo.ota.util.k.a(), entityFwTouch.otaTouchBasicBinVersion) && !TextUtils.equals(entityFwTouch.touchCurrentVersion, entityFwTouch.otaTouchBasicBinVersion)) {
                String str = entityFwTouch.otaUpgradeTouchBinPath;
                k.d(str, "entityFwTouch.otaUpgradeTouchBinPath");
                if (fileExists(str)) {
                    k.d(entityFwTouch, "entityFwTouch");
                    list.add(entityFwTouch);
                }
            }
        }
    }

    @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_touch_tips);
        k.d(string, "mContext.resources.getSt…before_update_touch_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.update_touch_panel_message);
        k.d(string, "mContext.getString(R.str…date_touch_panel_message)");
        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.disable_mcu_update", 0) == 1) {
            Log.i(getName(), "isSupportOtaUpgrade: disable by property.");
            return false;
        }
        if (this.mContext.getResources().getBoolean(R.bool.support_update_touch)) {
            return true;
        }
        Log.i(getName(), "isSupportOtaUpgrade: disable by config.");
        return false;
    }

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

    public /* synthetic */ TouchVmanUpdateTask(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(EntityFwTouch entityFwTouch) {
        k.e(entityFwTouch, "entity");
        return entityFwTouch.needRebootWhenUpgraded;
    }

    /* JADX INFO: renamed from: upgrade, reason: avoid collision after fix types in other method */
    public Object upgrade2(EntityFwTouch entityFwTouch, f.w.d<? super Boolean> dVar) {
        String str = entityFwTouch.otaUpgradeTouchBinPath;
        k.d(str, "entity.otaUpgradeTouchBinPath");
        return v.d(str, false, false, dVar, 6, null);
    }
}
