OSDN Git Service

Fix comparison of 2 doc packages that have the same codename/revision.
authorXavier Ducrohet <xav@android.com>
Thu, 6 Aug 2009 02:25:35 +0000 (19:25 -0700)
committerXavier Ducrohet <xav@android.com>
Thu, 6 Aug 2009 02:31:04 +0000 (19:31 -0700)
This made the Donut_r1 doc show up as upgrade to the donut_r1 doc.
BUG: 2037448

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java

index abd42fb..3bd731b 100755 (executable)
@@ -166,22 +166,25 @@ public class DocPackage extends Package {
 \r
         AndroidVersion replacementVersion = replacementDoc.getVersion();\r
 \r
-        // the new doc is an update if the api level is higher\r
+        // the new doc is an update if the api level is higher (no matter the codename on either)\r
         if (replacementVersion.getApiLevel() > mVersion.getApiLevel()) {\r
             return UpdateInfo.UPDATE;\r
         }\r
 \r
-        // if it's the exactly same (including codename), we check the revision\r
-        if (replacementVersion.equals(mVersion) &&\r
-                replacementPackage.getRevision() > this.getRevision()) {\r
-            return UpdateInfo.UPDATE;\r
-        }\r
-\r
-        // else we check if they have the same api level and the new one is a preview, in which\r
-        // case it's also an update (since preview have the api level of the _previous_ version.\r
-        if (replacementVersion.getApiLevel() == mVersion.getApiLevel() &&\r
-                replacementVersion.isPreview()) {\r
-            return UpdateInfo.UPDATE;\r
+        // Check if they're the same exact (api and codename)\r
+        if (replacementVersion.equals(mVersion)) {\r
+            // exact same version, so check the revision level\r
+            if (replacementPackage.getRevision() > this.getRevision()) {\r
+                return UpdateInfo.UPDATE;\r
+            }\r
+        } else {\r
+            // not the same version? we check if they have the same api level and the new one\r
+            // is a preview, in which case it's also an update (since preview have the api level\r
+            // of the _previous_ version.)\r
+            if (replacementVersion.getApiLevel() == mVersion.getApiLevel() &&\r
+                    replacementVersion.isPreview()) {\r
+                return UpdateInfo.UPDATE;\r
+            }\r
         }\r
 \r
         // not an upgrade but not incompatible either.\r