package com.mstar.android.tv;

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

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

    private TvHbbTVManager() {
    }

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

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

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

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

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

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

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

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

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