package com.cvte.vman.impl;

import android.os.Parcel;
import com.cvte.vman.LicenseCtrl;
import com.cvte.vman.VmanMiddleWare;
import com.cvte.vman.entity.EntityLicense;
import com.cvte.vman.instance.InvokeCmd;
import com.cvte.vman.types.EnumLicenseType;
import com.cvte.vman.utils.CLog;
import java.util.ArrayList;
import java.util.List;
import okhttp3.HttpUrl;

/* JADX INFO: loaded from: classes.dex */
public class LicenseCtrlManager extends LicenseCtrl {
    public static final String TAG = "Cvte@LicenseCtrlManager";
    private static volatile LicenseCtrlManager sInstance;

    private LicenseCtrlManager() {
    }

    public static LicenseCtrlManager getInstance() {
        if (sInstance == null) {
            synchronized (LicenseCtrlManager.class) {
                if (sInstance == null) {
                    sInstance = new LicenseCtrlManager();
                }
            }
        }
        return sInstance;
    }

    @Override // com.cvte.vman.LicenseCtrl
    public String getLicenseKey(EnumLicenseType enumLicenseType) {
        CLog.d("getLicenseKey type=" + enumLicenseType);
        String strExcuteCommandSet_Str = VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_LICENSE_CTRL_GET_KEY, enumLicenseType.ordinal());
        return strExcuteCommandSet_Str == null ? HttpUrl.FRAGMENT_ENCODE_SET : strExcuteCommandSet_Str;
    }

    @Override // com.cvte.vman.LicenseCtrl
    public List<EntityLicense> getSupportLicenseList() {
        CLog.d("getSupportLicenseList");
        ArrayList arrayList = new ArrayList();
        Parcel parcelExcuteCommandSet_Parcel = VmanMiddleWare.getInstance().excuteCommandSet_Parcel(18688);
        if (parcelExcuteCommandSet_Parcel == null) {
            CLog.e("reply is null");
            return arrayList;
        }
        parcelExcuteCommandSet_Parcel.readInt();
        int i2 = parcelExcuteCommandSet_Parcel.readInt();
        for (int i3 = 0; i3 < i2; i3++) {
            EntityLicense entityLicense = new EntityLicense();
            entityLicense.licenseType = EnumLicenseType.values()[parcelExcuteCommandSet_Parcel.readInt()];
            boolean z = true;
            entityLicense.isBurned = parcelExcuteCommandSet_Parcel.readByte() != 0;
            if (parcelExcuteCommandSet_Parcel.readByte() == 0) {
                z = false;
            }
            entityLicense.isValid = z;
            entityLicense.licenseKey = parcelExcuteCommandSet_Parcel.readString();
            arrayList.add(entityLicense);
        }
        parcelExcuteCommandSet_Parcel.recycle();
        return arrayList;
    }

    @Override // com.cvte.vman.LicenseCtrl
    public boolean isLicenseBurned(EnumLicenseType enumLicenseType) {
        CLog.d("isLicenseBurned type=" + enumLicenseType);
        return VmanMiddleWare.getInstance().excuteCommandSet_bool(InvokeCmd.CMD_LICENSE_CTRL_IS_BURNED, enumLicenseType.ordinal());
    }

    @Override // com.cvte.vman.LicenseCtrl
    public boolean isLicenseValid(EnumLicenseType enumLicenseType) {
        CLog.d("isLicenseValid type=" + enumLicenseType);
        return VmanMiddleWare.getInstance().excuteCommandSet_bool(InvokeCmd.CMD_LICENSE_CTRL_IS_VALID, enumLicenseType.ordinal());
    }
}
