package com.mstar.android.tv;

import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import com.mstar.android.tv.IEventClient;
import com.mstar.android.tv.ITvService;
import com.mstar.android.tv.handler.OnTvCommonEventHandler;
import com.mstar.android.tvapi.common.exception.TvCommonException;
import com.mstar.android.tvapi.common.listener.OnTvEventListener;
import com.mstar.android.tvapi.common.vo.DbSetting;
import com.mstar.android.tvapi.common.vo.EnumAtvAudioModeType;
import com.mstar.android.tvapi.common.vo.EnumAudioReturn;
import com.mstar.android.tvapi.common.vo.EnumScreenMuteType;
import com.mstar.android.tvapi.common.vo.TvOsType;
import com.mstar.android.tvapi.common.vo.TvTypeInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.BissProgramInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class TvCommonManager extends IEventClient.Stub {
    public static final int API_LEVEL_KITKAT = 19;
    public static final int API_LEVEL_LOLLIPOP = 21;
    public static final int API_LEVEL_LOLLIPOP_MR1 = 22;
    public static final int API_LEVEL_M = 23;
    public static final int API_LEVEL_N = 24;
    public static final int API_LEVEL_N_MR1 = 25;
    public static final int API_LEVEL_O = 26;
    public static final int ATV_AUDIOMODE_DUAL_A = 7;
    public static final int ATV_AUDIOMODE_DUAL_AB = 9;
    public static final int ATV_AUDIOMODE_DUAL_B = 8;
    public static final int ATV_AUDIOMODE_FORCED_MONO = 2;
    public static final int ATV_AUDIOMODE_G_STEREO = 3;
    public static final int ATV_AUDIOMODE_HIDEV_MONO = 15;
    public static final int ATV_AUDIOMODE_INVALID = 0;
    public static final int ATV_AUDIOMODE_K_STEREO = 4;
    public static final int ATV_AUDIOMODE_LEFT_LEFT = 16;
    public static final int ATV_AUDIOMODE_LEFT_RIGHT = 18;
    public static final int ATV_AUDIOMODE_MONO = 1;
    public static final int ATV_AUDIOMODE_MONO_SAP = 5;
    public static final int ATV_AUDIOMODE_NICAM_DUAL_A = 12;
    public static final int ATV_AUDIOMODE_NICAM_DUAL_AB = 14;
    public static final int ATV_AUDIOMODE_NICAM_DUAL_B = 13;
    public static final int ATV_AUDIOMODE_NICAM_MONO = 10;
    public static final int ATV_AUDIOMODE_NICAM_STEREO = 11;
    public static final int ATV_AUDIOMODE_RIGHT_RIGHT = 17;
    public static final int ATV_AUDIOMODE_STEREO_SAP = 6;
    public static final int AUDIO_RETURN_NOT_OK = 0;
    public static final int AUDIO_RETURN_OK = 1;
    public static final int AUDIO_RETURN_UNSUPPORT = 2;
    public static final int DATABASE_SETTING_STANDBY_SCAN = DbSetting.DATABASE_SETTING_STANDBY_SCAN;
    public static final int DTV_STATUS_CC_RUNNING = 2;
    public static final int DTV_STATUS_CHANNEL_CHANGE = 3;
    public static final int DTV_STATUS_PROGRAM_LOCKED = 5;
    public static final int DTV_STATUS_PVR_RUNNING = 1;
    public static final int DTV_STATUS_SOURCE_CHANGE = 4;
    public static final int DTV_STATUS_UI_EXIST = 0;
    public static final int DURATION_INDEX_10_SEC = 1;
    public static final int DURATION_INDEX_15_SEC = 2;
    public static final int DURATION_INDEX_20_SEC = 3;
    public static final int DURATION_INDEX_30_SEC = 4;
    public static final int DURATION_INDEX_5_SEC = 0;
    public static final int DURATION_INDEX_ALWAYS = 5;
    public static final int EDID_VERSION_SUPPORT = 1;
    public static final int EDID_VERSION_UNSUPPORT = 0;
    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 EV_DTV_AUTO_UPDATE_SCAN = 6001;
    public static final int EV_EPG_UPDATE = 3003;
    public static final int EV_PVR_NOTIFY_PLAYBACK_BEGIN = 15004;
    public static final int HDMI_EDID_1_4 = 1;
    public static final int HDMI_EDID_2_0 = 2;
    public static final int HDMI_EDID_DEFAULT = 0;
    public static final int INPUT_SOURCE_ATV = 1;
    public static final int INPUT_SOURCE_CVBS = 2;
    public static final int INPUT_SOURCE_CVBS2 = 3;
    public static final int INPUT_SOURCE_CVBS3 = 4;
    public static final int INPUT_SOURCE_CVBS4 = 5;
    public static final int INPUT_SOURCE_CVBS5 = 6;
    public static final int INPUT_SOURCE_CVBS6 = 7;
    public static final int INPUT_SOURCE_CVBS7 = 8;
    public static final int INPUT_SOURCE_CVBS8 = 9;
    public static final int INPUT_SOURCE_CVBS_MAX = 10;
    public static final int INPUT_SOURCE_DIV3 = 39;
    public static final int INPUT_SOURCE_DTV = 28;
    public static final int INPUT_SOURCE_DTV2 = 37;
    public static final int INPUT_SOURCE_DVI = 29;
    public static final int INPUT_SOURCE_DVI2 = 30;
    public static final int INPUT_SOURCE_DVI3 = 31;
    public static final int INPUT_SOURCE_DVI4 = 32;
    public static final int INPUT_SOURCE_DVI_MAX = 33;
    public static final int INPUT_SOURCE_GOOGLE_CAST = 44;
    public static final int INPUT_SOURCE_HDMI = 23;
    public static final int INPUT_SOURCE_HDMI2 = 24;
    public static final int INPUT_SOURCE_HDMI3 = 25;
    public static final int INPUT_SOURCE_HDMI4 = 26;
    public static final int INPUT_SOURCE_HDMI5 = 45;
    public static final int INPUT_SOURCE_HDMI6 = 46;
    public static final int INPUT_SOURCE_HDMI7 = 47;
    public static final int INPUT_SOURCE_HDMI8 = 48;
    public static final int INPUT_SOURCE_HDMI9 = 49;
    public static final int INPUT_SOURCE_HDMI_MAX = 27;
    public static final int INPUT_SOURCE_JPEG = 36;
    public static final int INPUT_SOURCE_KTV = 35;
    public static final int INPUT_SOURCE_NONE = 50;
    public static final int INPUT_SOURCE_NUM = 50;
    public static final int INPUT_SOURCE_RUV = 41;
    public static final int INPUT_SOURCE_SCALER_OP = 40;
    public static final int INPUT_SOURCE_SCART = 20;
    public static final int INPUT_SOURCE_SCART2 = 21;
    public static final int INPUT_SOURCE_SCART_MAX = 22;
    public static final int INPUT_SOURCE_STORAGE = 34;
    public static final int INPUT_SOURCE_STORAGE2 = 38;
    public static final int INPUT_SOURCE_SVIDEO = 11;
    public static final int INPUT_SOURCE_SVIDEO2 = 12;
    public static final int INPUT_SOURCE_SVIDEO3 = 13;
    public static final int INPUT_SOURCE_SVIDEO4 = 14;
    public static final int INPUT_SOURCE_SVIDEO_MAX = 15;
    public static final int INPUT_SOURCE_VGA = 0;
    public static final int INPUT_SOURCE_VGA2 = 42;
    public static final int INPUT_SOURCE_VGA3 = 43;
    public static final int INPUT_SOURCE_YPBPR = 16;
    public static final int INPUT_SOURCE_YPBPR2 = 17;
    public static final int INPUT_SOURCE_YPBPR3 = 18;
    public static final int INPUT_SOURCE_YPBPR_MAX = 19;
    public static final int MODULE_AD_SWITCH = 19;
    public static final int MODULE_ATSC_CC_ENABLE = 8;
    public static final int MODULE_ATV_CHINA_ENABLE = 13;
    public static final int MODULE_ATV_NTSC_ENABLE = 11;
    public static final int MODULE_ATV_PAL_ENABLE = 12;
    public static final int MODULE_ATV_PAL_M_ENABLE = 14;
    public static final int MODULE_BRAZIL_CC = 6;
    public static final int MODULE_CC = 5;
    public static final int MODULE_DOLBY_HDR = 24;
    public static final int MODULE_EDID_AUTO_SWITCH = 22;
    public static final int MODULE_EPG = 18;
    public static final int MODULE_FREEVIEW_AU = 4;
    public static final int MODULE_HBBTV = 16;
    public static final int MODULE_HDMITX = 15;
    public static final int MODULE_HSB = 28;
    public static final int MODULE_HSY = 29;
    public static final int MODULE_INPUT_SOURCE_LOCK = 17;
    public static final int MODULE_ISDB_CC_ENABLE = 9;
    public static final int MODULE_KOREAN_CC = 7;
    public static final int MODULE_NOT_COMPILE_FLAG_START = 4096;
    public static final int MODULE_NTSC_CC_ENABLE = 10;
    public static final int MODULE_OAD = 21;
    public static final int MODULE_OFFLINE_DETECT = 2;
    public static final int MODULE_OPEN_HDR = 23;
    public static final int MODULE_PIP = 0;
    public static final int MODULE_PREVIEW_MODE = 3;
    public static final int MODULE_SUPPORT_DOLBY_DAP = 27;
    public static final int MODULE_TRAVELING = 1;
    public static final int MODULE_TV_CONFIG_ATV_MANUAL_TUNING = 4096;
    public static final int MODULE_TV_CONFIG_AUDIO_DESCRIPTION = 4098;
    public static final int MODULE_TV_CONFIG_AUTO_HOH = 4097;
    public static final int MODULE_TV_CONFIG_SELF_DETECT = 4100;
    public static final int MODULE_TV_CONFIG_THREED_CONVERSION_AUTO = 4102;
    public static final int MODULE_TV_CONFIG_THREED_CONVERSION_CHECK_BOARD = 4105;
    public static final int MODULE_TV_CONFIG_THREED_CONVERSION_FRAME_ALTERNATIVE = 4104;
    public static final int MODULE_TV_CONFIG_THREED_CONVERSION_PIXEL_ALTERNATIVE = 4103;
    public static final int MODULE_TV_CONFIG_THREED_CONVERSION_TWODTOTHREED = 4101;
    public static final int MODULE_TV_CONFIG_THREED_DEPTH = 4099;
    public static final int MODULE_TV_CONFIG_THREED_TWOD_AUTO = 4106;
    public static final int MODULE_TV_CONFIG_THREED_TWOD_CHECK_BOARD = 4109;
    public static final int MODULE_TV_CONFIG_THREED_TWOD_FRAME_ALTERNATIVE = 4108;
    public static final int MODULE_TV_CONFIG_THREED_TWOD_PIXEL_ALTERNATIVE = 4107;
    public static final int MODULE_ULTRA_BLACK_WHITE = 26;
    public static final int MODULE_VCHIP = 20;
    public static final int MODULE_XVYCC = 25;
    public static final int NIT_UPDATE_CELL_REMOVE = 4;
    public static final int NIT_UPDATE_FREQ_CHANGE = 2;
    public static final int NIT_UPDATE_MUX_ADD = 1;
    public static final int NIT_UPDATE_MUX_REMOVE = 3;
    public static final int NIT_UPDATE_NONE = 0;
    public static final int POPUP_DIALOG_HIDE = 1;
    public static final int POPUP_DIALOG_SHOW = 0;
    public static final int SCREEN_MUTE_BLACK = 0;
    public static final int SCREEN_MUTE_BLUE = 3;
    public static final int SCREEN_MUTE_GREEN = 4;
    public static final int SCREEN_MUTE_NUM = 5;
    public static final int SCREEN_MUTE_RED = 2;
    public static final int SCREEN_MUTE_WHITE = 1;
    private static final String TAG = "TvCommonManager";
    public static final int TTS_DELAY_TIME_100MS = 100;
    public static final int TTS_DELAY_TIME_NO_DELAY = 0;
    public static final int TTS_QUEUE_ADD = 1;
    public static final int TTS_QUEUE_FLUSH = 0;
    public static final int TTS_SPEAK_PRIORITY_HIGH = 8000;
    public static final int TTS_SPEAK_PRIORITY_NORMAL = 5000;
    private static final int TV_4K_UHD_EVENT_END = 5999;
    private 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_APK_STATUS_RUNNING = 1;
    public static final int TV_APK_STATUS_START_CHECKING = 0;
    public static final int TV_ATSC_POPUP_DIALOG = 2;
    private static final int TV_DIALOG_EVENT_END = 999;
    private static final int TV_DIALOG_EVENT_START = 0;
    public static final int TV_DTV_READY_POPUP_DIALOG = 1;
    private static final int TV_EARPHONE_EVENT_END = 10999;
    private 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;
    private static final int TV_INPUT_SOURCE_EVENT_END = 7999;
    private static final int TV_INPUT_SOURCE_EVENT_START = 7000;
    private static final int TV_PREVIEW_EVENT_END = 6999;
    private 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;
    private static final int TV_RESOURCE_EVENT_END = 9999;
    private static final int TV_RESOURCE_EVENT_START = 9000;
    private static final int TV_SCART_EVENT_END = 1999;
    private static final int TV_SCART_EVENT_START = 1000;
    public static final int TV_SCART_MUTE_OSD_MODE = 1001;
    private static final int TV_SCREEN_SAVER_EVENT_END = 4999;
    private static final int TV_SCREEN_SAVER_EVENT_START = 4000;
    public static final int TV_SCREEN_SAVER_MODE = 4001;
    private static final int TV_SIGNAL_EVENT_END = 2999;
    private 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_SYSTEM_ATSC = 7;
    public static final int TV_SYSTEM_DTMB = 6;
    public static final int TV_SYSTEM_DVBC = 2;
    public static final int TV_SYSTEM_DVBS = 3;
    public static final int TV_SYSTEM_DVBS2 = 5;
    public static final int TV_SYSTEM_DVBT = 1;
    public static final int TV_SYSTEM_DVBT2 = 4;
    public static final int TV_SYSTEM_ISDB = 8;
    public static final int TV_UNITY_EVENT = 3001;
    private static final int TV_UNITY_EVENT_END = 3999;
    private static final int TV_UNITY_EVENT_START = 3000;
    static TvCommonManager mInstance;
    private static ITvCommon mService;
    private EventHandler mHandler;
    private CommonClient mTvCommonClient;
    private TvEventHandler mTvHandler;

    @Deprecated
    private ArrayList<OnTvEventListener> mTvEventListeners = new ArrayList<>();
    private ArrayList<OnDialogEventListener> mDialogEventListeners = new ArrayList<>();
    private ArrayList<OnScartEventListener> mScartEventListeners = new ArrayList<>();
    private ArrayList<OnSignalEventListener> mSignalEventListeners = new ArrayList<>();
    private ArrayList<OnEarPhoneEventListener> mEarPhoneEventListeners = new ArrayList<>();
    private ArrayList<OnUnityEventListener> mUnityEventListeners = new ArrayList<>();
    private ArrayList<OnScreenSaverEventListener> mScreenSaverEventListeners = new ArrayList<>();
    private ArrayList<On4kUhdEventListener> m4kUhdEventListeners = new ArrayList<>();
    private ArrayList<OnPreviewEventListener> mPreviewEventListeners = new ArrayList<>();
    private ArrayList<OnInputSourceEventListener> mInputSourceEventListeners = new ArrayList<>();
    private ArrayList<OnResourceEventListener> mResourceEventListeners = new ArrayList<>();
    private final HashMap<Integer, String> mModuleMapTable = new HashMap<>();
    private ArrayList<OnTvCommonEventHandler> mTvCommonEventHandlers = new ArrayList<>();

    private class CommonClient extends IEventClient.Stub {
        private CommonClient() {
        }

        @Override // com.mstar.android.tv.IEventClient
        public boolean onEvent(Message message) throws RemoteException {
            if (TvCommonManager.this.mHandler == null) {
                return false;
            }
            Message messageObtainMessage = TvCommonManager.this.mHandler.obtainMessage();
            messageObtainMessage.copyFrom(message);
            TvCommonManager.this.mHandler.sendMessage(messageObtainMessage);
            return false;
        }
    }

    private class EventHandler extends Handler {
        EventHandler(Looper looper) {
            super(looper);
        }

        @Override // android.os.Handler
        public void handleMessage(Message message) {
            if (TvCommonManager.this.mTvCommonEventHandlers != null) {
                synchronized (TvCommonManager.this.mTvCommonEventHandlers) {
                    try {
                        Iterator it = TvCommonManager.this.mTvCommonEventHandlers.iterator();
                        while (it.hasNext()) {
                            ((OnTvCommonEventHandler) it.next()).onTvCommonEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            }
        }
    }

    public interface On4kUhdEventListener {
        boolean on4kUhdEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnDialogEventListener {
        boolean onDialogEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnEarPhoneEventListener {
        boolean onEarPhoneEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnInputSourceEventListener {
        boolean onInputSourceEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnPreviewEventListener {
        boolean onPreviewEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnResourceEventListener {
        boolean onResourceEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnScartEventListener {
        boolean onScartEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnScreenSaverEventListener {
        boolean onScreenSaverEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnSignalEventListener {
        boolean onSignalEvent(int i2, int i3, int i4, Object obj);
    }

    public interface OnUnityEventListener {
        boolean onUnityEvent(int i2, int i3, int i4, Object obj);
    }

    private class TvEventHandler extends Handler {
        TvEventHandler(Looper looper) {
            super(looper);
        }

        @Override // android.os.Handler
        public void handleMessage(Message message) {
            int i2 = message.what;
            if (i2 > 0 && i2 < 999) {
                synchronized (TvCommonManager.this.mDialogEventListeners) {
                    try {
                        Iterator it = TvCommonManager.this.mDialogEventListeners.iterator();
                        while (it.hasNext()) {
                            ((OnDialogEventListener) it.next()).onDialogEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 1000 && i2 < 1999) {
                synchronized (TvCommonManager.this.mScartEventListeners) {
                    try {
                        Iterator it2 = TvCommonManager.this.mScartEventListeners.iterator();
                        while (it2.hasNext()) {
                            ((OnScartEventListener) it2.next()).onScartEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 2000 && i2 < 2999) {
                synchronized (TvCommonManager.this.mSignalEventListeners) {
                    try {
                        Iterator it3 = TvCommonManager.this.mSignalEventListeners.iterator();
                        while (it3.hasNext()) {
                            ((OnSignalEventListener) it3.next()).onSignalEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 3000 && i2 < 3999) {
                synchronized (TvCommonManager.this.mUnityEventListeners) {
                    try {
                        Iterator it4 = TvCommonManager.this.mUnityEventListeners.iterator();
                        while (it4.hasNext()) {
                            ((OnUnityEventListener) it4.next()).onUnityEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 4000 && i2 < 4999) {
                synchronized (TvCommonManager.this.mScreenSaverEventListeners) {
                    try {
                        Iterator it5 = TvCommonManager.this.mScreenSaverEventListeners.iterator();
                        while (it5.hasNext()) {
                            ((OnScreenSaverEventListener) it5.next()).onScreenSaverEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 5000 && i2 < 5999) {
                synchronized (TvCommonManager.this.m4kUhdEventListeners) {
                    try {
                        Iterator it6 = TvCommonManager.this.m4kUhdEventListeners.iterator();
                        while (it6.hasNext()) {
                            ((On4kUhdEventListener) it6.next()).on4kUhdEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else if (i2 > 6000 && i2 < 6999) {
                synchronized (TvCommonManager.this.mPreviewEventListeners) {
                    try {
                        Iterator it7 = TvCommonManager.this.mPreviewEventListeners.iterator();
                        while (it7.hasNext()) {
                            ((OnPreviewEventListener) it7.next()).onPreviewEvent(message.what, message.arg1, message.arg2, message.obj);
                        }
                    } finally {
                    }
                }
            } else {
                if (i2 > 7000 && i2 < 7999) {
                    synchronized (TvCommonManager.this.mInputSourceEventListeners) {
                        try {
                            Iterator it8 = TvCommonManager.this.mInputSourceEventListeners.iterator();
                            while (it8.hasNext()) {
                                ((OnInputSourceEventListener) it8.next()).onInputSourceEvent(message.what, message.arg1, message.arg2, message.obj);
                            }
                        } finally {
                        }
                    }
                    return;
                }
                if (i2 > 9000 && i2 < 9999) {
                    synchronized (TvCommonManager.this.mResourceEventListeners) {
                        try {
                            Iterator it9 = TvCommonManager.this.mResourceEventListeners.iterator();
                            while (it9.hasNext()) {
                                ((OnResourceEventListener) it9.next()).onResourceEvent(message.what, message.arg1, message.arg2, message.obj);
                            }
                        } finally {
                        }
                    }
                    return;
                }
                if (i2 > 10000 && i2 < 10999) {
                    synchronized (TvCommonManager.this.mEarPhoneEventListeners) {
                        try {
                            Iterator it10 = TvCommonManager.this.mEarPhoneEventListeners.iterator();
                            while (it10.hasNext()) {
                                ((OnEarPhoneEventListener) it10.next()).onEarPhoneEvent(message.what, message.arg1, message.arg2, message.obj);
                            }
                        } finally {
                        }
                    }
                    return;
                }
            }
            int i3 = message.what;
            if (i3 == 1) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it11 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it11.hasNext()) {
                            ((OnTvEventListener) it11.next()).onDtvReadyPopupDialog(message.what, message.arg1, message.arg2);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 2) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it12 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it12.hasNext()) {
                            ((OnTvEventListener) it12.next()).onAtscPopupDialog(message.what, message.arg1, message.arg2);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 1001) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it13 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it13.hasNext()) {
                            ((OnTvEventListener) it13.next()).onScartMuteOsdMode(message.what);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 3001) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it14 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it14.hasNext()) {
                            ((OnTvEventListener) it14.next()).onUnityEvent(message.what, message.arg1, message.arg2);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 4001) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it15 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it15.hasNext()) {
                            ((OnTvEventListener) it15.next()).onScreenSaverMode(message.what, message.arg1, message.arg2);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 2001) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it16 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it16.hasNext()) {
                            ((OnTvEventListener) it16.next()).onSignalUnlock(message.what);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 2002) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it17 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it17.hasNext()) {
                            ((OnTvEventListener) it17.next()).onSignalLock(message.what);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 == 10001) {
                synchronized (TvCommonManager.this.mTvEventListeners) {
                    try {
                        Iterator it18 = TvCommonManager.this.mTvEventListeners.iterator();
                        while (it18.hasNext()) {
                            ((OnTvEventListener) it18.next()).onEarPhoneInsert(message.what);
                        }
                    } finally {
                    }
                }
                return;
            }
            if (i3 != 10002) {
                Log.e(TvCommonManager.TAG, "Unknown message type " + message.what);
                return;
            }
            synchronized (TvCommonManager.this.mTvEventListeners) {
                try {
                    Iterator it19 = TvCommonManager.this.mTvEventListeners.iterator();
                    while (it19.hasNext()) {
                        ((OnTvEventListener) it19.next()).onEarPhonePullOut(message.what);
                    }
                } finally {
                }
            }
        }
    }

    private TvCommonManager() throws TvCommonException {
        this.mHandler = null;
        this.mTvHandler = null;
        BuildModuleMapTable();
        if (true == TvServiceBinder.isNeedBindService()) {
            ITvService tvService = TvServiceBinder.getTvService();
            if (tvService == null) {
                Log.e(TAG, "TvService doesn't exist!!");
                throw new TvCommonException("TvService doesn't exist.");
            }
            try {
                mService = tvService.getTvCommon();
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        } else {
            Log.d(TAG, "no need to bind service!");
            IBinder service = ServiceManager.getService("tv");
            if (service == null) {
                Log.e(TAG, "TvService doesn't exist!!");
                throw new TvCommonException("TvService doesn't exist.");
            }
            try {
                mService = ITvService.Stub.asInterface(service).getTvCommon();
            } catch (RemoteException e3) {
                e3.printStackTrace();
            }
        }
        Looper looperMyLooper = Looper.myLooper();
        if (looperMyLooper != null) {
            this.mHandler = new EventHandler(looperMyLooper);
            this.mTvHandler = new TvEventHandler(looperMyLooper);
        } else {
            Looper mainLooper = Looper.getMainLooper();
            if (mainLooper != null) {
                this.mHandler = new EventHandler(mainLooper);
                this.mTvHandler = new TvEventHandler(mainLooper);
            } else {
                this.mHandler = null;
                this.mTvHandler = null;
            }
        }
        try {
            mService.addClient("DeskTvEventListener", this);
        } catch (RemoteException e4) {
            e4.printStackTrace();
        }
        CommonClient commonClient = new CommonClient();
        this.mTvCommonClient = commonClient;
        try {
            mService.addClient("DeskTvCommonEventListener", commonClient);
        } catch (RemoteException e5) {
            e5.printStackTrace();
        }
    }

    private void BuildModuleMapTable() {
        this.mModuleMapTable.put(0, "PIP_ENABLE");
        this.mModuleMapTable.put(1, "TRAVELING_ENABLE");
        this.mModuleMapTable.put(2, "OFL_DET");
        this.mModuleMapTable.put(3, "PREVIEW_MODE_ENABLE");
        this.mModuleMapTable.put(4, "FREEVIEW_AU_ENABLE");
        this.mModuleMapTable.put(5, "CC_ENABLE");
        this.mModuleMapTable.put(6, "BRAZIL_CC_ENABLE");
        this.mModuleMapTable.put(7, "KOREAN_CC_ENABLE");
        this.mModuleMapTable.put(8, "ATSC_CC_ENABLE");
        this.mModuleMapTable.put(9, "ISDB_CC_ENABLE");
        this.mModuleMapTable.put(10, "NTSC_CC_ENABLE");
        this.mModuleMapTable.put(11, "ATV_NTSC_ENABLE");
        this.mModuleMapTable.put(12, "ATV_PAL_ENABLE");
        this.mModuleMapTable.put(13, "ATV_CHINA_ENABLE");
        this.mModuleMapTable.put(14, "ATV_PAL_M_ENABLE");
        this.mModuleMapTable.put(15, "HDMITX_ENABLE");
        this.mModuleMapTable.put(16, "HBBTV_ENABLE");
        this.mModuleMapTable.put(17, "INPUT_SOURCE_LOCK_ENABLE");
        this.mModuleMapTable.put(18, "EPG_ENABLE");
        this.mModuleMapTable.put(19, "AD_SWITCH_ENABLE");
        this.mModuleMapTable.put(20, "VCHIP_ENABLE");
        this.mModuleMapTable.put(21, "OAD_ENABLE");
        this.mModuleMapTable.put(22, "EDID_AUTO_SWITCH_ENABLE");
        this.mModuleMapTable.put(23, "OPEN_HDR_SUPPORT");
        this.mModuleMapTable.put(24, "DOLBY_HDR_SUPPORT");
        this.mModuleMapTable.put(25, "XVYCC_ENABLE");
        this.mModuleMapTable.put(26, "ULTRA_BLACK_WHITE_ENABLE");
        this.mModuleMapTable.put(27, "AU_SUPPORT_DOLBY_DAP");
        this.mModuleMapTable.put(28, "HSB_ENABLE");
        this.mModuleMapTable.put(29, "HSY_ENABLE");
        this.mModuleMapTable.put(4096, "ATV_MANUAL_TUNING_ENABLE");
        this.mModuleMapTable.put(4097, "AUTO_HOH_ENABLE");
        this.mModuleMapTable.put(4098, "AUDIO_DESCRIPTION_ENABLE");
        this.mModuleMapTable.put(4099, "THREED_DEPTH_ENABLE");
        this.mModuleMapTable.put(4100, "SELF_DETECT_ENABLE");
        this.mModuleMapTable.put(4101, "THREED_CONVERSION_TWODTOTHREED");
        this.mModuleMapTable.put(4102, "THREED_CONVERSION_AUTO");
        this.mModuleMapTable.put(4103, "THREED_CONVERSION_PIXEL_ALTERNATIVE");
        this.mModuleMapTable.put(4104, "THREED_CONVERSION_FRAME_ALTERNATIVE");
        this.mModuleMapTable.put(4105, "THREED_CONVERSION_CHECK_BOARD");
        this.mModuleMapTable.put(4106, "THREED_TWOD_AUTO");
        this.mModuleMapTable.put(4107, "THREED_TWOD_PIXEL_ALTERNATIVE");
        this.mModuleMapTable.put(4108, "THREED_TWOD_FRAME_ALTERNATIVE");
        this.mModuleMapTable.put(4109, "THREED_TWOD_CHECK_BOARD");
    }

    public static int getEnvOptions(int i2) {
        try {
            return com.mstar.android.tvapi.common.TvManager.getInstance().getEnvOptions(i2);
        } catch (TvCommonException e2) {
            e2.printStackTrace();
            return 3;
        }
    }

    public static TvCommonManager getInstance() {
        if (mInstance == null) {
            synchronized (TvCommonManager.class) {
                if (mInstance == null) {
                    try {
                        mInstance = new TvCommonManager();
                    } catch (TvCommonException e2) {
                        e2.printStackTrace();
                        return null;
                    }
                }
            }
        }
        return mInstance;
    }

    public boolean[] GetInputSourceStatus() {
        try {
            return mService.GetInputSourceStatus();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public void OSD_Set3Dformat(int i2) {
        SystemProperties.set("mstar.desk-display-mode", String.valueOf(i2));
    }

    public void clearProgramBISSKeyByNumber(int i2, int i3) {
        try {
            mService.clearProgramBISSKeyByNumber(i2, i3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void closeSurfaceView() throws RemoteException {
        try {
            mService.closeSurfaceView();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean disableTvosIr() {
        try {
            mService.disableTvosIr();
            return false;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableBlockKeys(boolean z2, boolean z3) {
        try {
            return mService.enableBlockKeys(z2, z3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void enterSleepMode(boolean z2, boolean z3) {
        Log.d(TAG, "enterSleepMode paras bMode = " + z2 + ", bNoSignalPwDn" + z3);
        try {
            mService.enterSleepMode(z2, z3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    protected void finalize() throws Throwable {
        Log.d(TAG, "finalize TvCommonManager ");
        try {
            mService.removeClient("DeskTvEventListener", this);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
        CommonClient commonClient = this.mTvCommonClient;
        if (commonClient != null) {
            try {
                mService.removeClient("DeskTvCommonEventListener", commonClient);
            } catch (RemoteException e3) {
                e3.printStackTrace();
            }
            this.mTvCommonClient = null;
        }
    }

    public int getATVMtsMode() {
        int atvMtsMode;
        try {
            atvMtsMode = mService.getAtvMtsMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            atvMtsMode = 0;
        }
        Log.d(TAG, "getATVMtsMode(), ret = " + atvMtsMode);
        return atvMtsMode;
    }

    public int getATVSoundMode() {
        int atvSoundMode;
        try {
            atvSoundMode = mService.getAtvSoundMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            atvSoundMode = 0;
        }
        Log.d(TAG, "getATVSoundMode(), ret = " + atvSoundMode);
        return atvSoundMode;
    }

    public List<BissProgramInfo> getAllBISSProgramInfo() {
        try {
            return mService.getAllBISSProgramInfo();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    @Deprecated
    public EnumAtvAudioModeType getAtvMtsMode() {
        return EnumAtvAudioModeType.values()[getATVMtsMode()];
    }

    @Deprecated
    public EnumAtvAudioModeType getAtvSoundMode() {
        return EnumAtvAudioModeType.values()[getATVSoundMode()];
    }

    public boolean getBlueScreenMode() {
        try {
            return mService.getBlueScreenMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    @Deprecated
    public TvOsType.EnumInputSource getCurrentInputSource() {
        try {
            return TvOsType.EnumInputSource.values()[mService.getCurrentInputSource()];
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    @Deprecated
    public TvOsType.EnumInputSource getCurrentSubInputSource() {
        TvOsType.EnumInputSource enumInputSource = null;
        try {
            enumInputSource = TvOsType.EnumInputSource.values()[mService.getCurrentSubInputSource()];
            Log.d(TAG, "getCurrentSubInputSource, return EnumInputSource " + enumInputSource);
            return enumInputSource;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return enumInputSource;
        }
    }

    public int getCurrentTvInputSource() {
        int currentInputSource = 50;
        try {
            currentInputSource = mService.getCurrentInputSource();
            Log.d(TAG, "getCurrentTvInputSource, src = " + currentInputSource);
            return currentInputSource;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return currentInputSource;
        }
    }

    public int getCurrentTvMainInputSource() {
        try {
            return mService.getCurrentMainInputSource();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 50;
        }
    }

    public int getCurrentTvSubInputSource() {
        try {
            return mService.getCurrentSubInputSource();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 50;
        }
    }

    public int getCurrentTvSystem() {
        try {
            return mService.getCurrentTvSystem();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public DbSetting getDatabaseSetting(int i2) {
        try {
            return mService.getDatabaseSetting(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public boolean getHdmiEdidAutoSwitch() {
        try {
            return mService.getHdmiEdidAutoSwitch();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int getHdmiEdidVersion() {
        try {
            return mService.getHdmiEdidVersion();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int getHdmiEdidVersionBySource(int i2) {
        try {
            return mService.getHdmiEdidVersionBySource(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int[] getHdmiEdidVersionList() {
        try {
            return mService.getHdmiEdidVersionList();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public boolean[] getHdmiTypeCPort() {
        try {
            return mService.getHdmiTypeCPort();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public boolean getInputSourceLock(int i2) {
        try {
            return mService.getInputSourceLock(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int getOsdDuration() {
        try {
            return mService.getOsdDuration();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public int getOsdLanguage() {
        try {
            return mService.getOsdLanguage();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 6;
        }
    }

    public int getOsdTimeoutInSecond() {
        try {
            return mService.getOsdTimeoutInSecond();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public boolean getPowerOnAVMute() {
        try {
            return mService.getPowerOnAVMute();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public TvOsType.EnumInputSource getPowerOnSource() {
        TvOsType.EnumInputSource enumInputSource = null;
        try {
            enumInputSource = TvOsType.EnumInputSource.values()[mService.getPowerOnSource()];
            Log.d(TAG, "getPowerOnSource, return EnumInputSource " + enumInputSource);
            return enumInputSource;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return enumInputSource;
        }
    }

    public int getSourceIdentState() {
        try {
            return mService.getSourceIdentState();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int[] getSourceList() {
        try {
            return mService.getSourceList();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public int getSourcePreviewState() {
        try {
            return mService.getSourcePreviewState();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int getSourceSwitchState() {
        try {
            return mService.getSourceSwitchState();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int getSubtitlePrimaryLanguage() {
        try {
            return mService.getSubtitlePrimaryLanguage();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 6;
        }
    }

    public int getSubtitleSecondaryLanguage() {
        try {
            return mService.getSubtitleSecondaryLanguage();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 6;
        }
    }

    public int getTtsSetting() {
        try {
            return mService.getTtsSetting();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public TvTypeInfo getTvInfo() {
        try {
            return mService.getTvInfo();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public void initTtsManager() {
        try {
            mService.initTtsManager();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean isCurrentSourceEqualToDatabase() {
        try {
            return mService.isCurrentSourceEqualToDatabase();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean isHdmiSignalMode() {
        try {
            return mService.isHdmiSignalMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean isSignalStable(int i2) {
        Log.d(TAG, "isSignalStable");
        try {
            return mService.isSignalStable(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean isSubtitleEnable() {
        try {
            return mService.isSubtitleEnable();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean isSupportModule(int i2) {
        try {
            if (this.mModuleMapTable.containsKey(Integer.valueOf(i2))) {
                String str = this.mModuleMapTable.get(Integer.valueOf(i2));
                if (i2 >= 4096) {
                    z = mService.getAndroidConfigSetting(str) > 0;
                    Log.d(TAG, "isSupportModule:" + i2 + " = " + z);
                    return z;
                }
                String compilerFlag = mService.getCompilerFlag(str);
                int i3 = compilerFlag.length() > 0 ? Integer.parseInt(compilerFlag) : 0;
                boolean z2 = mService.getAndroidConfigSetting(str) > 0;
                if (i3 == 0 || !z2) {
                    z = false;
                }
                Log.d(TAG, "isSupportModule:" + i2 + " = " + z + ", value = " + i3 + ", AN config = " + z2);
                return z;
            }
        } catch (RemoteException e2) {
            e2.printStackTrace();
        } catch (NumberFormatException e3) {
            e3.printStackTrace();
        }
        return false;
    }

    @Override // com.mstar.android.tv.IEventClient
    public boolean onEvent(Message message) throws RemoteException {
        TvEventHandler tvEventHandler = this.mTvHandler;
        if (tvEventHandler == null) {
            return true;
        }
        Message messageObtainMessage = tvEventHandler.obtainMessage();
        messageObtainMessage.copyFrom(message);
        this.mTvHandler.sendMessage(messageObtainMessage);
        return true;
    }

    public void openSurfaceView(int i2, int i3, int i4, int i5) throws RemoteException {
        try {
            mService.openSurfaceView(i2, i3, i4, i5);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean processTvAsyncCommand() {
        try {
            return mService.processTvAsyncCommand();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void rebootSystem(String str) {
        try {
            mService.rebootSystem(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void recoverySystem(String str) {
        try {
            mService.recoverySystem(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean registerOn4kUhdEventListener(On4kUhdEventListener on4kUhdEventListener) {
        Log.d(TAG, "registerOn4kUhdEventListener");
        synchronized (this.m4kUhdEventListeners) {
            this.m4kUhdEventListeners.add(on4kUhdEventListener);
        }
        return true;
    }

    public boolean registerOnDialogEventListener(OnDialogEventListener onDialogEventListener) {
        Log.d(TAG, "registerOnDialogEventListener");
        synchronized (this.mDialogEventListeners) {
            this.mDialogEventListeners.add(onDialogEventListener);
        }
        return true;
    }

    public boolean registerOnEarPhoneEventListener(OnEarPhoneEventListener onEarPhoneEventListener) {
        Log.d(TAG, "registerOnEarPhoneEventListener");
        synchronized (this.mEarPhoneEventListeners) {
            this.mEarPhoneEventListeners.add(onEarPhoneEventListener);
        }
        return true;
    }

    public boolean registerOnInputSourceEventListener(OnInputSourceEventListener onInputSourceEventListener) {
        Log.d(TAG, "registerOnInputSourceEventListener");
        synchronized (this.mInputSourceEventListeners) {
            this.mInputSourceEventListeners.add(onInputSourceEventListener);
        }
        return true;
    }

    public boolean registerOnPreviewEventListener(OnPreviewEventListener onPreviewEventListener) {
        Log.d(TAG, "registerOnPreviewEventListener");
        synchronized (this.mPreviewEventListeners) {
            this.mPreviewEventListeners.add(onPreviewEventListener);
        }
        return true;
    }

    public boolean registerOnResourceEventListener(OnResourceEventListener onResourceEventListener) {
        Log.d(TAG, "registerOnResourceEventListener");
        synchronized (this.mResourceEventListeners) {
            this.mResourceEventListeners.add(onResourceEventListener);
        }
        return true;
    }

    public boolean registerOnScartEventListener(OnScartEventListener onScartEventListener) {
        Log.d(TAG, "registerOnScartEventListener");
        synchronized (this.mScartEventListeners) {
            this.mScartEventListeners.add(onScartEventListener);
        }
        return true;
    }

    public boolean registerOnScreenSaverEventListener(OnScreenSaverEventListener onScreenSaverEventListener) {
        Log.d(TAG, "registerOnScreenSaverEventListener");
        synchronized (this.mScreenSaverEventListeners) {
            this.mScreenSaverEventListeners.add(onScreenSaverEventListener);
        }
        return true;
    }

    public boolean registerOnSignalEventListener(OnSignalEventListener onSignalEventListener) {
        Log.d(TAG, "registerOnSignalEventListener");
        synchronized (this.mSignalEventListeners) {
            this.mSignalEventListeners.add(onSignalEventListener);
        }
        return true;
    }

    public boolean registerOnTvCommonEventHandler(OnTvCommonEventHandler onTvCommonEventHandler) {
        synchronized (this.mTvCommonEventHandlers) {
            this.mTvCommonEventHandlers.add(onTvCommonEventHandler);
        }
        return true;
    }

    @Deprecated
    public boolean registerOnTvEventListener(OnTvEventListener onTvEventListener) {
        Log.d(TAG, "registerOnTvEventListener");
        synchronized (this.mTvEventListeners) {
            this.mTvEventListeners.add(onTvEventListener);
        }
        return true;
    }

    public boolean registerOnUnityEventListener(OnUnityEventListener onUnityEventListener) {
        Log.d(TAG, "registerOnUnityEventListener");
        synchronized (this.mUnityEventListeners) {
            this.mUnityEventListeners.add(onUnityEventListener);
        }
        return true;
    }

    public boolean resetInputSourceLock() {
        try {
            return mService.resetInputSourceLock();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int setATVMtsMode(int i2) {
        try {
            return mService.setAtvMtsMode(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public void setApkStatus(int i2) {
        try {
            mService.setApkStatus(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    @Deprecated
    public EnumAudioReturn setAtvMtsMode(EnumAtvAudioModeType enumAtvAudioModeType) {
        return EnumAudioReturn.values()[setATVMtsMode(enumAtvAudioModeType.ordinal())];
    }

    public void setBlueScreenMode(boolean z2) {
        try {
            mService.setBlueScreenMode(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setCurrentEventStatus(int i2, boolean z2) {
        try {
            mService.setCurrentEventStatus(i2, z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setDatabaseSetting(DbSetting dbSetting) {
        try {
            mService.setDatabaseSetting(dbSetting);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setDpmsWakeUpEnable(boolean z2) {
        try {
            mService.setDpmsWakeUpEnable(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean setHdmiEdidAutoSwitch(boolean z2) {
        try {
            return mService.setHdmiEdidAutoSwitch(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setHdmiEdidVersion(int i2) {
        try {
            return mService.setHdmiEdidVersion(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setHdmiEdidVersionBySource(int i2, int i3) {
        try {
            return mService.setHdmiEdidVersionBySource(i2, i3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    @Deprecated
    public void setInputSource(TvOsType.EnumInputSource enumInputSource) {
        setInputSource(enumInputSource.ordinal());
    }

    public boolean setInputSourceLock(boolean z2, int i2) {
        try {
            return mService.setInputSourceLock(z2, i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void setOsdDuration(int i2) {
        try {
            mService.setOsdDuration(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOsdLanguage(int i2) {
        try {
            mService.setOsdLanguage(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean setPdpShtf(int i2) {
        Log.d(TAG, "[siyo]setPdpShtf");
        try {
            return mService.setPdpShtf(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void setPowerOnAVMute(boolean z2) {
        try {
            mService.setPowerOnAVMute(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean setPowerOnSource(TvOsType.EnumInputSource enumInputSource) {
        Log.d(TAG, "setPowerOnSource, paras eSource = " + enumInputSource);
        try {
            return mService.setPowerOnSource(enumInputSource.ordinal());
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setProgramBISSKeyByNumber(int i2, int i3, String str, int i4) {
        try {
            return mService.setProgramBISSKeyByNumber(i2, i3, str, i4);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void setSourceIdentState(int i2) {
        try {
            mService.setSourceIdentState(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSourcePreviewState(int i2) {
        try {
            mService.setSourcePreviewState(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSourceSwitchState(int i2) {
        try {
            mService.setSourceSwitchState(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSubtitleEnable(boolean z2) {
        try {
            mService.setSubtitleEnable(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSubtitlePrimaryLanguage(int i2) {
        try {
            mService.setSubtitlePrimaryLanguage(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSubtitleSecondaryLanguage(int i2) {
        try {
            mService.setSubtitleSecondaryLanguage(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSurfaceView(int i2, int i3, int i4, int i5) throws RemoteException {
        try {
            mService.setSurfaceView(i2, i3, i4, i5);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public int setToNextATVMtsMode() {
        try {
            return mService.setToNextAtvMtsMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    @Deprecated
    public EnumAudioReturn setToNextAtvMtsMode() {
        return EnumAudioReturn.values()[setToNextATVMtsMode()];
    }

    public void setTtsSetting(int i2) {
        try {
            mService.setTtsSetting(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public int[] setTvosCommonCommand(String str) {
        try {
            return mService.setTvosCommonCommand(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

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

    public boolean set_HDMIOutMode(int i2) {
        Log.d(TAG, "[siyo]set_HDMIOutMode");
        try {
            mService.set_HDMIOutMode(i2);
            return false;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean speakTtsDelayed(String str, int i2, int i3, int i4) {
        try {
            mService.speakTtsDelayed(str, i2, i3, i4);
            return false;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void standbySystem(String str) {
        try {
            mService.standbySystem(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean stopTts() {
        try {
            return mService.stopTts();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean unregisterOn4kUhdEventListener(On4kUhdEventListener on4kUhdEventListener) {
        synchronized (this.m4kUhdEventListeners) {
            this.m4kUhdEventListeners.remove(on4kUhdEventListener);
            Log.d(TAG, "unregisterOn4kUhdEventListener  size: " + this.m4kUhdEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnDialogEventListener(OnDialogEventListener onDialogEventListener) {
        synchronized (this.mDialogEventListeners) {
            this.mDialogEventListeners.remove(onDialogEventListener);
            Log.d(TAG, "unregisterOnDialogEventListener  size: " + this.mDialogEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnEarPhoneEventListener(OnEarPhoneEventListener onEarPhoneEventListener) {
        synchronized (this.mEarPhoneEventListeners) {
            this.mEarPhoneEventListeners.remove(onEarPhoneEventListener);
            Log.d(TAG, "unregisterOnEarPhoneEventListener  size: " + this.mEarPhoneEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnInputSourceEventListener(OnInputSourceEventListener onInputSourceEventListener) {
        synchronized (this.mInputSourceEventListeners) {
            this.mInputSourceEventListeners.remove(onInputSourceEventListener);
            Log.d(TAG, "unregisterOnInputSourceEventListener  size: " + this.mInputSourceEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnPreviewEventListener(OnPreviewEventListener onPreviewEventListener) {
        synchronized (this.mPreviewEventListeners) {
            this.mPreviewEventListeners.remove(onPreviewEventListener);
            Log.d(TAG, "unregisterOnPreviewEventListener  size: " + this.mPreviewEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnResourceEventListener(OnResourceEventListener onResourceEventListener) {
        synchronized (this.mResourceEventListeners) {
            this.mResourceEventListeners.remove(onResourceEventListener);
            Log.d(TAG, "unregisterOnResourceEventListener  size: " + this.mResourceEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnScartEventListener(OnScartEventListener onScartEventListener) {
        synchronized (this.mScartEventListeners) {
            this.mScartEventListeners.remove(onScartEventListener);
            Log.d(TAG, "unregisterOnScartEventListener  size: " + this.mScartEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnScreenSaverEventListener(OnScreenSaverEventListener onScreenSaverEventListener) {
        synchronized (this.mScreenSaverEventListeners) {
            this.mScreenSaverEventListeners.remove(onScreenSaverEventListener);
            Log.d(TAG, "unregisterOnScreenSaverEventListener  size: " + this.mScreenSaverEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnSignalEventListener(OnSignalEventListener onSignalEventListener) {
        synchronized (this.mSignalEventListeners) {
            this.mSignalEventListeners.remove(onSignalEventListener);
            Log.d(TAG, "unregisterOnSignalEventListener  size: " + this.mSignalEventListeners.size());
        }
        return true;
    }

    public synchronized boolean unregisterOnTvCommonEventHandler(OnTvCommonEventHandler onTvCommonEventHandler) {
        synchronized (this.mTvCommonEventHandlers) {
            this.mTvCommonEventHandlers.remove(onTvCommonEventHandler);
        }
        return true;
    }

    @Deprecated
    public boolean unregisterOnTvEventListener(OnTvEventListener onTvEventListener) {
        synchronized (this.mTvEventListeners) {
            this.mTvEventListeners.remove(onTvEventListener);
            Log.d(TAG, "unregisterOnTvEventListener  size: " + this.mTvEventListeners.size());
        }
        return true;
    }

    public boolean unregisterOnUnityEventListener(OnUnityEventListener onUnityEventListener) {
        synchronized (this.mUnityEventListeners) {
            this.mUnityEventListeners.remove(onUnityEventListener);
            Log.d(TAG, "unregisterOnUnityEventListener  size: " + this.mUnityEventListeners.size());
        }
        return true;
    }

    public void updateSystem(String str) {
        try {
            mService.updateSystem(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setInputSource(int i2) {
        Log.d(TAG, "setInputSource, paras source = " + i2);
        try {
            mService.setInputSource(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean setVideoMute(boolean z2, int i2, int i3, int i4) {
        Log.d(TAG, "setVideoMute");
        try {
            return mService.setVideoMute(z2, i2, i3, i4);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }
}
