Hardware platform detection for non arm devices fixed.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Thu, 20 Dec 2012 12:44:56 +0000 (16:44 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Thu, 20 Dec 2012 12:44:56 +0000 (16:44 +0400)
android/service/engine/jni/NativeService/CommonPackageManager.cpp

index e99d9b229330e2a6ff411aa398440c6599c211ac..164b415a74d485a05aa70da65badeebe5a453637 100644 (file)
@@ -134,7 +134,7 @@ bool CommonPackageManager::IsVersionCompatible(const std::string& target_version
     // major version is the same and minor package version is above or the same as target.
     if ((package_version[0] == target_version[0]) && (package_version[1] == target_version[1]) && (package_version[2] >= target_version[2]))
     {
-    result = true;
+        result = true;
     }
 
     return result;
@@ -144,13 +144,21 @@ int CommonPackageManager::GetHardwareRating(int platform, int cpu_id, const std:
 {
     int result = -1;
 
-    for (size_t i = 0; i < group.size(); i++)
+    if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64) || (cpu_id & ARCH_MIPS))
+        // Note: No raiting for x86, x64 and MIPS
+        // only one package is used
+        result = 0;
+    else
     {
-    if (group[i] == std::pair<int, int>(platform, cpu_id))
-    {
-        result = i;
-        break;
-    }
+        // Calculate rating for Arm
+        for (size_t i = 0; i < group.size(); i++)
+        {
+            if (group[i] == std::pair<int, int>(platform, cpu_id))
+            {
+                result = i;
+                break;
+            }
+        }
     }
 
     return result;