diff options
| author | Raphael <raphael@google.com> | 2012-03-09 13:14:12 -0800 |
|---|---|---|
| committer | Xavier Ducrohet <xav@android.com> | 2012-03-09 13:19:04 -0800 |
| commit | eb3d5ce2f8faf6c3e64d7885fec9612048ea1e60 (patch) | |
| tree | c2c4717b72c5980d9ea3302e1ddb12ae75f074a4 | |
| parent | 2d8adc2403b88e1f701f114259553b82ca69bdd7 (diff) | |
| download | platform_sdk-tools_r17.tar.gz platform_sdk-tools_r17.tar.bz2 platform_sdk-tools_r17.zip | |
SDK Manager: fix doc updates not being visible. do not merge.tools_r17
(cherry picked from commit a50c9641a9b83db4b9db49fa5e0cad0ab859683e)
Change-Id: I3e0333ec3e411edbd2692c5b777c261475b0aec4
| -rwxr-xr-x | sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java | 40 |
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 a64d15162..2c78cd1a7 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
|
