aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2009-06-29 08:01:02 -0700
committerXavier Ducrohet <xav@android.com>2009-06-29 08:01:02 -0700
commit430c7319936142604c88e7d50e784edbeb5deada (patch)
tree46683c4bc60e10f32279bac0fa825fdbdc42232a /sdkmanager/app
parent3c26d17a587db68572c9f938fa83f7908a46f561 (diff)
downloadsdk-430c7319936142604c88e7d50e784edbeb5deada.zip
sdk-430c7319936142604c88e7d50e784edbeb5deada.tar.gz
sdk-430c7319936142604c88e7d50e784edbeb5deada.tar.bz2
Skins can now provide their own hardware support (via AVDs)
Diffstat (limited to 'sdkmanager/app')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java60
1 files changed, 41 insertions, 19 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index b5988ff..1038d91 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -597,21 +597,8 @@ class Main {
avdName + AvdManager.AVD_FOLDER_EXTENSION);
}
- Map<String, String> hardwareConfig = null;
- if (target.isPlatform()) {
- try {
- hardwareConfig = promptForHardware(target);
- } catch (IOException e) {
- errorAndExit(e.getMessage());
- }
- }
-
- AvdInfo oldAvdInfo = null;
- if (removePrevious) {
- oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
- }
-
// Validate skin is either default (empty) or NNNxMMM or a valid skin name.
+ Map<String, String> skinHardwareConfig = null;
String skin = mSdkCommandLine.getParamSkin();
if (skin != null && skin.length() == 0) {
skin = null;
@@ -623,6 +610,17 @@ class Main {
if (skin.equalsIgnoreCase(s)) {
skin = s; // Make skin names case-insensitive.
valid = true;
+
+ // get the hardware properties for this skin
+ File skinFile = avdManager.getSkinPath(skin, target);
+ if (skinFile.isDirectory()) { // this should not fail since we got the skin
+ // name from the target
+ File skinHardwareFle = new File(skinFile, AvdManager.HARDWARE_INI);
+ if (skinHardwareFle.isFile()) {
+ skinHardwareConfig = SdkManager.parsePropertyFile(
+ skinHardwareFle, mSdkLog);
+ }
+ }
break;
}
}
@@ -639,6 +637,20 @@ class Main {
}
}
+ Map<String, String> hardwareConfig = null;
+ if (target.isPlatform()) {
+ try {
+ hardwareConfig = promptForHardware(target, skinHardwareConfig);
+ } catch (IOException e) {
+ errorAndExit(e.getMessage());
+ }
+ }
+
+ AvdInfo oldAvdInfo = null;
+ if (removePrevious) {
+ oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
+ }
+
AvdInfo newAvdInfo = avdManager.createAvd(avdFolder,
avdName,
target,
@@ -805,7 +817,8 @@ class Main {
* Prompts the user to setup a hardware config for a Platform-based AVD.
* @throws IOException
*/
- private Map<String, String> promptForHardware(IAndroidTarget createTarget) throws IOException {
+ private Map<String, String> promptForHardware(IAndroidTarget createTarget,
+ Map<String, String> skinHardwareConfig) throws IOException {
byte[] readLineBuffer = new byte[256];
String result;
String defaultAnswer = "no";
@@ -821,8 +834,8 @@ class Main {
}
if (getBooleanReply(result) == false) {
- // no custom config.
- return null;
+ // no custom config, return the skin hardware config in case there is one.
+ return skinHardwareConfig;
}
mSdkLog.printf("\n"); // empty line
@@ -846,8 +859,12 @@ class Main {
}
String defaultValue = property.getDefault();
+ String defaultFromSkin = skinHardwareConfig != null ? skinHardwareConfig.get(
+ property.getName()) : null;
- if (defaultValue != null) {
+ if (defaultFromSkin != null) {
+ mSdkLog.printf("%s [%s (from skin)]:", property.getName(), defaultFromSkin);
+ } else if (defaultValue != null) {
mSdkLog.printf("%s [%s]:", property.getName(), defaultValue);
} else {
mSdkLog.printf("%s (%s):", property.getName(), property.getType());
@@ -855,7 +872,12 @@ class Main {
result = readLine(readLineBuffer);
if (result.length() == 0) {
- if (defaultValue != null) {
+ if (defaultFromSkin != null || defaultValue != null) {
+ if (defaultFromSkin != null) {
+ // we need to write this one in the AVD file
+ map.put(property.getName(), defaultFromSkin);
+ }
+
mSdkLog.printf("\n"); // empty line
i++; // go to the next property if we have a valid default value.
// if there's no default, we'll redo this property