OpenCV version swithed to 4 digit in GUI and package revision number.

pull/572/head
Alexander Smorkalov 12 years ago
parent 9f15daf0a0
commit ddc2e334da
  1. 2
      android/libinfo/info.c
  2. 4
      android/package/AndroidManifest.xml
  3. 20
      android/service/engine/jni/NativeService/PackageInfo.cpp
  4. 14
      android/service/engine/jni/Tests/PackageInfoTest.cpp
  5. 26
      android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java

@ -7,7 +7,7 @@ const char* GetLibraryList(void);
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass); JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass);
#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" ANDROID_PACKAGE_PLATFORM #define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" ANDROID_PACKAGE_PLATFORM
#define PACKAGE_REVISION CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) #define PACKAGE_REVISION CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) "." CVAUX_STR(CV_VERSION_REVISION)
const char* GetPackageName(void) const char* GetPackageName(void)
{ {

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@" package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@"
android:versionCode="@OPENCV_VERSION_PATCH@@ANDROID_PACKAGE_RELEASE@" android:versionCode="@OPENCV_VERSION_PATCH@@OPENCV_VERSION_TWEAK@@ANDROID_PACKAGE_RELEASE@"
android:versionName="@OPENCV_VERSION_PATCH@.@ANDROID_PACKAGE_RELEASE@" > android:versionName="@OPENCV_VERSION_PATCH@.@OPENCV_VERSION_TWEAK@.@ANDROID_PACKAGE_RELEASE@" >
<uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" /> <uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

@ -136,7 +136,17 @@ inline int SplitVersion(const vector<string>& features, const string& package_ve
// Taking release and build number from package revision // Taking release and build number from package revision
vector<string> tmp2 = SplitStringVector(package_version, '.'); vector<string> tmp2 = SplitStringVector(package_version, '.');
result += atoi(tmp2[0].c_str())*100 + atoi(tmp2[1].c_str()); if (tmp2.size() == 2)
{
// the 2nd digit is revision
result += atoi(tmp2[0].c_str())*100 + 00;
}
else
{
// the 2nd digit is part of library version
// the 3rd digit is revision
result += atoi(tmp2[0].c_str())*100 + atoi(tmp2[1].c_str());
}
} }
else else
{ {
@ -194,10 +204,10 @@ inline int SplitPlatfrom(const vector<string>& features)
* Example: armv7_neon * Example: armv7_neon
*/ */
PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string install_path): PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string install_path):
Version(version), Version(version),
Platform(platform), Platform(platform),
CpuID(cpu_id), CpuID(cpu_id),
InstallPath("") InstallPath("")
{ {
#ifndef __SUPPORT_TEGRA3 #ifndef __SUPPORT_TEGRA3
Platform = PLATFORM_UNKNOWN; Platform = PLATFORM_UNKNOWN;

@ -157,6 +157,20 @@ TEST(PackageInfo, MipsFromFullName)
} }
#endif #endif
TEST(PackageInfo, Check2DigitRevision)
{
PackageInfo info("org.opencv.lib_v23_armv7a_neon", "/data/data/org.opencv.lib_v23_armv7_neon", "4.1");
EXPECT_EQ(2030400, info.GetVersion());
EXPECT_EQ(ARCH_ARMv7 | FEATURES_HAS_NEON, info.GetCpuID());
}
TEST(PackageInfo, Check3DigitRevision)
{
PackageInfo info("org.opencv.lib_v23_armv7a_neon", "/data/data/org.opencv.lib_v23_armv7_neon", "4.1.5");
EXPECT_EQ(2030401, info.GetVersion());
EXPECT_EQ(ARCH_ARMv7 | FEATURES_HAS_NEON, info.GetCpuID());
}
TEST(PackageInfo, Comparator1) TEST(PackageInfo, Comparator1)
{ {
PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86); PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86);

@ -299,10 +299,9 @@ public class ManagerActivity extends Activity
else else
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib"; NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (PackageName.equals("org.opencv.engine")) if (PackageName.equals("org.opencv.engine"))
{ {
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (NativeInfo.status()) if (NativeInfo.status())
{ {
PublicName = "Built-in OpenCV library"; PublicName = "Built-in OpenCV library";
@ -348,9 +347,7 @@ public class ManagerActivity extends Activity
if (null != ActivePackagePath) if (null != ActivePackagePath)
{ {
int start = ActivePackagePath.indexOf(mInstalledPackageInfo[i].packageName); if (ActivePackagePath.equals(NativeLibDir))
int stop = start + mInstalledPackageInfo[i].packageName.length();
if (start >= 0 && ActivePackagePath.charAt(stop) == '/')
{ {
temp.put("Activity", "y"); temp.put("Activity", "y");
Tags = "active"; Tags = "active";
@ -405,13 +402,22 @@ public class ManagerActivity extends Activity
if (OpenCVersion == null || PackageVersion == null) if (OpenCVersion == null || PackageVersion == null)
return "unknown"; return "unknown";
int dot = PackageVersion.indexOf("."); String[] revisions = PackageVersion.split("\\.");
if (dot == -1 || OpenCVersion.length() == 0)
if (revisions.length <= 1 || OpenCVersion.length() == 0)
return "unknown"; return "unknown";
else else
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." + if (revisions.length == 2)
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." + // the 2nd digit is revision
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1); return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
revisions[0] + " rev " + revisions[1];
else
// the 2nd digit is part of library version
// the 3rd digit is revision
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
revisions[0] + "." + revisions[1] + " rev " + revisions[2];
} }
protected String ConvertPackageName(String Name, String Version) protected String ConvertPackageName(String Name, String Version)

Loading…
Cancel
Save