aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager
diff options
context:
space:
mode:
Diffstat (limited to 'sdkmanager')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java40
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java10
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java8
3 files changed, 50 insertions, 8 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index ee5879c..f7cd55a 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -903,6 +903,28 @@ public class Main {
}
/**
+ * Displays the ABIs valid for the given target.
+ */
+ private void displayAbiList(IAndroidTarget target, String message) {
+ String[] abis = target.getAbiList();
+ mSdkLog.printf(message);
+ if (abis != null) {
+ boolean first = true;
+ for (String skin : abis) {
+ if (first == false) {
+ mSdkLog.printf(", ");
+ } else {
+ first = false;
+ }
+ mSdkLog.printf(skin);
+ }
+ mSdkLog.printf("\n");
+ } else {
+ mSdkLog.printf("no ABIs.\n");
+ }
+ }
+
+ /**
* Displays the list of available AVDs for the given AvdManager.
*
* @param avdManager
@@ -1105,14 +1127,26 @@ public class Main {
oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
}
- // NOTE: need to update with command line processor selectivity
+ String abiType = mSdkCommandLine.getParamAbi();
+ if (target != null && (abiType == null || abiType.length() == 0)) {
+ String[] abis = target.getAbiList();
+ if (abis != null && abis.length == 1) {
+ // Auto-select the single ABI available
+ abiType = abis[0];
+ mSdkLog.printf("Auto-selecting single ABI %1$s", abiType);
+ } else {
+ displayAbiList(target, "Valid ABIs: ");
+ errorAndExit("This platform has more than one ABI. Please specify one using --%1$s.",
+ SdkCommandLine.KEY_ABI);
+
+ }
+ }
- String preferredAbi = SdkConstants.ABI_ARMEABI;
@SuppressWarnings("unused") // newAvdInfo is never read, yet useful for debugging
AvdInfo newAvdInfo = avdManager.createAvd(avdFolder,
avdName,
target,
- preferredAbi,
+ abiType,
skin,
mSdkCommandLine.getParamSdCard(),
hardwareConfig,
diff --git a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
index 6dabb84..3bfc12b 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
@@ -83,6 +83,7 @@ class SdkCommandLine extends CommandLineProcessor {
public static final String KEY_SNAPSHOT = "snapshot"; //$NON-NLS-1$
public static final String KEY_COMPACT = "compact"; //$NON-NLS-1$
public static final String KEY_EOL_NULL = "null"; //$NON-NLS-1$
+ public static final String KEY_ABI = "abi"; //$NON-NLS-1$
/**
* Action definitions for SdkManager command line.
@@ -205,6 +206,10 @@ class SdkCommandLine extends CommandLineProcessor {
define(Mode.BOOLEAN, false,
VERB_CREATE, OBJECT_AVD, "a", KEY_SNAPSHOT, //$NON-NLS-1$
"Place a snapshots file in the AVD, to enable persistence.", false);
+ define(Mode.STRING, false,
+ VERB_CREATE, OBJECT_AVD, "b", KEY_ABI, //$NON-NLS-1$
+ "The ABI to use for the AVD. The default is to auto-select the ABI if the platform has only one ABI for its system images.",
+ null);
// --- delete avd ---
@@ -537,6 +542,11 @@ class SdkCommandLine extends CommandLineProcessor {
return ((String) getValue(null, null, KEY_FILTER));
}
+ /** Helper to retrieve the --abi value. */
+ public String getParamAbi() {
+ return ((String) getValue(null, null, KEY_ABI));
+ }
+
/** Helper to retrieve the --proxy-host value. */
public String getParamProxyHost() {
return ((String) getValue(null, null, KEY_PROXY_HOST));
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
index 7a3b23c..1ca7c07 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
@@ -527,8 +527,7 @@ public class AvdManager {
File userdataSrc = new File(imagePath, USERDATA_IMG);
if (userdataSrc.exists() == false && target.isPlatform() == false) {
- imagePath =
- target.getParent().getImagePath(abiType);
+ imagePath = target.getParent().getImagePath(abiType);
userdataSrc = new File(imagePath, USERDATA_IMG);
}
@@ -836,9 +835,8 @@ public class AvdManager {
return null;
}
- /** Copy the nominated file to the given destination.
- * @param source
- * @param destination
+ /**
+ * Copy the nominated file to the given destination.
*
* @throws FileNotFoundException
* @throws IOException