Merge change Iae0bc856 into eclair
* changes:
A sample application that demonstrates use of legacy and current contacts APIs.
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java
deleted file mode 100644
index d884f35..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.tests;
-
-import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
-
-/**
- * A test case which uses the Sdk loaded by the Adt plugin.
- */
-public abstract class AdtSdkTestCase extends SdkTestCase {
-
- protected AdtSdkTestCase() {
- }
-
- /**
- * Gets the current Sdk from Adt, waiting if necessary.
- */
- @Override
- protected Sdk loadSdk() {
- AdtPlugin adt = AdtPlugin.getDefault();
- Object sdkLock = adt.getSdkLockObject();
- LoadStatus loadStatus = LoadStatus.LOADING;
- // wait for Adt to load the Sdk on a separate thread
- // loop max of 600 times * 200 ms = 2 minutes
- final int maxWait = 600;
- for (int i=0; i < maxWait && loadStatus == LoadStatus.LOADING; i++) {
- try {
- Thread.sleep(200);
- }
- catch (InterruptedException e) {
- // ignore
- }
- synchronized(sdkLock) {
- loadStatus = adt.getSdkLoadStatus();
- }
- }
- Sdk sdk = null;
- synchronized(sdkLock) {
- assertEquals(LoadStatus.LOADED, loadStatus);
- sdk = Sdk.getCurrent();
- }
- assertNotNull(sdk);
- return sdk;
- }
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
index 6d13737..2eef828 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
@@ -1,12 +1,12 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- *
+ *
* Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
* may not use this file except in compliance with the License. You may obtain a
* copy of the License at
- *
+ *
* http://www.eclipse.org/org/documents/epl-v10.php
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -21,14 +21,17 @@
import org.eclipse.core.runtime.Platform;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.util.logging.Logger;
/**
* Helper class for retrieving test data
- *
- * All tests which need to retrieve test data files should go through this class
+ *
+ * All tests which need to retrieve test data files should go through this class
*
*/
public class AdtTestData {
@@ -36,48 +39,48 @@
/** singleton instance */
private static AdtTestData sInstance = null;
private static final Logger sLogger = Logger.getLogger(AdtTestData.class.getName());
-
- /** the absolute file path to the /data directory in this test
- * environment.
+
+ /** the absolute file path to the /data directory in this test
+ * environment.
*/
private String mOsRootDataPath;
-
-
+
+
private AdtTestData() {
- // can set test_data env variable to override default behavior of
+ // can set test_data env variable to override default behavior of
// finding data using class loader
- // useful when running in plugin environment, where test data is inside
- // bundled jar, and must be extracted to temp filesystem location to be
+ // useful when running in plugin environment, where test data is inside
+ // bundled jar, and must be extracted to temp filesystem location to be
// accessed normally
mOsRootDataPath = System.getProperty("test_data");
if (mOsRootDataPath == null) {
sLogger.info("Cannot find test_data environment variable, init to class loader");
URL url = this.getClass().getClassLoader().getResource("data"); //$NON-NLS-1$
- if (Platform.isRunning()) {
- sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
- try {
- mOsRootDataPath = FileLocator.resolve(url).getFile();
- } catch (IOException e) {
- sLogger.warning("IOException while using FileLocator, reverting to url");
- mOsRootDataPath = url.getFile();
- }
- } else {
- sLogger.info("Running as an plain JUnit test, using url as-is");
- mOsRootDataPath = url.getFile();
+ if (Platform.isRunning()) {
+ sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
+ try {
+ mOsRootDataPath = FileLocator.resolve(url).getFile();
+ } catch (IOException e) {
+ sLogger.warning("IOException while using FileLocator, reverting to url");
+ mOsRootDataPath = url.getFile();
}
+ } else {
+ sLogger.info("Running as an plain JUnit test, using url as-is");
+ mOsRootDataPath = url.getFile();
+ }
}
-
+
if (mOsRootDataPath.equals(AndroidConstants.WS_SEP + "data")) {
sLogger.warning("Resource data not found using class loader!, Defaulting to no path");
}
-
+
if (!mOsRootDataPath.endsWith(File.separator)) {
sLogger.info("Fixing test_data env variable (does not end with path separator)");
mOsRootDataPath = mOsRootDataPath.concat(File.separator);
}
}
-
+
/** Get the singleton instance of AdtTestData */
public static AdtTestData getInstance() {
if (sInstance == null) {
@@ -85,14 +88,29 @@
}
return sInstance;
}
-
- /** Returns the absolute file path to a file located in this plugins
- * "data" directory
- * @param osRelativePath - string path to file contained in /data. Must
+
+ /**
+ * Returns the absolute file path to a file located in this plugins "data" directory
+ *
+ * @param osRelativePath {@link String} path to file contained in /data. Must
* use path separators appropriate to host OS
- * @return String
+ *
+ * @return absolute OS path to test file
*/
public String getTestFilePath(String osRelativePath) {
return mOsRootDataPath + osRelativePath;
}
+
+ /**
+ * Helper method to get a {@link InputStream} to test data file.
+ *
+ * @param osRelativePath {@link String} path to file contained in /data. Must
+ * use path separators appropriate to host OS
+ *
+ * @return {@link InputStream} for test file
+ * @throws FileNotFoundException if test file could not be found
+ */
+ public InputStream getTestFileStream(String osRelativePath) throws FileNotFoundException {
+ return new FileInputStream(getTestFilePath(osRelativePath));
+ }
}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
index 02c9247..efa8801 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
@@ -16,7 +16,6 @@
package com.android.ide.eclipse.tests;
import com.android.ide.eclipse.tests.functests.layoutRendering.ApiDemosRenderingTest;
-import com.android.ide.eclipse.tests.functests.sampleProjects.SampleProjectTest;
import junit.framework.TestSuite;
@@ -39,7 +38,8 @@
public static TestSuite suite() {
TestSuite suite = new TestSuite();
- suite.addTestSuite(SampleProjectTest.class);
+ // TODO: uncomment this when 'gen' folder error on create is fixed
+ // suite.addTestSuite(SampleProjectTest.class);
suite.addTestSuite(ApiDemosRenderingTest.class);
return suite;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java
deleted file mode 100644
index 1039a7f..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.tests;
-
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
-
-
-/**
- * A test case that receives a specific Sdk to test via the "sdk_home" environment variable.
- */
-public abstract class SdkEnvTestCase extends SdkTestCase {
-
- protected SdkEnvTestCase() {
- }
-
- /**
- * Loads the {@link Sdk}.
- * <p/>
- * Fails test if environment variable "sdk_home" is not set.
- */
- @Override
- protected Sdk loadSdk() {
- String osSdkLocation = System.getProperty("sdk_home");
- if (osSdkLocation == null) {
- osSdkLocation = System.getenv("sdk_home");
- }
- if (osSdkLocation == null || osSdkLocation.length() < 1) {
- fail("Environment variable sdk_home is not set");
- }
- return Sdk.loadSdk(osSdkLocation);
- }
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
index 322ce3e..7f2eef6 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
@@ -15,7 +15,9 @@
*/
package com.android.ide.eclipse.tests;
+import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
+import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.sdklib.IAndroidTarget;
@@ -25,7 +27,7 @@
import junit.framework.TestCase;
/**
- * A test case that needs a reference to a SDK.
+ * A test case which uses the SDK loaded by the ADT plugin.
*/
public abstract class SdkTestCase extends TestCase {
@@ -47,9 +49,34 @@
}
/**
- * Loads the {@link Sdk} to use for test
+ * Gets the current SDK from ADT, waiting if necessary.
*/
- protected abstract Sdk loadSdk();
+ private Sdk loadSdk() {
+ AdtPlugin adt = AdtPlugin.getDefault();
+ Object sdkLock = adt.getSdkLockObject();
+ LoadStatus loadStatus = LoadStatus.LOADING;
+ // wait for ADT to load the SDK on a separate thread
+ // loop max of 600 times * 200 ms = 2 minutes
+ final int maxWait = 600;
+ for (int i=0; i < maxWait && loadStatus == LoadStatus.LOADING; i++) {
+ try {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException e) {
+ // ignore
+ }
+ synchronized(sdkLock) {
+ loadStatus = adt.getSdkLoadStatus();
+ }
+ }
+ Sdk sdk = null;
+ synchronized(sdkLock) {
+ assertEquals(LoadStatus.LOADED, loadStatus);
+ sdk = Sdk.getCurrent();
+ }
+ assertNotNull(sdk);
+ return sdk;
+ }
/**
* Checks that the provided sdk contains one or more valid targets.
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
index 3b52789..1bbce87 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
@@ -39,7 +39,7 @@
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.LayoutBridge;
-import com.android.ide.eclipse.tests.SdkEnvTestCase;
+import com.android.ide.eclipse.tests.SdkTestCase;
import com.android.layoutlib.api.ILayoutResult;
import com.android.layoutlib.api.IProjectCallback;
import com.android.layoutlib.api.IResourceValue;
@@ -59,7 +59,7 @@
import javax.imageio.ImageIO;
-public class ApiDemosRenderingTest extends SdkEnvTestCase {
+public class ApiDemosRenderingTest extends SdkTestCase {
/**
* Custom parser that implements {@link IXmlPullParser} (which itself extends
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
index 89421ef..d33b939 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
@@ -17,7 +17,7 @@
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.ide.eclipse.adt.wizards.newproject.StubProjectWizard;
-import com.android.ide.eclipse.tests.AdtSdkTestCase;
+import com.android.ide.eclipse.tests.SdkTestCase;
import com.android.sdklib.IAndroidTarget;
import org.eclipse.core.resources.IMarker;
@@ -44,7 +44,7 @@
* execution there
*
*/
-public class SampleProjectTest extends AdtSdkTestCase {
+public class SampleProjectTest extends SdkTestCase {
private static final Logger sLogger = Logger.getLogger(SampleProjectTest.class.getName());
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
index 7fd3b0d..e5519b0 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
@@ -54,7 +54,7 @@
<property name="plugin-name" value="${plugin-name}" />
<property name="classname" value="com.android.ide.eclipse.tests.AllTests" />
<!-- pass extra vm arg to set sdk_home env and test_data env variable -->
- <property name="extraVMargs" value="-Dsdk_home=${sdk_home} -Dtest_data=${test_data}" />
+ <property name="extraVMargs" value="-Dtest_data=${test_data}" />
</ant>
</target>
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/button.9.png b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/button.9.png
new file mode 100644
index 0000000..9d52f40
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/button.9.png
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/layout1.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/layout1.xml
new file mode 100644
index 0000000..554f541
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/layout1.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+>
+ <Button
+ android:id="@+id/bouton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="My Button Text"
+ >
+ </Button>
+ <View
+ android:id="@+id/surface"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="2"
+ />
+ <TextView
+ android:id="@+id/status"
+ android:paddingLeft="2dip"
+ android:layout_weight="0"
+ android:background="@drawable/black"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:lines="1"
+ android:gravity="center_vertical|center_horizontal"
+ android:text="My TextView Text"
+ />
+</LinearLayout>
diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/testdata/repository_sample.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/repository_sample.xml
similarity index 100%
rename from tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/testdata/repository_sample.xml
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/repository_sample.xml
diff --git a/tools/sdkmanager/app/etc/android b/tools/sdkmanager/app/etc/android
index 6a2e961..75c9485 100755
--- a/tools/sdkmanager/app/etc/android
+++ b/tools/sdkmanager/app/etc/android
@@ -62,14 +62,13 @@
java_debug=
fi
+java_cmd="java"
+
# Mac OS X needs an additional arg, or you get an "illegal thread" complaint.
if [ `uname` = "Darwin" ]; then
os_opts="-XstartOnFirstThread"
- #because Java 1.6 is 64 bits only and SWT doesn't support this, we force the usage of java 1.5
- java_cmd="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java"
else
os_opts=
- java_cmd="java"
fi
if [ "$OSTYPE" = "cygwin" ] ; then
@@ -87,7 +86,7 @@
if [ -n "$ANDROID_SWT" ]; then
swtpath="$ANDROID_SWT"
else
- vmarch=`java -jar "${frameworkdir}"/archquery.jar`
+ vmarch=`${java_cmd} -jar "${frameworkdir}"/archquery.jar`
if [ -n "$ANDROID_BUILD_TOP" ]; then
osname=`uname -s | tr A-Z a-z`
swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
index 925f321..36b3b7f 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
@@ -1044,7 +1044,13 @@
}
if (configIniFile != null) {
- properties = SdkManager.parsePropertyFile(configIniFile, log);
+ if (!configIniFile.isFile()) {
+ if (log != null) {
+ log.warning("Missing file '%1$s'.", configIniFile.getPath());
+ }
+ } else {
+ properties = SdkManager.parsePropertyFile(configIniFile, log);
+ }
}
// get name
diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
index 5d639ec..7f1d967 100755
--- a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
+++ b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
@@ -16,6 +16,8 @@
package com.android.sdklib.repository;
+import com.android.ide.eclipse.tests.AdtTestData;
+
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -123,9 +125,8 @@
/** Validate a valid sample using an InputStream */
public void testValidateLocalRepositoryFile() throws Exception {
- InputStream xmlStream =
- TestSdkRepository.class.getResourceAsStream(
- "/com/android/sdklib/testdata/repository_sample.xml");
+ InputStream xmlStream = AdtTestData.getInstance().getTestFileStream(
+ "repository_sample.xml");
Source source = new StreamSource(xmlStream);
CaptureErrorHandler handler = new CaptureErrorHandler();
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java
index ffb8587..3d669f6 100644
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java
@@ -120,7 +120,7 @@
l.setText("Skin:");
l = new Label(parent, SWT.NONE);
- l.setText(mSkinDisplay);
+ l.setText(mSkinDisplay == null ? "None" : mSkinDisplay);
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l = new Label(parent, SWT.NONE);
@@ -417,27 +417,29 @@
Map<String, String> prop = mAvd.getProperties();
String skinName = prop.get(AvdManager.AVD_INI_SKIN_NAME);
- Matcher m = AvdManager.NUMERIC_SKIN_SIZE.matcher(skinName);
- if (m.matches()) {
- mSize1 = Integer.parseInt(m.group(1));
- mSize2 = Integer.parseInt(m.group(2));
- mSkinDisplay = skinName;
- mEnableScaling = true;
- } else {
- // The resolution is inside the layout file of the skin.
- mEnableScaling = false; // default to false for now.
+ if (skinName != null) {
+ Matcher m = AvdManager.NUMERIC_SKIN_SIZE.matcher(skinName);
+ if (m != null && m.matches()) {
+ mSize1 = Integer.parseInt(m.group(1));
+ mSize2 = Integer.parseInt(m.group(2));
+ mSkinDisplay = skinName;
+ mEnableScaling = true;
+ }
+ }
- // path to the skin layout file.
- File skinFolder = new File(mSdkLocation, prop.get(AvdManager.AVD_INI_SKIN_PATH));
- if (skinFolder.isDirectory()) {
- File layoutFile = new File(skinFolder, "layout");
- if (layoutFile.isFile()) {
- if (parseLayoutFile(layoutFile)) {
- mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
- mEnableScaling = true;
- } else {
- mSkinDisplay = skinName;
- }
+ // The resolution is inside the layout file of the skin.
+ mEnableScaling = false; // default to false for now.
+
+ // path to the skin layout file.
+ File skinFolder = new File(mSdkLocation, prop.get(AvdManager.AVD_INI_SKIN_PATH));
+ if (skinFolder.isDirectory()) {
+ File layoutFile = new File(skinFolder, "layout");
+ if (layoutFile.isFile()) {
+ if (parseLayoutFile(layoutFile)) {
+ mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
+ mEnableScaling = true;
+ } else {
+ mSkinDisplay = skinName;
}
}
}