aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2012-03-09 13:14:12 -0800
committerRaphael <raphael@google.com>2012-03-09 13:14:12 -0800
commita50c9641a9b83db4b9db49fa5e0cad0ab859683e (patch)
tree5dc3ccad0c71db8e3da07352188dc43eff9810b8 /sdkmanager/libs
parent148a3bb96fc4fc6681d8af937c2a83c35129f8b4 (diff)
downloadsdk-a50c9641a9b83db4b9db49fa5e0cad0ab859683e.zip
sdk-a50c9641a9b83db4b9db49fa5e0cad0ab859683e.tar.gz
sdk-a50c9641a9b83db4b9db49fa5e0cad0ab859683e.tar.bz2
SDK Manager: fix doc updates not being visible.
Change-Id: I993de075c265745d1db0732ae7936ce23dfd333e
Diffstat (limited to 'sdkmanager/libs')
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
index a64d151..2c78cd1 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
@@ -210,31 +210,36 @@ public class DocPackage extends Package implements IPackageVersion {
return new File(osSdkRoot, SdkConstants.FD_DOCS);
}
+ /**
+ * Consider doc packages to be the same if they cover the same API level,
+ * regardless of their revision number.
+ */
@Override
public boolean sameItemAs(Package pkg) {
- // only one doc package so any doc package is the same item
- // and we explicitly don't check whether the version is the same.
- return pkg instanceof DocPackage;
+ if (pkg instanceof DocPackage) {
+ AndroidVersion rev2 = ((DocPackage) pkg).getVersion();
+ return this.getVersion().equals(rev2);
+ }
+
+ return false;
}
/**
* {@inheritDoc}
- *
- * The comparison between doc packages is a bit more complex so we override the default
- * implementation.
- * <p/>
- * Docs are upgrade if they have a higher api, or a similar api but a higher revision.
+ * <hr>
+ * Doc packages are a bit different since there can only be one doc installed at
+ * the same time.
* <p/>
- * What makes this more complex is handling codename.
+ * We now consider that docs for different APIs are NOT updates, e.g. doc for API N+1
+ * is no longer considered an update for doc API N.
+ * However docs that have the same API version (API level + codename) are considered
+ * updates if they have a higher revision number (so 15 rev 2 is an update for 15 rev 1,
+ * but is not an update for 14 rev 1.)
*/
@Override
public UpdateInfo canBeUpdatedBy(Package replacementPackage) {
- if (replacementPackage == null) {
- return UpdateInfo.INCOMPATIBLE;
- }
-
- // check they are the same item.
- if (sameItemAs(replacementPackage) == false) {
+ // check they are the same kind of object
+ if (!(replacementPackage instanceof DocPackage)) {
return UpdateInfo.INCOMPATIBLE;
}
@@ -242,11 +247,6 @@ public class DocPackage extends Package implements IPackageVersion {
AndroidVersion replacementVersion = replacementDoc.getVersion();
- // the new doc is an update if the api level is higher (no matter the codename on either)
- if (replacementVersion.getApiLevel() > mVersion.getApiLevel()) {
- return UpdateInfo.UPDATE;
- }
-
// Check if they're the same exact (api and codename)
if (replacementVersion.equals(mVersion)) {
// exact same version, so check the revision level