Fix ADT#1807821: -f option ignored when avd dir already existed.
Also fixed an NPE when parsing some invalid AVDs.
This commit is contained in:
@@ -454,16 +454,18 @@ class Main {
|
|||||||
|
|
||||||
// display some extra values.
|
// display some extra values.
|
||||||
Map<String, String> properties = info.getProperties();
|
Map<String, String> properties = info.getProperties();
|
||||||
String skin = properties.get(AvdManager.AVD_INI_SKIN_NAME);
|
if (properties != null) {
|
||||||
if (skin != null) {
|
String skin = properties.get(AvdManager.AVD_INI_SKIN_NAME);
|
||||||
mSdkLog.printf(" Skin: %s\n", skin);
|
if (skin != null) {
|
||||||
}
|
mSdkLog.printf(" Skin: %s\n", skin);
|
||||||
String sdcard = properties.get(AvdManager.AVD_INI_SDCARD_SIZE);
|
}
|
||||||
if (sdcard == null) {
|
String sdcard = properties.get(AvdManager.AVD_INI_SDCARD_SIZE);
|
||||||
sdcard = properties.get(AvdManager.AVD_INI_SDCARD_PATH);
|
if (sdcard == null) {
|
||||||
}
|
sdcard = properties.get(AvdManager.AVD_INI_SDCARD_PATH);
|
||||||
if (sdcard != null) {
|
}
|
||||||
mSdkLog.printf(" Sdcard: %s\n", sdcard);
|
if (sdcard != null) {
|
||||||
|
mSdkLog.printf(" Sdcard: %s\n", sdcard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,7 +510,7 @@ class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean removePrevious = false;
|
boolean removePrevious = mSdkCommandLine.getFlagForce();
|
||||||
AvdManager avdManager = new AvdManager(mSdkManager, mSdkLog);
|
AvdManager avdManager = new AvdManager(mSdkManager, mSdkLog);
|
||||||
|
|
||||||
String avdName = mSdkCommandLine.getParamName();
|
String avdName = mSdkCommandLine.getParamName();
|
||||||
@@ -522,8 +524,7 @@ class Main {
|
|||||||
|
|
||||||
AvdInfo info = avdManager.getAvd(avdName, false /*validAvdOnly*/);
|
AvdInfo info = avdManager.getAvd(avdName, false /*validAvdOnly*/);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
if (mSdkCommandLine.getFlagForce()) {
|
if (removePrevious) {
|
||||||
removePrevious = true;
|
|
||||||
mSdkLog.warning(
|
mSdkLog.warning(
|
||||||
"Android Virtual Device '%s' already exists and will be replaced.",
|
"Android Virtual Device '%s' already exists and will be replaced.",
|
||||||
avdName);
|
avdName);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public final class AvdManager {
|
|||||||
* @param targetHash the target hash
|
* @param targetHash the target hash
|
||||||
* @param target The target. Can be null, if the target was not resolved.
|
* @param target The target. Can be null, if the target was not resolved.
|
||||||
* @param properties The property map. Can be null.
|
* @param properties The property map. Can be null.
|
||||||
* @param error The error describing why this AVD is invalid. Cannot be null.
|
* @param status The {@link AvdStatus} of this AVD. Cannot be null.
|
||||||
*/
|
*/
|
||||||
public AvdInfo(String name, String path, String targetHash, IAndroidTarget target,
|
public AvdInfo(String name, String path, String targetHash, IAndroidTarget target,
|
||||||
Map<String, String> properties, AvdStatus status) {
|
Map<String, String> properties, AvdStatus status) {
|
||||||
@@ -193,7 +193,7 @@ public final class AvdManager {
|
|||||||
mPath = path;
|
mPath = path;
|
||||||
mTargetHash = targetHash;
|
mTargetHash = targetHash;
|
||||||
mTarget = target;
|
mTarget = target;
|
||||||
mProperties = Collections.unmodifiableMap(properties);
|
mProperties = properties == null ? null : Collections.unmodifiableMap(properties);
|
||||||
mStatus = status;
|
mStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ public final class AvdManager {
|
|||||||
return mTargetHash;
|
return mTargetHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the target of the AVD, or <code>null</code> if it has not been resolved */
|
/** Returns the target of the AVD, or <code>null</code> if it has not been resolved. */
|
||||||
public IAndroidTarget getTarget() {
|
public IAndroidTarget getTarget() {
|
||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ public final class AvdManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of properties for the AVD.
|
* Returns an unmodifiable map of properties for the AVD. This can be null.
|
||||||
*/
|
*/
|
||||||
public Map<String, String> getProperties() {
|
public Map<String, String> getProperties() {
|
||||||
return mProperties;
|
return mProperties;
|
||||||
@@ -1173,7 +1173,9 @@ public final class AvdManager {
|
|||||||
|
|
||||||
// create a new map
|
// create a new map
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
properties.putAll(oldProperties);
|
if (oldProperties != null) {
|
||||||
|
properties.putAll(oldProperties);
|
||||||
|
}
|
||||||
|
|
||||||
AvdStatus status;
|
AvdStatus status;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user