19 package com.introlab.rtabmap;
21 import android.content.Context;
22 import android.content.Intent;
23 import android.content.ServiceConnection;
24 import android.os.Build;
25 import android.os.IBinder;
26 import android.util.Log;
51 ServiceConnection connection) {
52 Intent intent =
new Intent();
53 intent.setClassName(
"com.google.tango",
"com.google.atap.tango.TangoService");
55 boolean hasJavaService = (context.getPackageManager().resolveService(intent, 0) != null);
58 if (!hasJavaService) {
59 intent =
new Intent();
60 intent.setClassName(
"com.projecttango.tango",
"com.google.atap.tango.TangoService");
61 hasJavaService = (context.getPackageManager().resolveService(intent, 0) != null);
67 if (!hasJavaService) {
71 return context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
82 String basePath =
"/data/data/com.google.tango/libfiles/";
83 if (!(
new File(basePath).exists())) {
84 basePath =
"/data/data/com.projecttango.tango/libfiles/";
86 Log.i(
"TangoInitializationHelper",
"basePath: " + basePath);
89 System.load(basePath +
"arm64-v8a/libtango_client_api.so");
91 Log.i(
"TangoInitializationHelper",
"Success! Using arm64-v8a/libtango_client_api.");
92 }
catch (UnsatisfiedLinkError
e) {
94 if (loadedSoId < ARCH_DEFAULT) {
96 System.load(basePath +
"armeabi-v7a/libtango_client_api.so");
98 Log.i(
"TangoInitializationHelper",
"Success! Using armeabi-v7a/libtango_client_api.");
99 }
catch (UnsatisfiedLinkError e) {
102 if (loadedSoId < ARCH_DEFAULT) {
104 System.load(basePath +
"x86_64/libtango_client_api.so");
106 Log.i(
"TangoInitializationHelper",
"Success! Using x86_64/libtango_client_api.");
107 }
catch (UnsatisfiedLinkError e) {
110 if (loadedSoId < ARCH_DEFAULT) {
112 System.load(basePath +
"x86/libtango_client_api.so");
114 Log.i(
"TangoInitializationHelper",
"Success! Using x86/libtango_client_api.");
115 }
catch (UnsatisfiedLinkError e) {
118 if (loadedSoId < ARCH_DEFAULT) {
120 System.load(basePath +
"default/libtango_client_api.so");
122 Log.i(
"TangoInitializationHelper",
"Success! Using default/libtango_client_api.");
123 }
catch (UnsatisfiedLinkError e) {
126 if (loadedSoId < ARCH_DEFAULT) {
128 System.loadLibrary(
"tango_client_api");
130 Log.i(
"TangoInitializationHelper",
"Falling back to libtango_client_api.so symlink.");
131 }
catch (UnsatisfiedLinkError e) {
static final int ARCH_DEFAULT
static final int ARCH_ERROR
GLM_FUNC_DECL genType e()
static final int ARCH_ARM64
static final int loadTangoSharedLibrary()
static final int ARCH_X86
static final int ARCH_ARM32
static final int ARCH_X86_64
static final boolean bindTangoService(final Context context, ServiceConnection connection)
static final int ARCH_FALLBACK