package com.mstar.android.tvapi.dtv.dvb;

import android.util.Log;
import com.mstar.android.tvapi.common.exception.TvCommonException;
import java.lang.ref.WeakReference;

/* JADX INFO: loaded from: classes.dex */
public class HbbTVManager {
    private static final String LIBRARY = "hbbtvmanager_jni";
    private static final String TAG = "HbbTVManager";
    private static HbbTVManager mInstance;
    private long mNativeContext;

    static {
        try {
            System.loadLibrary(LIBRARY);
            native_init();
        } catch (UnsatisfiedLinkError e2) {
            Log.e(TAG, String.format("Cannot load %s library:%s\n", LIBRARY, e2.toString()));
        }
    }

    protected HbbTVManager() {
        try {
            native_setup(new WeakReference(this));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

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

    private final native void native_finalize();

    private static final native void native_init();

    private final native void native_setup(Object obj);

    public void finalize() throws Throwable {
        super.finalize();
        try {
            native_finalize();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        mInstance = null;
    }

    public final native boolean getHbbTVOnOff() throws TvCommonException;

    public final native boolean hbbtvKeyHandler(int i2) throws TvCommonException;

    public final native boolean isAnyHbbTVApplicationRunning() throws TvCommonException;

    public final native boolean isHbbTVEnabled() throws TvCommonException;

    public final native void setCookiesEnabledAttribute() throws TvCommonException;

    public final native boolean setHbbTVOnOff(boolean z2) throws TvCommonException;
}
