GetPublicName function removed for OpenCV LibraryInfo class;

Some OpenCV Manager UI behavior updates;
CMake build fix.
pull/204/head
Alexander Smorkalov 12 years ago
parent 0f64f847b2
commit 4ebcf2b224
  1. 2
      android/service/engine/CMakeLists.txt
  2. 20
      android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
  3. 3
      android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h
  4. 2
      android/service/engine/project.properties
  5. 7
      android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
  6. 74
      android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java

@ -2,7 +2,7 @@ set(engine OpenCVEngine)
set(JNI_LIB_NAME ${engine} ${engine}_jni)
unset(__android_project_chain CACHE)
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON IGNORE_MANIFEST ON )
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 9 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON IGNORE_MANIFEST ON )
set(ANDROID_PLATFORM_VERSION_CODE "0")

@ -41,26 +41,6 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageNam
return env->NewStringUTF(result);
}
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPublicName
(JNIEnv* env, jobject, jlong)
{
const char* (*info_func)();
const char* result;
const char* error;
dlerror();
*(void **) (&info_func) = dlsym((void*)handle, "GetPublicName");
if ((error = dlerror()) == NULL)
result = (*info_func)();
else
{
LOGE("dlsym error: \"%s\"", error);
result = "unknown";
}
return env->NewStringUTF(result);
}
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(JNIEnv* env, jobject, jlong handle)
{

@ -12,9 +12,6 @@ JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
(JNIEnv *, jobject, jlong);
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPublicName
(JNIEnv *, jobject, jlong);
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(JNIEnv *, jobject, jlong);

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
target=android-9

@ -7,7 +7,6 @@ public class OpenCVLibraryInfo {
mPackageName = getPackageName(mNativeObj);
mLibraryList = getLibraryList(mNativeObj);
mVersionName = getVersionName(mNativeObj);
mPublicName = getPublicName(mNativeObj);
close(mNativeObj);
}
}
@ -20,10 +19,6 @@ public class OpenCVLibraryInfo {
return mPackageName;
}
public String publicName() {
return mPublicName;
}
public String libraryList() {
return mLibraryList;
}
@ -34,13 +29,11 @@ public class OpenCVLibraryInfo {
private long mNativeObj;
private String mPackageName;
private String mPublicName;
private String mLibraryList;
private String mVersionName;
private native long open(String packagePath);
private native String getPackageName(long obj);
private native String getPublicName(long obj);
private native String getLibraryList(long obj);
private native String getVersionName(long obj);
private native void close(long obj);

@ -79,7 +79,7 @@ public class ManagerActivity extends Activity
{
HardwarePlatformView.setText("Tegra");
}
else if (HardwareDetector.PLATFORM_TEGRA == Platfrom)
else if (HardwareDetector.PLATFORM_TEGRA2 == Platfrom)
{
HardwarePlatformView.setText("Tegra 2");
}
@ -172,9 +172,12 @@ public class ManagerActivity extends Activity
mInstalledPackageView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long id) {
mInstalledPackageView.setTag(Integer.valueOf((int)id));
mActionDialog.show();
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
if (!mInstalledPackageInfo[(int) id].packageName.equals("org.opencv.engine"))
{
mInstalledPackageView.setTag(Integer.valueOf((int)id));
mActionDialog.show();
}
}
});
@ -234,8 +237,6 @@ public class ManagerActivity extends Activity
protected class OpenCVEngineServiceConnection implements ServiceConnection
{
public void onServiceDisconnected(ComponentName name) {
// TODO Auto-generated method stub
}
public void onServiceConnected(ComponentName name, IBinder service) {
@ -280,34 +281,36 @@ public class ManagerActivity extends Activity
// Convert to Items for package list view
HashMap<String,String> temp = new HashMap<String,String>();
String PackageName = "";
String PublicName = "";
String OpenCVersion = "unknown";
String HardwareName = "";
String NativeLibDir = "";
String VersionName = "";
String OpenCVersion = "";
String PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);
String PackageName = mInstalledPackageInfo[i].packageName;
String VersionName = mInstalledPackageInfo[i].versionName;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
NativeLibDir = mInstalledPackageInfo[i].applicationInfo.nativeLibraryDir;
else
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
OpenCVLibraryInfo nativeInfo = new OpenCVLibraryInfo(NativeLibDir);
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (nativeInfo.status())
if (PackageName.equals("org.opencv.engine"))
{
PublicName = nativeInfo.publicName();
PackageName = nativeInfo.packageName();
VersionName = nativeInfo.versionName();
}
else
{
PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);
PackageName = mInstalledPackageInfo[i].packageName;
VersionName = mInstalledPackageInfo[i].versionName;
if (NativeInfo.status())
{
PublicName = "Built-in OpenCV library";
PackageName = NativeInfo.packageName();
VersionName = NativeInfo.versionName();
}
else
continue;
}
int idx = 0;
Log.d(TAG, PackageName);
StringTokenizer tokenizer = new StringTokenizer(PackageName, "_");
while (tokenizer.hasMoreTokens())
{
@ -329,6 +332,7 @@ public class ManagerActivity extends Activity
}
String ActivePackagePath;
String Tags = null;
ActivePackagePath = mActivePackageMap.get(OpenCVersion);
Log.d(TAG, OpenCVersion + " -> " + ActivePackagePath);
@ -339,7 +343,7 @@ public class ManagerActivity extends Activity
if (start >= 0 && ActivePackagePath.charAt(stop) == '/')
{
temp.put("Activity", "y");
PublicName += " (in use)";
Tags = "active";
}
else
{
@ -351,9 +355,31 @@ public class ManagerActivity extends Activity
temp.put("Activity", "n");
}
temp.put("Name", PublicName);
temp.put("Version", NormalizeVersion(OpenCVersion, VersionName));
temp.put("Hardware", HardwareName);
// HACK: OpenCV Manager for Armv7-a Neon already has Tegra3 optimizations
// that is enabled on proper hardware
if (HardwareDetector.DetectKnownPlatforms() == HardwareDetector.PLATFORM_TEGRA3 &&
HardwareName.equals("armv7a neon ") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
{
temp.put("Hardware", "Tegra 3");
if (Tags == null)
{
Tags = "optimized";
}
else
{
Tags = Tags + ", optimized";
}
}
else
{
temp.put("Hardware", HardwareName);
}
if (Tags != null)
PublicName = PublicName + " (" + Tags + ")";
temp.put("Name", PublicName);
mListViewItems.add(temp);
}

Loading…
Cancel
Save