Merge change 20520 into donut

* changes:
  Fix IAndroidTarget#isCompatibleBaseFor() for add-ons
This commit is contained in:
Android (Google) Code Review
2009-08-10 16:58:58 -07:00
2 changed files with 41 additions and 19 deletions

View File

@@ -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)) {
/*
* 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;
}
return mBasePlatform.equals(target);
// 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);
}
}
public String hashString() {

View File

@@ -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