package com.mstar.android.tvapi.common;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.SystemProperties;
import android.util.Log;
import com.mstar.android.tvapi.common.exception.TvCommonException;
import com.mstar.android.tvapi.common.listener.OnEventListener;
import com.mstar.android.tvapi.common.listener.OnTvEventListener;
import com.mstar.android.tvapi.common.vo.DTVSpecificProgInfo;
import com.mstar.android.tvapi.common.vo.DivxDrmRegistrationInfo;
import com.mstar.android.tvapi.common.vo.EnumDrmOpMode;
import com.mstar.android.tvapi.common.vo.EnumPowerOnLogoMode;
import com.mstar.android.tvapi.common.vo.EnumPowerOnMusicMode;
import com.mstar.android.tvapi.common.vo.EnumScreenMuteType;
import com.mstar.android.tvapi.common.vo.EnumStrCommandType;
import com.mstar.android.tvapi.common.vo.EnumUrsaUpgradeStatus;
import com.mstar.android.tvapi.common.vo.TvOsType;
import com.mstar.android.tvapi.common.vo.TvTypeInfo;
import com.mstar.android.tvapi.common.vo.UsbUpgradeCfg;
import com.mstar.android.tvapi.dtv.dvb.HbbTVManager;
import com.mstar.android.tvapi.dtv.dvb.isdb.GingaManager;
import com.mstar.android.tvapi.dtv.dvb.vo.EnumDvbSystemType;
import com.mstar.android.tvapi.factory.FactoryManager;
import java.lang.ref.WeakReference;
import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public class TvManager {
    public static final int ENV_OPTIONS_ATTR_AN_SRI_EN = 4;
    public static final int ENV_OPTIONS_RESULT_ERROR = 3;
    public static final int ENV_OPTIONS_RESULT_FALSE = 1;
    public static final int ENV_OPTIONS_RESULT_OK = 2;
    public static final int ENV_OPTIONS_RESULT_TRUE = 0;
    public static final int SETTING_CHANGE_AUDIO_SPDIF_MODE_CHANGE = 2;
    public static final int SETTING_CHANGE_AUDIO_TYPE_CHANGE = 6;
    public static final int SETTING_CHANGE_HEARING_IMPAIRED_CHANGE = 4;
    public static final int SETTING_CHANGE_PRIMARY_AUDIO_LANG_CHANGE = 0;
    public static final int SETTING_CHANGE_PRIMARY_SUBTITLE_LANG_CHANGE = 3;
    public static final int SETTING_CHANGE_SECONDARY_AUDIO_LANG_CHANGE = 1;
    public static final int SETTING_CHANGE_SECONDARY_SUBTITLE_LANG_CHANGE = 4;
    public static final int SETTING_CHANGE_SUBTITLE_OPTION_CHANGE = 5;
    public static final int STR_CMD_SET_LAST_INPUT_SOURCE = 1;
    public static final int STR_CMD_SET_MAX_CNT = 0;
    public static final int STR_CMD_SET_STATUS = 2;
    public static final int STR_STATUS_NORMAL = 0;
    public static final int STR_STATUS_POST_RESUME = 5;
    public static final int STR_STATUS_PRE_SUSPEND = 4;
    public static final int STR_STATUS_RESUMING = 3;
    public static final int STR_STATUS_SUSPENDING = 1;
    public static final int STR_STATUS_WAITINGOFF = 2;
    private static final String TAG = "TvManager";
    public static final int TV_4K_UHD_EVENT_END = 5999;
    public static final int TV_4K_UHD_EVENT_START = 5000;
    public static final int TV_4K_UHD_HDMI_DISABLE_DUAL_VIEW = 5003;
    public static final int TV_4K_UHD_HDMI_DISABLE_PIP = 5001;
    public static final int TV_4K_UHD_HDMI_DISABLE_POP = 5002;
    public static final int TV_4K_UHD_HDMI_DISABLE_TRAVELING_MODE = 5004;
    public static final int TV_ATSC_POPUP_DIALOG = 2;
    public static final int TV_DIALOG_EVENT_END = 999;
    public static final int TV_DIALOG_EVENT_START = 0;
    public static final int TV_DTV_READY_POPUP_DIALOG = 1;
    public static final int TV_EARPHONE_EVENT_END = 10999;
    public static final int TV_EARPHONE_EVENT_START = 10000;
    public static final int TV_EARPHONE_INSERT = 10001;
    public static final int TV_EARPHONE_PULL_OUT = 10002;
    public static final int TV_INPUT_SOURCE_CHANGED = 7001;
    public static final int TV_INPUT_SOURCE_EVENT_END = 7999;
    public static final int TV_INPUT_SOURCE_EVENT_START = 7000;
    public static final int TV_POWER_DOWN = 8001;
    public static final int TV_POWER_EVENT_END = 8999;
    public static final int TV_POWER_EVENT_START = 8000;
    public static final int TV_PREVIEW_EVENT_END = 6999;
    public static final int TV_PREVIEW_EVENT_START = 6000;
    public static final int TV_REFRESH_PREVIEW_MODE_WINDOW = 6001;
    public static final int TV_RESOURCE_CONFLICT_POPUP_DIALOG = 9001;
    public static final int TV_RESOURCE_EVENT_END = 9999;
    public static final int TV_RESOURCE_EVENT_START = 9000;
    public static final int TV_SCART_EVENT_END = 1999;
    public static final int TV_SCART_EVENT_START = 1000;
    public static final int TV_SCART_MUTE_OSD_MODE = 1001;
    public static final int TV_SCREEN_SAVER_EVENT_END = 4999;
    public static final int TV_SCREEN_SAVER_EVENT_START = 4000;
    public static final int TV_SCREEN_SAVER_MODE = 4001;
    public static final int TV_SIGNAL_EVENT_END = 2999;
    public static final int TV_SIGNAL_EVENT_START = 2000;
    public static final int TV_SIGNAL_LOCK = 2002;
    public static final int TV_SIGNAL_UNLOCK = 2001;
    public static final int TV_UNITY_EVENT = 3001;
    public static final int TV_UNITY_EVENT_END = 3999;
    public static final int TV_UNITY_EVENT_START = 3000;
    private static TvManager sTvManager;
    private EventHandler mEventHandler;
    private long mNativeContext;
    private OnEventListener mOnEventListener;
    private OnTvEventListener mOnTvEventListener;
    private long mTvManagerContext;
    private final int MAIN_WINDOW = 0;
    private OnRefreshPreviewModeWindowListener mOnRefreshPreviewModeWindowListener = null;

    private class EventHandler extends Handler {
        private TvManager mTvManager;

        public EventHandler(TvManager tvManager, Looper looper) {
            super(looper);
            this.mTvManager = tvManager;
        }

        @Override // android.os.Handler
        public void handleMessage(Message message) {
            if (this.mTvManager.mNativeContext == 0) {
            }
            if (TvManager.this.mOnEventListener != null) {
                TvManager.this.mOnEventListener.onEvent(message);
                return;
            }
            int i2 = message.what;
            if (i2 == 1) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onDtvReadyPopupDialog(message.what, message.arg1, message.arg2);
                    return;
                }
                return;
            }
            if (i2 == 2) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onAtscPopupDialog(message.what, message.arg1, message.arg2);
                    return;
                }
                return;
            }
            if (i2 == 1001) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onScartMuteOsdMode(message.what);
                    return;
                }
                return;
            }
            if (i2 == 3001) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onUnityEvent(message.what, message.arg1, message.arg2);
                    return;
                }
                return;
            }
            if (i2 == 4001) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onScreenSaverMode(message.what, message.arg1, message.arg2);
                    return;
                }
                return;
            }
            if (i2 == 6001) {
                if (TvManager.this.mOnRefreshPreviewModeWindowListener != null) {
                    TvManager.this.mOnRefreshPreviewModeWindowListener.onRefreshPreviewModeWindow(message.what, message.arg1, message.arg2);
                    return;
                }
                return;
            }
            if (i2 == 2001) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onSignalUnlock(message.what);
                    return;
                }
                return;
            }
            if (i2 == 2002) {
                if (TvManager.this.mOnTvEventListener != null) {
                    TvManager.this.mOnTvEventListener.onSignalLock(message.what);
                    return;
                }
                return;
            }
            switch (i2) {
                case 5001:
                    if (TvManager.this.mOnTvEventListener != null) {
                        TvManager.this.mOnTvEventListener.on4k2kHDMIDisablePip(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 5002:
                    if (TvManager.this.mOnTvEventListener != null) {
                        TvManager.this.mOnTvEventListener.on4k2kHDMIDisablePop(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 5003:
                    if (TvManager.this.mOnTvEventListener != null) {
                        TvManager.this.mOnTvEventListener.on4k2kHDMIDisableDualView(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 5004:
                    if (TvManager.this.mOnTvEventListener != null) {
                        TvManager.this.mOnTvEventListener.on4k2kHDMIDisableTravelingMode(message.what, message.arg1, message.arg2);
                    }
                    break;
            }
        }
    }

    public interface OnRefreshPreviewModeWindowListener {
        void onRefreshPreviewModeWindow(int i2, int i3, int i4);
    }

    static {
        try {
            System.loadLibrary("tvmanager_jni");
            native_init();
        } catch (UnsatisfiedLinkError e2) {
            System.err.println("Cannot load tvmanager_jni library:\n" + e2.toString());
        }
        sTvManager = null;
    }

    protected TvManager() {
        Looper looperMyLooper = Looper.myLooper();
        if (looperMyLooper != null) {
            this.mEventHandler = new EventHandler(this, looperMyLooper);
        } else {
            Looper mainLooper = Looper.getMainLooper();
            if (mainLooper != null) {
                this.mEventHandler = new EventHandler(this, mainLooper);
            } else {
                this.mEventHandler = null;
            }
        }
        native_setup(new WeakReference(this));
    }

    private final native boolean getHdmiTypeCPort(Parcel parcel) throws TvCommonException;

    public static TvManager getInstance() {
        if (sTvManager == null) {
            synchronized (TvManager.class) {
                try {
                    if (sTvManager == null) {
                        sTvManager = new TvManager();
                    }
                } finally {
                }
            }
        }
        return sTvManager;
    }

    private native boolean native_enablePowerOnLogo(int i2) throws TvCommonException;

    private native void native_finalize();

    private native int native_getCurrentInputSource() throws TvCommonException;

    private native int native_getCurrentLanguageIndex(String str) throws TvCommonException;

    private native int native_getCurrentMainInputSource() throws TvCommonException;

    private native int native_getCurrentSubInputSource() throws TvCommonException;

    private native DivxDrmRegistrationInfo native_getDivxDrmRegistrationInformation(int i2) throws TvCommonException;

    private native int native_getEnvironmentPowerOnLogoMode() throws TvCommonException;

    private native int native_getEnvironmentPowerOnMusicMode() throws TvCommonException;

    private native int native_getRoutePathDtvType(short s2) throws TvCommonException;

    private static native void native_init();

    private native boolean native_sendStrCommand(int i2, int i3, int i4) throws TvCommonException;

    private native boolean native_setEnvironmentPowerOnLogoMode(int i2) throws TvCommonException;

    private native boolean native_setEnvironmentPowerOnMusicMode(int i2) throws TvCommonException;

    private native boolean native_setInputSource(int i2) throws TvCommonException;

    private native boolean native_setInputSource(int i2, int i3) throws TvCommonException;

    private native boolean native_setInputSource(int i2, boolean z2, boolean z3, boolean z4) throws TvCommonException;

    private native void native_setLanguage(int i2);

    private native boolean native_setPdpShtf(int i2) throws TvCommonException;

    private native boolean native_setVideoMute(boolean z2, int i2, int i3, int i4) throws TvCommonException;

    private native void native_setup(Object obj);

    private native int native_startUrsaFirmwareUpgrade(String str) throws TvCommonException;

    private static void postEventFromNative(Object obj, int i2, int i3, int i4, Object obj2) {
        EventHandler eventHandler;
        TvManager tvManager = (TvManager) ((WeakReference) obj).get();
        if (tvManager == null || (eventHandler = tvManager.mEventHandler) == null) {
            return;
        }
        tvManager.mEventHandler.sendMessage(eventHandler.obtainMessage(i2, i3, i4, obj2));
    }

    private native boolean setBackendMute(boolean z2, int i2, int i3, int i4) throws TvCommonException;

    public native boolean acquireNativeWakelock(String str) throws TvCommonException;

    public native void changeSetting(int i2) throws TvCommonException;

    public native int copyCmDb(String str, String str2) throws TvCommonException;

    public native void disableI2c(int i2) throws TvCommonException;

    public native boolean disablePowerOnLogo() throws TvCommonException;

    public native boolean disablePowerOnMusic() throws TvCommonException;

    protected native void disableScartOutRgb() throws TvCommonException;

    public native void disableTvosIr() throws TvCommonException;

    public final native boolean enableBlockKeys(boolean z2, boolean z3) throws TvCommonException;

    public native void enableI2c(int i2) throws TvCommonException;

    public boolean enablePowerOnLogo(EnumPowerOnLogoMode enumPowerOnLogoMode) throws TvCommonException {
        return native_enablePowerOnLogo(enumPowerOnLogoMode.ordinal());
    }

    public native boolean enablePowerOnMusic() throws TvCommonException;

    protected native void enableScartOutRgb() throws TvCommonException;

    public native void enterSleepMode(boolean z2, boolean z3) throws TvCommonException;

    public native void enterStrMode() throws TvCommonException;

    public native void exitStrMode() throws TvCommonException;

    protected void finalize() {
        native_finalize();
        sTvManager = null;
    }

    @Deprecated
    public void finalizeAllManager() throws Throwable {
    }

    public native boolean getAllResourcesForce(boolean z2);

    public AudioManager getAudioManager() {
        return AudioManager.getInstance();
    }

    public CecManager getCecManager() {
        return CecManager.getInstance();
    }

    public ChannelManager getChannelManager() {
        return ChannelManager.getInstance();
    }

    public native String getCompilerFlag(String str) throws TvCommonException;

    public native int getCurrentDtvRoute() throws TvCommonException;

    public TvOsType.EnumInputSource getCurrentInputSource() throws TvCommonException {
        int iNative_getCurrentInputSource = native_getCurrentInputSource();
        if (iNative_getCurrentInputSource < TvOsType.EnumInputSource.E_INPUT_SOURCE_VGA.ordinal() || iNative_getCurrentInputSource > TvOsType.EnumInputSource.E_INPUT_SOURCE_NONE.ordinal()) {
            throw new TvCommonException("native_getCurrentInputSource failed");
        }
        return TvOsType.EnumInputSource.values()[iNative_getCurrentInputSource];
    }

    public int getCurrentLanguageIndex(String str) throws TvCommonException {
        return native_getCurrentLanguageIndex(str);
    }

    public int getCurrentMainInputSource() throws TvCommonException {
        int iNative_getCurrentMainInputSource = native_getCurrentMainInputSource();
        if (iNative_getCurrentMainInputSource < TvOsType.EnumInputSource.E_INPUT_SOURCE_VGA.ordinal() || iNative_getCurrentMainInputSource > TvOsType.EnumInputSource.E_INPUT_SOURCE_NONE.ordinal()) {
            throw new TvCommonException("native_getCurrentMainInputSource failed");
        }
        return iNative_getCurrentMainInputSource;
    }

    public native DTVSpecificProgInfo getCurrentProgramSpecificInfo() throws TvCommonException;

    public TvOsType.EnumInputSource getCurrentSubInputSource() throws TvCommonException {
        int iNative_getCurrentSubInputSource = native_getCurrentSubInputSource();
        if (iNative_getCurrentSubInputSource < TvOsType.EnumInputSource.E_INPUT_SOURCE_VGA.ordinal() || iNative_getCurrentSubInputSource > TvOsType.EnumInputSource.E_INPUT_SOURCE_NONE.ordinal()) {
            throw new TvCommonException("native_getCurrentSubInputSource failed");
        }
        return TvOsType.EnumInputSource.values()[iNative_getCurrentSubInputSource];
    }

    public int getCurrentTvSystem() throws TvCommonException {
        return SystemProperties.getInt("mstar.tvsystem", 1);
    }

    public DatabaseManager getDatabaseManager() {
        return DatabaseManager.getInstance();
    }

    public native short getDefaultDisplay() throws TvCommonException;

    public DivxDrmRegistrationInfo getDivxDrmRegistrationInformation(EnumDrmOpMode enumDrmOpMode) throws TvCommonException {
        return native_getDivxDrmRegistrationInformation(enumDrmOpMode.ordinal());
    }

    public native int getEnvOptions(int i2) throws TvCommonException;

    public native String getEnvironment(String str) throws TvCommonException;

    public EnumPowerOnLogoMode getEnvironmentPowerOnLogoMode() throws TvCommonException {
        int iNative_getEnvironmentPowerOnLogoMode = native_getEnvironmentPowerOnLogoMode();
        if (iNative_getEnvironmentPowerOnLogoMode < EnumPowerOnLogoMode.E_POWERON_LOGO_DEFAULT.ordinal() || iNative_getEnvironmentPowerOnLogoMode > EnumPowerOnLogoMode.E_POWERON_LOGO_MAX.ordinal()) {
            throw new TvCommonException("get environment value for power on logomode failed \n");
        }
        return EnumPowerOnLogoMode.values()[iNative_getEnvironmentPowerOnLogoMode];
    }

    public EnumPowerOnMusicMode getEnvironmentPowerOnMusicMode() throws TvCommonException {
        int iNative_getEnvironmentPowerOnMusicMode = native_getEnvironmentPowerOnMusicMode();
        if (iNative_getEnvironmentPowerOnMusicMode < EnumPowerOnMusicMode.E_POWERON_MUSIC_OFF.ordinal() || iNative_getEnvironmentPowerOnMusicMode > EnumPowerOnMusicMode.E_POWERON_MUSIC_MAX.ordinal()) {
            throw new TvCommonException("get evironment for prowe on music mode failed");
        }
        return EnumPowerOnMusicMode.values()[iNative_getEnvironmentPowerOnMusicMode];
    }

    public FactoryManager getFactoryManager() {
        return FactoryManager.getInstance();
    }

    public native int getFrcVersion() throws TvCommonException;

    public GingaManager getGingaManager() {
        return GingaManager.getInstance();
    }

    public native int getGpioDeviceStatus(int i2) throws TvCommonException;

    public HbbTVManager getHbbTVManager() {
        return HbbTVManager.getInstance();
    }

    public native boolean getHdmiEdidAutoSwitch() throws TvCommonException;

    public native int[] getHdmiEdidVersionList() throws TvCommonException;

    public boolean[] getHdmiTypeCPort() throws TvCommonException {
        boolean[] zArr = new boolean[8];
        Arrays.fill(zArr, false);
        Parcel parcelObtain = Parcel.obtain();
        getHdmiTypeCPort(parcelObtain);
        int i2 = parcelObtain.readInt();
        Log.e(TAG, "ret = " + i2);
        if (i2 == 1) {
            int i3 = parcelObtain.readInt();
            Log.d(TAG, "num = " + i3);
            if (i3 > 0) {
                zArr = new boolean[i3];
                Arrays.fill(zArr, false);
                for (int i4 = 0; i4 < i3; i4++) {
                    zArr[i4] = parcelObtain.readInt() == 1;
                }
            }
            parcelObtain.recycle();
        }
        return zArr;
    }

    public native boolean getInputSourceLock(int i2) throws TvCommonException;

    public LogoManager getLogoManager() {
        return LogoManager.getInstance();
    }

    public MhlManager getMhlManager() {
        return MhlManager.getInstance();
    }

    public ParentalcontrolManager getParentalcontrolManager() {
        return ParentalcontrolManager.getInstance();
    }

    public PictureManager getPictureManager() {
        return PictureManager.getInstance();
    }

    public PipManager getPipManager() {
        return PipManager.getInstance();
    }

    public TvPlayer getPlayerManager() {
        return new TvPlayerImplProxy().getPlayerImplInstance();
    }

    public PvrManager getPvrManager() {
        return PvrManager.getInstance();
    }

    public EnumDvbSystemType getRoutePathDtvType(short s2) throws TvCommonException {
        int iNative_getRoutePathDtvType = native_getRoutePathDtvType(s2);
        if (iNative_getRoutePathDtvType < EnumDvbSystemType.E_DVB_System_NONE.ordinal() || iNative_getRoutePathDtvType > EnumDvbSystemType.E_DVB_System_NUM.ordinal()) {
            throw new TvCommonException("native_getRoutePathDtvType failed");
        }
        return EnumDvbSystemType.values()[iNative_getRoutePathDtvType];
    }

    public native short getSarAdcLevel(short s2) throws TvCommonException;

    public ScanManager getScanManager() {
        return new TvScanImplProxy().getScanImplInstance();
    }

    public native int getSignalStatus() throws TvCommonException;

    public native int[] getSourceList() throws TvCommonException;

    public native String getSystemBoardName() throws TvCommonException;

    public native int getSystemCurrentGammaTableNo() throws TvCommonException;

    public native String getSystemPanelName() throws TvCommonException;

    public native String getSystemSoftwareVersion() throws TvCommonException;

    public native int getSystemTotalGammaTableNo() throws TvCommonException;

    public ThreeDimensionManager getThreeDimensionManager() {
        return ThreeDimensionManager.getInstance();
    }

    public TimerManager getTimerManager() {
        return TimerManager.getInstance();
    }

    public native TvTypeInfo getTvInfo() throws TvCommonException;

    public native String getTvosInterfaceCommand() throws TvCommonException;

    public native boolean isSignalStable(int i2) throws TvCommonException;

    public native boolean isTvBootFinished() throws TvCommonException;

    public native boolean isUsbUpgradeFileValid() throws TvCommonException;

    public native boolean isUsbUpgradeFileValid(String str) throws TvCommonException;

    public native void playPowerOffMusic(String str, int i2) throws TvCommonException;

    public native void prepareReboot() throws TvCommonException;

    public native boolean processTvAsyncCommand() throws TvCommonException;

    public native short[] readFromEeprom(short s2, int i2) throws TvCommonException;

    public native short[] readFromFlashByAddr(int i2, int i3) throws TvCommonException;

    public native short[] readFromFlashByBank(int i2, int i3) throws TvCommonException;

    public native short[] readFromSpiFlashByAddress(int i2, int i3) throws TvCommonException;

    public native short[] readFromSpiFlashByBank(int i2, int i3) throws TvCommonException;

    public native void rebootSystem() throws TvCommonException;

    public native boolean releaseNativeWakelock(String str) throws TvCommonException;

    public native void releaseTvResHolder(int i2) throws TvCommonException;

    public native boolean resetForMbootUpgrade(String str) throws TvCommonException;

    public native boolean resetForNandUpgrade() throws TvCommonException;

    public native boolean resetForNetworkUpgrade() throws TvCommonException;

    public native boolean resetForUsbUpgrade(UsbUpgradeCfg usbUpgradeCfg) throws TvCommonException;

    public native boolean resetInputSourceLock() throws TvCommonException;

    public native void resetPostEvent() throws TvCommonException;

    public native boolean resetToFactoryDefault() throws TvCommonException;

    public native void saveCurrentSystemState(int i2) throws TvCommonException;

    public native int searchFileInUsb(String str, String str2) throws TvCommonException;

    public boolean sendStrCommand(int i2, int i3, int i4) throws TvCommonException {
        return native_sendStrCommand(i2, i3, i4);
    }

    public boolean setBackendMute(boolean z2, EnumScreenMuteType enumScreenMuteType, int i2, TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        return setBackendMute(z2, enumScreenMuteType.ordinal(), i2, enumInputSource.ordinal());
    }

    public native int setChannel(int i2, boolean z2) throws TvCommonException;

    public native void setDebugMode(boolean z2) throws TvCommonException;

    public native boolean setDefaultDisplay(short s2) throws TvCommonException;

    public native void setDpmsWakeUpEnable(boolean z2) throws TvCommonException;

    public native boolean setEnvironment(String str, String str2) throws TvCommonException;

    public boolean setEnvironmentPowerOnLogoMode(EnumPowerOnLogoMode enumPowerOnLogoMode) throws TvCommonException {
        return native_setEnvironmentPowerOnLogoMode(enumPowerOnLogoMode.ordinal());
    }

    public boolean setEnvironmentPowerOnMusicMode(EnumPowerOnMusicMode enumPowerOnMusicMode) throws TvCommonException {
        return native_setEnvironmentPowerOnMusicMode(enumPowerOnMusicMode.ordinal());
    }

    public native boolean setGpioDeviceStatus(int i2, boolean z2) throws TvCommonException;

    public native boolean setHdmiEdidAutoSwitch(boolean z2) throws TvCommonException;

    public native boolean setHdmiEdidVersion(int i2) throws TvCommonException;

    public boolean setInputSource(TvOsType.EnumInputSource enumInputSource, boolean z2, boolean z3, boolean z4) throws TvCommonException {
        boolean zNative_setInputSource = native_setInputSource(enumInputSource.ordinal(), z2, z3, z4);
        if (true == zNative_setInputSource) {
            Message messageObtain = Message.obtain();
            messageObtain.what = 7001;
            messageObtain.arg1 = 0;
            messageObtain.arg2 = enumInputSource.ordinal();
            this.mOnEventListener.onEvent(messageObtain);
        }
        return zNative_setInputSource;
    }

    public native boolean setInputSourceLock(boolean z2, int i2) throws TvCommonException;

    public void setLanguage(int i2) throws TvCommonException {
        native_setLanguage(i2);
    }

    public void setOnEventListener(OnEventListener onEventListener) {
        this.mOnEventListener = onEventListener;
    }

    public void setOnRefreshPreviewModeWindowListener(OnRefreshPreviewModeWindowListener onRefreshPreviewModeWindowListener) {
        this.mOnRefreshPreviewModeWindowListener = onRefreshPreviewModeWindowListener;
    }

    @Deprecated
    public void setOnTvEventListener(OnTvEventListener onTvEventListener) {
        this.mOnTvEventListener = onTvEventListener;
    }

    public boolean setPdpShtf(int i2) throws TvCommonException {
        return native_setPdpShtf(i2);
    }

    public native short[] setTvosCommonCommand(String str) throws TvCommonException;

    public native boolean setTvosInterfaceCommand(String str) throws TvCommonException;

    public boolean setVideoMute(boolean z2, EnumScreenMuteType enumScreenMuteType, int i2, TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        return native_setVideoMute(z2, enumScreenMuteType.ordinal(), i2, enumInputSource.ordinal());
    }

    public native boolean set_HDMIOutMode(int i2) throws TvCommonException;

    public EnumUrsaUpgradeStatus startUrsaFirmwareUpgrade(String str) throws TvCommonException {
        int iNative_startUrsaFirmwareUpgrade = native_startUrsaFirmwareUpgrade(str);
        if (iNative_startUrsaFirmwareUpgrade != -1) {
            return EnumUrsaUpgradeStatus.values()[iNative_startUrsaFirmwareUpgrade];
        }
        throw new TvCommonException("startUrsaFirmwareUpgrade error ");
    }

    public native boolean updateCustomerIniFile(String str, String str2) throws TvCommonException;

    public native boolean updatePanelIniFile(String str, String str2) throws TvCommonException;

    public native boolean writeToEeprom(short s2, short[] sArr) throws TvCommonException;

    public native boolean writeToFlashByAddr(int i2, short[] sArr) throws TvCommonException;

    public native boolean writeToFlashByBank(int i2, short[] sArr) throws TvCommonException;

    public native boolean writeToSpiFlashByAddress(int i2, short[] sArr) throws TvCommonException;

    public native boolean writeToSpiFlashByBank(int i2, short[] sArr) throws TvCommonException;

    @Deprecated
    public boolean sendStrCommand(EnumStrCommandType enumStrCommandType, int i2, int i3) throws TvCommonException {
        return sendStrCommand(enumStrCommandType.ordinal(), i2, i3);
    }

    public boolean setInputSource(TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        boolean zNative_setInputSource = native_setInputSource(0, enumInputSource.ordinal());
        if (true == zNative_setInputSource) {
            Message messageObtain = Message.obtain();
            messageObtain.what = 7001;
            messageObtain.arg1 = 0;
            messageObtain.arg2 = enumInputSource.ordinal();
            this.mOnEventListener.onEvent(messageObtain);
        }
        return zNative_setInputSource;
    }

    public boolean setInputSource(int i2, TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        boolean zNative_setInputSource = native_setInputSource(i2, enumInputSource.ordinal());
        if (true == zNative_setInputSource) {
            Message messageObtain = Message.obtain();
            messageObtain.what = 7001;
            messageObtain.arg1 = 0;
            messageObtain.arg2 = enumInputSource.ordinal();
            this.mOnEventListener.onEvent(messageObtain);
        }
        return zNative_setInputSource;
    }
}
