package com.mstar.android.tv;

import android.os.RemoteException;
import android.util.Log;
import com.mstar.android.tvapi.dtv.dvb.isdb.vo.GingaInfo;
import java.util.List;

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

    private TvGingaManager() {
    }

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

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

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

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

    public List<GingaInfo> getApps(String str) {
        try {
            return getService().getApps(str);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

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

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

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

    public boolean startApplication(long j2, long j3) {
        try {
            return getService().startApplication(j2, j3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

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