Fix comparison of 2 doc packages that have the same codename/revision.
This made the Donut_r1 doc show up as upgrade to the donut_r1 doc. BUG: 2037448
This commit is contained in:
@@ -166,23 +166,26 @@ public class DocPackage extends Package {
|
|||||||
|
|
||||||
AndroidVersion replacementVersion = replacementDoc.getVersion();
|
AndroidVersion replacementVersion = replacementDoc.getVersion();
|
||||||
|
|
||||||
// the new doc is an update if the api level is higher
|
// the new doc is an update if the api level is higher (no matter the codename on either)
|
||||||
if (replacementVersion.getApiLevel() > mVersion.getApiLevel()) {
|
if (replacementVersion.getApiLevel() > mVersion.getApiLevel()) {
|
||||||
return UpdateInfo.UPDATE;
|
return UpdateInfo.UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's the exactly same (including codename), we check the revision
|
// Check if they're the same exact (api and codename)
|
||||||
if (replacementVersion.equals(mVersion) &&
|
if (replacementVersion.equals(mVersion)) {
|
||||||
replacementPackage.getRevision() > this.getRevision()) {
|
// exact same version, so check the revision level
|
||||||
|
if (replacementPackage.getRevision() > this.getRevision()) {
|
||||||
return UpdateInfo.UPDATE;
|
return UpdateInfo.UPDATE;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
// else we check if they have the same api level and the new one is a preview, in which
|
// not the same version? we check if they have the same api level and the new one
|
||||||
// case it's also an update (since preview have the api level of the _previous_ version.
|
// is a preview, in which case it's also an update (since preview have the api level
|
||||||
|
// of the _previous_ version.)
|
||||||
if (replacementVersion.getApiLevel() == mVersion.getApiLevel() &&
|
if (replacementVersion.getApiLevel() == mVersion.getApiLevel() &&
|
||||||
replacementVersion.isPreview()) {
|
replacementVersion.isPreview()) {
|
||||||
return UpdateInfo.UPDATE;
|
return UpdateInfo.UPDATE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// not an upgrade but not incompatible either.
|
// not an upgrade but not incompatible either.
|
||||||
return UpdateInfo.NOT_UPDATE;
|
return UpdateInfo.NOT_UPDATE;
|
||||||
|
|||||||
Reference in New Issue
Block a user