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.EntityFwCamera;
import com.cvte.vman.impl.CameraCtrlManager;
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: CameraVmanUpdateTask.kt */
/* JADX INFO: loaded from: classes.dex */
@i
@Keep
public final class CameraVmanUpdateTask extends BaseVmanUpdateTask<EntityFwCamera> {
    public /* synthetic */ CameraVmanUpdateTask(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 void checkVersion(List<EntityFwCamera> list) {
        k.e(list, "waitUpgradeQueue");
        List<EntityFwCamera> fwCameraList = CameraCtrlManager.getInstance().getFwCameraList();
        k.d(fwCameraList, "getInstance().fwCameraList");
        for (EntityFwCamera entityFwCamera : fwCameraList) {
            Log.i(getName(), "checkVersions: " + entityFwCamera);
            if (entityFwCamera.isSupportOtaUpgrade && !f.g(com.seewo.ota.util.k.a(), entityFwCamera.cameraCurrentVersion) && !f.g(com.seewo.ota.util.k.a(), entityFwCamera.otaCameraBasicBinVersion) && !TextUtils.equals(entityFwCamera.cameraCurrentVersion, entityFwCamera.otaCameraBasicBinVersion)) {
                String str = entityFwCamera.otaUpgradeCameraBinPath;
                k.d(str, "entityFwCamera.otaUpgradeCameraBinPath");
                if (fileExists(str)) {
                    k.d(entityFwCamera, "entityFwCamera");
                    list.add(entityFwCamera);
                }
            }
        }
    }

    @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_camera_tips);
        k.d(string, "mContext.resources.getSt…efore_update_camera_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.getResources().getString(R.string.update_camera_message);
        k.d(string, "mContext.resources.getSt…ng.update_camera_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_camera_update", 0) == 1) {
            Log.i(getName(), "isSupportOtaUpgrade: disable by property.");
            return false;
        }
        if (this.mContext.getResources().getBoolean(R.bool.support_camera_update)) {
            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(EntityFwCamera entityFwCamera, f.w.d dVar) {
        return upgrade2(entityFwCamera, (f.w.d<? super Boolean>) dVar);
    }

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

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

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