package com.mstar.android.tv;

import android.os.RemoteException;
import android.util.Log;

/* JADX INFO: loaded from: classes.dex */
public class TvMhlManager {
    private static final String TAG = "TvMhlManager";
    static TvMhlManager mInstance;
    private static ITvMhl mService;

    private TvMhlManager() {
    }

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

    private static ITvMhl getService() {
        ITvMhl iTvMhl = mService;
        if (iTvMhl != null) {
            return iTvMhl;
        }
        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.getTvMhl();
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        } else {
            mService = TvManager.getInstance().getTvMhl();
        }
        return mService;
    }

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

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

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

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

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

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