package com.mstar.android.tv;

import android.os.RemoteException;
import android.text.format.Time;
import android.util.Log;
import com.mstar.android.tvapi.dtv.vo.OadCustomerInfo;

/* JADX INFO: loaded from: classes.dex */
public class TvOadManager {
    public static final int OAD_DOWNLOAD_FINISH = 65535;
    public static final int OAD_UI_TYPE_CH_CHANGE = 2;
    public static final int OAD_UI_TYPE_DOWNLOAD = 6;
    public static final int OAD_UI_TYPE_DOWNLOAD_CONFIRM = 1;
    public static final int OAD_UI_TYPE_OAD_SCAN = 5;
    public static final int OAD_UI_TYPE_OAD_SCAN_CONFIRM = 4;
    public static final int OAD_UI_TYPE_SCH = 3;
    public static final int OAD_VERSION_TYPE_TS = 0;
    public static final int OAD_VERSION_TYPE_TV = 1;
    private static final String TAG = "TvOadManager";
    static TvOadManager mInstance;
    private static ITvOad mService;

    private TvOadManager() {
    }

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

    private static ITvOad getService() {
        ITvOad iTvOad = mService;
        if (iTvOad != null) {
            return iTvOad;
        }
        if (true == TvServiceBinder.isNeedBindService()) {
            ITvService tvService = TvServiceBinder.getTvService();
            if (tvService == null) {
                Log.e(TAG, "TvService doesn't exist!!");
                throw new NullPointerException("TvService doesn't exist.");
            }
            try {
                mService = tvService.getTvOad();
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        } else {
            mService = TvManager.getInstance().getTvOad();
        }
        return mService;
    }

    public boolean getOadActiveStandbyMode() {
        try {
            return getService().getOadActiveStandbyMode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public Time getOadBroadcastEndTime() {
        ITvOad service = getService();
        try {
            Time time = new Time();
            time.set(service.getOadBroadcastEndTime());
            return time;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public Time getOadBroadcastStartTime() {
        ITvOad service = getService();
        try {
            Time time = new Time();
            time.set(service.getOadBroadcastStartTime());
            return time;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public OadCustomerInfo getOadCustomerInfo() {
        try {
            return getService().getOadCustomerInfo();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

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

    public int getOadTime() {
        try {
            return getService().getOadTime();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

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

    public int getOadVersion(int i2) {
        try {
            return getService().getOadVersion(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public boolean getOadViewerPrompt() {
        try {
            return getService().getOadViewerPrompt();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int getSoftwareUpdateState() {
        try {
            return getService().getSoftwareUpdateState();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public boolean resetForOadUpgrade() {
        try {
            return getService().resetForOadUpgrade();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean resetOad() {
        try {
            return getService().resetOad();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void setOadOff() {
        try {
            getService().setOadOff();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOadOn() {
        try {
            getService().setOadOn();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOadScanTime(int i2) {
        try {
            getService().setOadScanTime(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOadTime(int i2) {
        try {
            getService().setOadTime(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOadViewerPrompt(boolean z2) {
        try {
            getService().setOadViewerPrompt(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setOadWakeUpTime(int i2) {
        try {
            getService().setOadWakeUpTime(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setSoftwareUpdateState(int i2) {
        try {
            getService().setSoftwareUpdateState(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean standbyCheck() {
        try {
            return getService().standbyCheck();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean standbyForOadUpgrade() {
        try {
            return getService().standbyForOadUpgrade();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void startAutoOadScan() {
        try {
            getService().startAutoOadScan();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void startOad() {
        try {
            getService().startOad();
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean startOadInStandby() {
        try {
            return getService().startOadInStandby();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void stopOad(boolean z2) {
        try {
            getService().stopOad(z2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }
}
