Automated import from //branches/donutburger/...@140697,140697

This commit is contained in:
Xavier Ducrohet
2009-03-24 18:15:02 -07:00
committed by The Android Open Source Project
parent 02c11da47f
commit 9c03440f19
4 changed files with 60 additions and 10 deletions

View File

@@ -177,7 +177,7 @@ public final class AvdManager {
public AvdManager(SdkManager sdk, ISdkLog sdkLog) throws AndroidLocationException {
mSdk = sdk;
mSdkLog = sdkLog;
buildAvdList();
buildAvdList(mAvdList);
}
/**
@@ -201,6 +201,20 @@ public final class AvdManager {
return null;
}
/**
* Reloads the AVD list.
* @throws AndroidLocationException if there was an error finding the location of the
* AVD folder.
*/
public void reloadAvds() throws AndroidLocationException {
// build the list in a temp list first, in case the method throws an exception.
// It's better than deleting the whole list before reading the new one.
ArrayList<AvdInfo> list = new ArrayList<AvdInfo>();
buildAvdList(list);
mAvdList.clear();
mAvdList.addAll(list);
}
/**
* Creates a new AVD. It is expected that there is no existing AVD with this name already.
@@ -620,7 +634,7 @@ public final class AvdManager {
}
}
private void buildAvdList() throws AndroidLocationException {
private void buildAvdList(ArrayList<AvdInfo> list) throws AndroidLocationException {
// get the Android prefs location.
String avdRoot = AndroidLocation.getFolder() + AndroidLocation.FOLDER_AVD;
@@ -664,7 +678,7 @@ public final class AvdManager {
for (File avd : avds) {
AvdInfo info = parseAvdInfo(avd);
if (info != null) {
mAvdList.add(info);
list.add(info);
if (avdListDebug) {
mSdkLog.printf("[AVD LIST DEBUG] Added AVD '%s'\n", info.getPath());
}