Merge change 20520 into donut
* changes: Fix IAndroidTarget#isCompatibleBaseFor() for add-ons
This commit is contained in:
@@ -218,15 +218,32 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the receiver has optional libraries, then the target is only compatible if the
|
/*
|
||||||
// vendor and name are the same
|
* The method javadoc indicates:
|
||||||
if (mLibraries.length != 0 &&
|
* Returns whether the given target is compatible with the receiver.
|
||||||
(mVendor.equals(target.getVendor()) == false ||
|
* <p/>A target is considered compatible if applications developed for the receiver can
|
||||||
mName.equals(target.getName()) == false)) {
|
* run on the given target.
|
||||||
return false;
|
*/
|
||||||
|
|
||||||
|
// 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() {
|
public String hashString() {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public final class AvdSelector {
|
|||||||
private Button mNewButton;
|
private Button mNewButton;
|
||||||
private Button mRefreshButton;
|
private Button mRefreshButton;
|
||||||
private Button mManagerButton;
|
private Button mManagerButton;
|
||||||
private Button mUpdateButton;
|
private Button mRepairButton;
|
||||||
private Button mStartButton;
|
private Button mStartButton;
|
||||||
|
|
||||||
private SelectionListener mSelectionListener;
|
private SelectionListener mSelectionListener;
|
||||||
@@ -256,14 +256,14 @@ public final class AvdSelector {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mUpdateButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
|
mRepairButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
|
||||||
mUpdateButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
mRepairButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
mUpdateButton.setText("Update...");
|
mRepairButton.setText("Repair...");
|
||||||
mUpdateButton.setToolTipText("Updates the path of the selected AVD.");
|
mRepairButton.setToolTipText("Repairs the selected AVD.");
|
||||||
mUpdateButton.addSelectionListener(new SelectionAdapter() {
|
mRepairButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent arg0) {
|
public void widgetSelected(SelectionEvent arg0) {
|
||||||
onUpdate();
|
onRepair();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -775,8 +775,8 @@ public final class AvdSelector {
|
|||||||
if (mDeleteButton != null) {
|
if (mDeleteButton != null) {
|
||||||
mDeleteButton.setEnabled(false);
|
mDeleteButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
if (mUpdateButton != null) {
|
if (mRepairButton != null) {
|
||||||
mUpdateButton.setEnabled(false);
|
mRepairButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AvdInfo selection = getTableSelection();
|
AvdInfo selection = getTableSelection();
|
||||||
@@ -790,8 +790,8 @@ public final class AvdSelector {
|
|||||||
if (mDeleteButton != null) {
|
if (mDeleteButton != null) {
|
||||||
mDeleteButton.setEnabled(hasSelection);
|
mDeleteButton.setEnabled(hasSelection);
|
||||||
}
|
}
|
||||||
if (mUpdateButton != null) {
|
if (mRepairButton != null) {
|
||||||
mUpdateButton.setEnabled(hasSelection &&
|
mRepairButton.setEnabled(hasSelection &&
|
||||||
selection.getStatus() == AvdStatus.ERROR_IMAGE_DIR);
|
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();
|
final AvdInfo avdInfo = getTableSelection();
|
||||||
|
|
||||||
// get the current Display
|
// get the current Display
|
||||||
|
|||||||
Reference in New Issue
Block a user