Code normalization problems fixed.
Rair hangs on library installation fixed.
This commit is contained in:
parent
680fba7e0d
commit
293063eed3
@ -60,9 +60,7 @@ status_t BnOpenCVEngine::onTransact(uint32_t code, const Parcel& data, android::
|
|||||||
int res = reply->writeInt32(static_cast<int32_t>(result));
|
int res = reply->writeInt32(static_cast<int32_t>(result));
|
||||||
LOGD("InstallVersion call to Binder finished with res %d", res);
|
LOGD("InstallVersion call to Binder finished with res %d", res);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
LOGD("OpenCVEngine unknown request");
|
LOGD("OpenCVEngine unknown request");
|
||||||
|
@ -13,7 +13,7 @@ int GetCpuID()
|
|||||||
map<string, string> cpu_info = GetCpuInfo();
|
map<string, string> cpu_info = GetCpuInfo();
|
||||||
map<string, string>::const_iterator it;
|
map<string, string>::const_iterator it;
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
LOGD("Using X86 HW detector");
|
LOGD("Using X86 HW detector");
|
||||||
result |= ARCH_X86;
|
result |= ARCH_X86;
|
||||||
it = cpu_info.find("flags");
|
it = cpu_info.find("flags");
|
||||||
@ -34,11 +34,11 @@ int GetCpuID()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__mips)
|
#elif defined(__mips)
|
||||||
#ifdef __SUPPORT_MIPS
|
#ifdef __SUPPORT_MIPS
|
||||||
result |= ARCH_MIPS;
|
result |= ARCH_MIPS;
|
||||||
#else
|
#else
|
||||||
result = ARCH_UNKNOWN;
|
result = ARCH_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
LOGD("Using ARM HW detector");
|
LOGD("Using ARM HW detector");
|
||||||
it = cpu_info.find("Processor");
|
it = cpu_info.find("Processor");
|
||||||
@ -103,7 +103,7 @@ int GetCpuID()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -174,8 +174,8 @@ int DetectKnownPlatforms()
|
|||||||
|
|
||||||
// NOTE: Uncomment when all Tegras will be supported
|
// NOTE: Uncomment when all Tegras will be supported
|
||||||
/*if (tegra_status > 0)
|
/*if (tegra_status > 0)
|
||||||
{
|
* {
|
||||||
return PLATFORM_TEGRA + tegra_status - 1;
|
* return PLATFORM_TEGRA + tegra_status - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -173,24 +173,16 @@ bool OpenCVEngine::InstallVersion(android::String16 version)
|
|||||||
std::string norm_version;
|
std::string norm_version;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
LOGD("OpenCVEngine::InstallVersion() begin");
|
||||||
|
|
||||||
norm_version = NormalizeVersionString(std_version);
|
norm_version = NormalizeVersionString(std_version);
|
||||||
|
|
||||||
if (!norm_version.empty())
|
if (!norm_version.empty())
|
||||||
{
|
|
||||||
LOGD("OpenCVEngine::InstallVersion() begin");
|
|
||||||
|
|
||||||
if (!PackageManager->CheckVersionInstalled(norm_version, Platform, CpuID))
|
|
||||||
{
|
{
|
||||||
LOGD("PackageManager->InstallVersion call");
|
LOGD("PackageManager->InstallVersion call");
|
||||||
result = PackageManager->InstallVersion(norm_version, Platform, CpuID);
|
result = PackageManager->InstallVersion(norm_version, Platform, CpuID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
LOGI("Package OpenCV of version %s is already installed. Skiped.", norm_version.c_str());
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LOGE("OpenCV version \"%s\" is not supported", norm_version.c_str());
|
LOGE("OpenCV version \"%s\" is not supported", norm_version.c_str());
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ bool ParseString(const string& src, string& key, string& value)
|
|||||||
|
|
||||||
set<string> SplitString(const string& src, const char seporator)
|
set<string> SplitString(const string& src, const char seporator)
|
||||||
{
|
{
|
||||||
|
|
||||||
set<string> result;
|
set<string> result;
|
||||||
|
|
||||||
if (!src.empty())
|
if (!src.empty())
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
JavaBasedPackageManager::JavaBasedPackageManager(JavaVM* JavaMashine, jobject MarketConnector):
|
JavaBasedPackageManager::JavaBasedPackageManager(JavaVM* JavaMashine, jobject MarketConnector):
|
||||||
JavaContext(JavaMashine),
|
JavaContext(JavaMashine),
|
||||||
JavaPackageManager(MarketConnector)
|
JavaPackageManager(MarketConnector)
|
||||||
{
|
{
|
||||||
assert(JavaContext);
|
assert(JavaContext);
|
||||||
assert(JavaPackageManager);
|
assert(JavaPackageManager);
|
||||||
|
@ -67,4 +67,3 @@ JNIEXPORT void JNICALL Java_org_opencv_engine_BinderConnector_Final(JNIEnv *, jo
|
|||||||
delete PackageManager;
|
delete PackageManager;
|
||||||
PackageManager = NULL;
|
PackageManager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ bool CommonPackageManager::CheckVersionInstalled(const std::string& version, int
|
|||||||
|
|
||||||
if (!packages.empty())
|
if (!packages.empty())
|
||||||
{
|
{
|
||||||
result = (packages.end() != find(packages.begin(), packages.end(), target_package));
|
vector<PackageInfo>::const_iterator it = find(packages.begin(), packages.end(), target_package);
|
||||||
|
result = (it != packages.end());
|
||||||
}
|
}
|
||||||
LOGD("CommonPackageManager::CheckVersionInstalled() end");
|
LOGD("CommonPackageManager::CheckVersionInstalled() end");
|
||||||
return result;
|
return result;
|
||||||
|
@ -189,14 +189,14 @@ inline int SplitPlatfrom(const vector<string>& features)
|
|||||||
* Example: armv7_neon, armv5_vfpv3
|
* Example: armv7_neon, armv5_vfpv3
|
||||||
*/
|
*/
|
||||||
PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::string install_path):
|
PackageInfo::PackageInfo(const string& 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;
|
||||||
#endif
|
#endif
|
||||||
FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1);
|
FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1);
|
||||||
if (PLATFORM_UNKNOWN != Platform)
|
if (PLATFORM_UNKNOWN != Platform)
|
||||||
{
|
{
|
||||||
@ -210,41 +210,41 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
|
|||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch x86");
|
LOGD("PackageInfo::PackageInfo: package arch x86");
|
||||||
FullName += string("_") + ARCH_X86_NAME;
|
FullName += string("_") + ARCH_X86_NAME;
|
||||||
#ifdef __SUPPORT_INTEL_FEATURES
|
#ifdef __SUPPORT_INTEL_FEATURES
|
||||||
string features = JoinIntelFeatures(CpuID);
|
string features = JoinIntelFeatures(CpuID);
|
||||||
if (!features.empty())
|
if (!features.empty())
|
||||||
{
|
{
|
||||||
FullName += string("_") + features;
|
FullName += string("_") + features;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_X64 & CpuID)
|
else if (ARCH_X64 & CpuID)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch x64");
|
LOGD("PackageInfo::PackageInfo: package arch x64");
|
||||||
#ifdef __SUPPORT_INTEL_x64
|
#ifdef __SUPPORT_INTEL_x64
|
||||||
FullName += string("_") + ARCH_X64_NAME;
|
FullName += string("_") + ARCH_X64_NAME;
|
||||||
#else
|
#else
|
||||||
FullName += string("_") + ARCH_X86_NAME;
|
FullName += string("_") + ARCH_X86_NAME;
|
||||||
#endif
|
#endif
|
||||||
#ifdef __SUPPORT_INTEL_FEATURES
|
#ifdef __SUPPORT_INTEL_FEATURES
|
||||||
string features = JoinIntelFeatures(CpuID);
|
string features = JoinIntelFeatures(CpuID);
|
||||||
if (!features.empty())
|
if (!features.empty())
|
||||||
{
|
{
|
||||||
FullName += string("_") + features;
|
FullName += string("_") + features;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_ARMv5 & CpuID)
|
else if (ARCH_ARMv5 & CpuID)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch ARMv5");
|
LOGD("PackageInfo::PackageInfo: package arch ARMv5");
|
||||||
FullName += string("_") + ARCH_ARMv5_NAME;
|
FullName += string("_") + ARCH_ARMv5_NAME;
|
||||||
#ifdef __SUPPORT_ARMEABI_FEATURES
|
#ifdef __SUPPORT_ARMEABI_FEATURES
|
||||||
string features = JoinARMFeatures(CpuID);
|
string features = JoinARMFeatures(CpuID);
|
||||||
if (!features.empty())
|
if (!features.empty())
|
||||||
{
|
{
|
||||||
FullName += string("_") + features;
|
FullName += string("_") + features;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_ARMv6 & CpuID)
|
else if (ARCH_ARMv6 & CpuID)
|
||||||
{
|
{
|
||||||
@ -252,46 +252,46 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
|
|||||||
// NOTE: ARM v5 used instead ARM v6
|
// NOTE: ARM v5 used instead ARM v6
|
||||||
//FullName += string("_") + ARCH_ARMv6_NAME;
|
//FullName += string("_") + ARCH_ARMv6_NAME;
|
||||||
FullName += string("_") + ARCH_ARMv5_NAME;
|
FullName += string("_") + ARCH_ARMv5_NAME;
|
||||||
#ifdef __SUPPORT_ARMEABI_FEATURES
|
#ifdef __SUPPORT_ARMEABI_FEATURES
|
||||||
string features = JoinARMFeatures(CpuID);
|
string features = JoinARMFeatures(CpuID);
|
||||||
if (!features.empty())
|
if (!features.empty())
|
||||||
{
|
{
|
||||||
FullName += string("_") + features;
|
FullName += string("_") + features;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_ARMv7 & CpuID)
|
else if (ARCH_ARMv7 & CpuID)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch ARMv7");
|
LOGD("PackageInfo::PackageInfo: package arch ARMv7");
|
||||||
FullName += string("_") + ARCH_ARMv7_NAME;
|
FullName += string("_") + ARCH_ARMv7_NAME;
|
||||||
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
|
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
|
||||||
string features = JoinARMFeatures(CpuID);
|
string features = JoinARMFeatures(CpuID);
|
||||||
if (!features.empty())
|
if (!features.empty())
|
||||||
{
|
{
|
||||||
FullName += string("_") + features;
|
FullName += string("_") + features;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_ARMv8 & CpuID)
|
else if (ARCH_ARMv8 & CpuID)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch ARMv8");
|
LOGD("PackageInfo::PackageInfo: package arch ARMv8");
|
||||||
#ifdef __SUPPORT_ARMEABI_V8
|
#ifdef __SUPPORT_ARMEABI_V8
|
||||||
FullName += string("_") + ARCH_ARMv8_NAME;
|
FullName += string("_") + ARCH_ARMv8_NAME;
|
||||||
#else
|
#else
|
||||||
FullName += string("_") + ARCH_ARMv7_NAME;
|
FullName += string("_") + ARCH_ARMv7_NAME;
|
||||||
#endif
|
#endif
|
||||||
//string features = JoinARMFeatures(CpuID);
|
//string features = JoinARMFeatures(CpuID);
|
||||||
//if (!features.empty())
|
//if (!features.empty())
|
||||||
//{
|
//{
|
||||||
// FullName += string("_") + features;
|
// FullName += string("_") + features;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
#ifdef __SUPPORT_MIPS
|
#ifdef __SUPPORT_MIPS
|
||||||
else if (ARCH_MIPS & CpuID)
|
else if (ARCH_MIPS & CpuID)
|
||||||
{
|
{
|
||||||
FullName += string("_") + ARCH_MIPS_NAME;
|
FullName += string("_") + ARCH_MIPS_NAME;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch unknown");
|
LOGD("PackageInfo::PackageInfo: package arch unknown");
|
||||||
@ -316,8 +316,8 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackageInfo::PackageInfo(const string& fullname, const string& install_path, string package_version):
|
PackageInfo::PackageInfo(const string& fullname, const string& install_path, string package_version):
|
||||||
FullName(fullname),
|
FullName(fullname),
|
||||||
InstallPath(install_path)
|
InstallPath(install_path)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo(\"%s\", \"%s\", \"%s\")", fullname.c_str(), install_path.c_str(), package_version.c_str());
|
LOGD("PackageInfo::PackageInfo(\"%s\", \"%s\", \"%s\")", fullname.c_str(), install_path.c_str(), package_version.c_str());
|
||||||
|
|
||||||
@ -424,12 +424,12 @@ PackageInfo::PackageInfo(const string& fullname, const string& install_path, str
|
|||||||
{
|
{
|
||||||
CpuID = ARCH_X64 | SplitIntelFeatures(features);
|
CpuID = ARCH_X64 | SplitIntelFeatures(features);
|
||||||
}
|
}
|
||||||
#ifdef __SUPPORT_MIPS
|
#ifdef __SUPPORT_MIPS
|
||||||
else if (ARCH_MIPS_NAME == features[2])
|
else if (ARCH_MIPS_NAME == features[2])
|
||||||
{
|
{
|
||||||
CpuID = ARCH_MIPS;
|
CpuID = ARCH_MIPS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGD("It is not OpenCV library package for this platform");
|
LOGD("It is not OpenCV library package for this platform");
|
||||||
|
@ -126,7 +126,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWNewVersion)
|
|||||||
EXPECT_EQ(0, result.size());
|
EXPECT_EQ(0, result.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else // armeabi
|
||||||
TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
|
TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
|
||||||
{
|
{
|
||||||
sp<IOpenCVEngine> Engine = InitConnect();
|
sp<IOpenCVEngine> Engine = InitConnect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user