aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-08-10 16:58:58 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-08-10 16:58:58 -0700
commitf2c23b6b8cbf14be03f3f1eecbaba8da8141a4aa (patch)
tree29458b305958cb191826b3d1924ade5b3a73516e /sdkmanager
parent8b185793fc208a5a4f1fd8702e249d8aab089e8b (diff)
parentce77f80818498bbf2a4d05efdc1fecc853b8df8b (diff)
downloadsdk-f2c23b6b8cbf14be03f3f1eecbaba8da8141a4aa.zip
sdk-f2c23b6b8cbf14be03f3f1eecbaba8da8141a4aa.tar.gz
sdk-f2c23b6b8cbf14be03f3f1eecbaba8da8141a4aa.tar.bz2
Merge change 20520 into donut
* changes: Fix IAndroidTarget#isCompatibleBaseFor() for add-ons
Diffstat (limited to 'sdkmanager')
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java31
-rw-r--r--sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java29
2 files changed, 41 insertions, 19 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
index 293d66a..d72cd94 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
@@ -218,15 +218,32 @@ final class AddOnTarget implements IAndroidTarget {
return true;
}
- // if the receiver has optional libraries, then the target is only compatible if the
- // vendor and name are the same
- if (mLibraries.length != 0 &&
- (mVendor.equals(target.getVendor()) == false ||
- mName.equals(target.getName()) == false)) {
- return false;
+ /*
+ * The method javadoc indicates:
+ * Returns whether the given target is compatible with the receiver.
+ * <p/>A target is considered compatible if applications developed for the receiver can
+ * run on the given target.
+ */
+
+ // The receiver is an add-on. There are 2 big use cases: The add-on has libraries
+ // or the add-on doesn't (in which case we consider it a platform).
+ if (mLibraries.length == 0) {
+ return mBasePlatform.isCompatibleBaseFor(target);
+ } else {
+ // the only targets that can run the receiver are the same add-on in the same or later
+ // versions.
+ // first check: vendor/name
+ if (mVendor.equals(target.getVendor()) == false ||
+ mName.equals(target.getName()) == false) {
+ return false;
+ }
+
+ // now check the version. At this point since we checked the add-on part,
+ // we can revert to the basic check on version/codename which are done by the
+ // base platform already.
+ return mBasePlatform.isCompatibleBaseFor(target);
}
- return mBasePlatform.equals(target);
}
public String hashString() {
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
index 96d1b65..ba1bb4c 100644
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
@@ -81,7 +81,7 @@ public final class AvdSelector {
private Button mNewButton;
private Button mRefreshButton;
private Button mManagerButton;
- private Button mUpdateButton;
+ private Button mRepairButton;
private Button mStartButton;
private SelectionListener mSelectionListener;
@@ -256,14 +256,14 @@ public final class AvdSelector {
}
});
- mUpdateButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
- mUpdateButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mUpdateButton.setText("Update...");
- mUpdateButton.setToolTipText("Updates the path of the selected AVD.");
- mUpdateButton.addSelectionListener(new SelectionAdapter() {
+ mRepairButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
+ mRepairButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mRepairButton.setText("Repair...");
+ mRepairButton.setToolTipText("Repairs the selected AVD.");
+ mRepairButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
- onUpdate();
+ onRepair();
}
});
@@ -775,8 +775,8 @@ public final class AvdSelector {
if (mDeleteButton != null) {
mDeleteButton.setEnabled(false);
}
- if (mUpdateButton != null) {
- mUpdateButton.setEnabled(false);
+ if (mRepairButton != null) {
+ mRepairButton.setEnabled(false);
}
} else {
AvdInfo selection = getTableSelection();
@@ -790,8 +790,8 @@ public final class AvdSelector {
if (mDeleteButton != null) {
mDeleteButton.setEnabled(hasSelection);
}
- if (mUpdateButton != null) {
- mUpdateButton.setEnabled(hasSelection &&
+ if (mRepairButton != null) {
+ mRepairButton.setEnabled(hasSelection &&
selection.getStatus() == AvdStatus.ERROR_IMAGE_DIR);
}
}
@@ -851,7 +851,12 @@ public final class AvdSelector {
}
}
- private void onUpdate() {
+ /**
+ * Repairs the selected AVD.
+ * <p/>
+ * For now this only supports fixing the wrong value in image.sysdir.*
+ */
+ private void onRepair() {
final AvdInfo avdInfo = getTableSelection();
// get the current Display