aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app/src
diff options
context:
space:
mode:
authorRaphael Moll <>2009-03-31 17:23:46 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-31 17:23:46 -0700
commite67929df366c53628deccbe61ff2a073a9f68d34 (patch)
treed1bd2e7b631733ceeda1f1421aa3187c4ea54da6 /sdkmanager/app/src
parentf02cc788403ca8b8b4c05cd0327e9056d7ca2044 (diff)
downloadsdk-e67929df366c53628deccbe61ff2a073a9f68d34.zip
sdk-e67929df366c53628deccbe61ff2a073a9f68d34.tar.gz
sdk-e67929df366c53628deccbe61ff2a073a9f68d34.tar.bz2
AI 143883: am: CL 143881 AVD #1703143: delete AVDs not loaded correctly.
This covers the case where an AVD has an invalid target or is missing its AVD folder or the config.ini in it. Made some cosmetic cleanup too. Original author: raphael Merged from: //branches/cupcake/... Automated import of CL 143883
Diffstat (limited to 'sdkmanager/app/src')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 191aa9e..7386402 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -461,13 +461,13 @@ class Main {
}
// Are there some unused AVDs?
- List<AvdInfo> badAvds = avdManager.getUnavailableAvdList();
+ List<AvdInfo> badAvds = avdManager.getUnavailableAvds();
if (badAvds == null || badAvds.size() == 0) {
return;
}
- mSdkLog.printf("\nThe following Android Virtual Devices are no longer available:\n");
+ mSdkLog.printf("\nThe following Android Virtual Devices could not be loaded:\n");
boolean needSeparator = false;
for (AvdInfo info : badAvds) {
if (needSeparator) {
@@ -592,7 +592,7 @@ class Main {
File dir = new File(oldAvdInfo.getPath());
avdManager.recursiveDelete(dir);
dir.delete();
- // Remove old avd info from manager
+ // Remove old AVD info from manager
avdManager.removeAvd(oldAvdInfo);
}
@@ -602,13 +602,27 @@ class Main {
}
/**
- * Delete an AVD.
+ * Delete an AVD. If the AVD name is not part of the available ones look for an
+ * invalid AVD (one not loaded due to some error) to remove it too.
*/
private void deleteAvd() {
try {
String avdName = mSdkCommandLine.getParamName();
AvdManager avdManager = new AvdManager(mSdkManager, mSdkLog);
AvdInfo info = avdManager.getAvd(avdName);
+
+ if (info == null) {
+ // Look in unavailable AVDs
+ List<AvdInfo> badAvds = avdManager.getUnavailableAvds();
+ if (badAvds != null) {
+ for (AvdInfo i : badAvds) {
+ if (i.getName().equals(avdName)) {
+ info = i;
+ break;
+ }
+ }
+ }
+ }
if (info == null) {
errorAndExit("There is no Android Virtual Device named '%s'.", avdName);