aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs/sdklib
diff options
context:
space:
mode:
Diffstat (limited to 'sdkmanager/libs/sdklib')
-rw-r--r--sdkmanager/libs/sdklib/.classpath1
-rw-r--r--sdkmanager/libs/sdklib/Android.mk1
-rw-r--r--sdkmanager/libs/sdklib/manifest.txt2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java1
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/ISystemImage.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/PlatformTarget.java1
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java508
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java1
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/StdSdkLog.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java1
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Abi.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java3
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceWriter.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdInfo.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java6
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java12
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AdbWrapper.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java4
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/archives/ArchiveInstaller.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ExtraPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java2
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/io/FileOp.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java359
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java670
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java113
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java747
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTest.java1
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java4
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java4
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformTarget.java2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockAddonPackage.java3
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/io/MockFileOp.java2
-rw-r--r--sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/AndroidManifestParserTest.java163
-rw-r--r--sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/SupportsScreensTest.java146
47 files changed, 49 insertions, 2752 deletions
diff --git a/sdkmanager/libs/sdklib/.classpath b/sdkmanager/libs/sdklib/.classpath
index b93cfda..0cb20b5 100644
--- a/sdkmanager/libs/sdklib/.classpath
+++ b/sdkmanager/libs/sdklib/.classpath
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/commons-compress/commons-compress-1.0.jar"/>
diff --git a/sdkmanager/libs/sdklib/Android.mk b/sdkmanager/libs/sdklib/Android.mk
index e4ee53c..9ba356b 100644
--- a/sdkmanager/libs/sdklib/Android.mk
+++ b/sdkmanager/libs/sdklib/Android.mk
@@ -26,7 +26,6 @@ LOCAL_JAR_MANIFEST := manifest.txt
# sdkmanager/sdklib/manifest.txt
# sdkmanager/app/etc/android.bat
LOCAL_JAVA_LIBRARIES := \
- androidprefs \
layoutlib_api \
common \
mkidentity-prebuilt \
diff --git a/sdkmanager/libs/sdklib/manifest.txt b/sdkmanager/libs/sdklib/manifest.txt
index 6229866..3751315 100644
--- a/sdkmanager/libs/sdklib/manifest.txt
+++ b/sdkmanager/libs/sdklib/manifest.txt
@@ -1 +1 @@
-Class-Path: androidprefs.jar layoutlib_api.jar common.jar mkidentity.jar commons-compress-1.0.jar httpclient-4.1.1.jar httpcore-4.1.jar httpmime-4.1.1.jar commons-logging-1.1.1.jar commons-codec-1.4.jar dvlib.jar
+Class-Path: layoutlib_api.jar common.jar mkidentity.jar commons-compress-1.0.jar httpclient-4.1.1.jar httpcore-4.1.jar httpmime-4.1.1.jar commons-logging-1.1.1.jar commons-codec-1.4.jar dvlib.jar
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
index b30e0cc..12d4a49 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/AddOnTarget.java
@@ -16,6 +16,8 @@
package com.android.sdklib;
+import com.android.SdkConstants;
+
import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
index 080651a..44ffa63 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
@@ -16,6 +16,7 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.sdklib.repository.PkgProps;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/ISystemImage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/ISystemImage.java
index 59ed9c6..7a69030 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/ISystemImage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/ISystemImage.java
@@ -16,6 +16,8 @@
package com.android.sdklib;
+import com.android.SdkConstants;
+
import java.io.File;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/PlatformTarget.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/PlatformTarget.java
index ac8de23..40e2b92 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/PlatformTarget.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/PlatformTarget.java
@@ -16,6 +16,7 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.sdklib.SdkManager.LayoutlibVersion;
import com.android.sdklib.util.SparseArray;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
deleted file mode 100644
index 9e65765..0000000
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.sdklib;
-
-import com.android.AndroidConstants;
-
-import java.io.File;
-
-/**
- * Constant definition class.<br>
- * <br>
- * Most constants have a prefix defining the content.
- * <ul>
- * <li><code>OS_</code> OS path constant. These paths are different depending on the platform.</li>
- * <li><code>FN_</code> File name constant.</li>
- * <li><code>FD_</code> Folder name constant.</li>
- * </ul>
- *
- */
-public final class SdkConstants {
- public final static int PLATFORM_UNKNOWN = 0;
- public final static int PLATFORM_LINUX = 1;
- public final static int PLATFORM_WINDOWS = 2;
- public final static int PLATFORM_DARWIN = 3;
-
- /**
- * Returns current platform, one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN},
- * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}.
- */
- public final static int CURRENT_PLATFORM = currentPlatform();
-
- /**
- * Charset for the ini file handled by the SDK.
- */
- public final static String INI_CHARSET = "UTF-8"; //$NON-NLS-1$
-
- /** An SDK Project's AndroidManifest.xml file */
- public static final String FN_ANDROID_MANIFEST_XML= "AndroidManifest.xml"; //$NON-NLS-1$
- /** pre-dex jar filename. i.e. "classes.jar" */
- public final static String FN_CLASSES_JAR = "classes.jar"; //$NON-NLS-1$
- /** Dex filename inside the APK. i.e. "classes.dex" */
- public final static String FN_APK_CLASSES_DEX = "classes.dex"; //$NON-NLS-1$
-
- /** An SDK Project's build.xml file */
- public final static String FN_BUILD_XML = "build.xml"; //$NON-NLS-1$
-
- /** Name of the framework library, i.e. "android.jar" */
- public static final String FN_FRAMEWORK_LIBRARY = "android.jar"; //$NON-NLS-1$
- /** Name of the layout attributes, i.e. "attrs.xml" */
- public static final String FN_ATTRS_XML = "attrs.xml"; //$NON-NLS-1$
- /** Name of the layout attributes, i.e. "attrs_manifest.xml" */
- public static final String FN_ATTRS_MANIFEST_XML = "attrs_manifest.xml"; //$NON-NLS-1$
- /** framework aidl import file */
- public static final String FN_FRAMEWORK_AIDL = "framework.aidl"; //$NON-NLS-1$
- /** framework renderscript folder */
- public static final String FN_FRAMEWORK_RENDERSCRIPT = "renderscript"; //$NON-NLS-1$
- /** framework include folder */
- public static final String FN_FRAMEWORK_INCLUDE = "include"; //$NON-NLS-1$
- /** framework include (clang) folder */
- public static final String FN_FRAMEWORK_INCLUDE_CLANG = "clang-include"; //$NON-NLS-1$
- /** layoutlib.jar file */
- public static final String FN_LAYOUTLIB_JAR = "layoutlib.jar"; //$NON-NLS-1$
- /** widget list file */
- public static final String FN_WIDGETS = "widgets.txt"; //$NON-NLS-1$
- /** Intent activity actions list file */
- public static final String FN_INTENT_ACTIONS_ACTIVITY = "activity_actions.txt"; //$NON-NLS-1$
- /** Intent broadcast actions list file */
- public static final String FN_INTENT_ACTIONS_BROADCAST = "broadcast_actions.txt"; //$NON-NLS-1$
- /** Intent service actions list file */
- public static final String FN_INTENT_ACTIONS_SERVICE = "service_actions.txt"; //$NON-NLS-1$
- /** Intent category list file */
- public static final String FN_INTENT_CATEGORIES = "categories.txt"; //$NON-NLS-1$
-
- /** annotations support jar */
- public static final String FN_ANNOTATIONS_JAR = "annotations.jar"; //$NON-NLS-1$
-
- /** platform build property file */
- public final static String FN_BUILD_PROP = "build.prop"; //$NON-NLS-1$
- /** plugin properties file */
- public final static String FN_PLUGIN_PROP = "plugin.prop"; //$NON-NLS-1$
- /** add-on manifest file */
- public final static String FN_MANIFEST_INI = "manifest.ini"; //$NON-NLS-1$
- /** add-on layout device XML file. */
- public final static String FN_DEVICES_XML = "devices.xml"; //$NON-NLS-1$
- /** hardware properties definition file */
- public final static String FN_HARDWARE_INI = "hardware-properties.ini"; //$NON-NLS-1$
-
- /** project property file */
- public final static String FN_PROJECT_PROPERTIES = "project.properties"; //$NON-NLS-1$
-
- /** project local property file */
- public final static String FN_LOCAL_PROPERTIES = "local.properties"; //$NON-NLS-1$
-
- /** project ant property file */
- public final static String FN_ANT_PROPERTIES = "ant.properties"; //$NON-NLS-1$
-
- /** Skin layout file */
- public final static String FN_SKIN_LAYOUT = "layout"; //$NON-NLS-1$
-
- /** dx.jar file */
- public static final String FN_DX_JAR = "dx.jar"; //$NON-NLS-1$
-
- /** dx executable (with extension for the current OS) */
- public final static String FN_DX =
- "dx" + ext(".bat", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** aapt executable (with extension for the current OS) */
- public final static String FN_AAPT =
- "aapt" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** aidl executable (with extension for the current OS) */
- public final static String FN_AIDL =
- "aidl" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** renderscript executable (with extension for the current OS) */
- public final static String FN_RENDERSCRIPT =
- "llvm-rs-cc" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** adb executable (with extension for the current OS) */
- public final static String FN_ADB =
- "adb" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** emulator executable for the current OS */
- public final static String FN_EMULATOR =
- "emulator" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** zipalign executable (with extension for the current OS) */
- public final static String FN_ZIPALIGN =
- "zipalign" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** dexdump executable (with extension for the current OS) */
- public final static String FN_DEXDUMP =
- "dexdump" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** proguard executable (with extension for the current OS) */
- public final static String FN_PROGUARD =
- "proguard" + ext(".bat", ".sh"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** find_lock for Windows (with extension for the current OS) */
- public final static String FN_FIND_LOCK =
- "find_lock" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /** properties file for SDK Updater packages */
- public final static String FN_SOURCE_PROP = "source.properties"; //$NON-NLS-1$
- /** properties file for content hash of installed packages */
- public final static String FN_CONTENT_HASH_PROP = "content_hash.properties"; //$NON-NLS-1$
- /** properties file for the SDK */
- public final static String FN_SDK_PROP = "sdk.properties"; //$NON-NLS-1$
-
- /**
- * filename for gdbserver.
- */
- public final static String FN_GDBSERVER = "gdbserver"; //$NON-NLS-1$
-
- /** global Android proguard config file */
- public final static String FN_ANDROID_PROGUARD_FILE = "proguard-android.txt"; //$NON-NLS-1$
- /** global Android proguard config file with optimization enabled */
- public final static String FN_ANDROID_OPT_PROGUARD_FILE = "proguard-android-optimize.txt"; //$NON-NLS-1$
- /** default proguard config file with new file extension (for project specific stuff) */
- public final static String FN_PROJECT_PROGUARD_FILE = "proguard-project.txt"; //$NON-NLS-1$
-
- /* Folder Names for Android Projects . */
-
- /** Resources folder name, i.e. "res". */
- public final static String FD_RESOURCES = "res"; //$NON-NLS-1$
- /** Assets folder name, i.e. "assets" */
- public final static String FD_ASSETS = "assets"; //$NON-NLS-1$
- /** Default source folder name in an SDK project, i.e. "src".
- * <p/>
- * Note: this is not the same as {@link #FD_PKG_SOURCES}
- * which is an SDK sources folder for packages. */
- public final static String FD_SOURCES = "src"; //$NON-NLS-1$
- /** Default generated source folder name, i.e. "gen" */
- public final static String FD_GEN_SOURCES = "gen"; //$NON-NLS-1$
- /** Default native library folder name inside the project, i.e. "libs"
- * While the folder inside the .apk is "lib", we call that one libs because
- * that's what we use in ant for both .jar and .so and we need to make the 2 development ways
- * compatible. */
- public final static String FD_NATIVE_LIBS = "libs"; //$NON-NLS-1$
- /** Native lib folder inside the APK: "lib" */
- public final static String FD_APK_NATIVE_LIBS = "lib"; //$NON-NLS-1$
- /** Default output folder name, i.e. "bin" */
- public final static String FD_OUTPUT = "bin"; //$NON-NLS-1$
- /** Classes output folder name, i.e. "classes" */
- public final static String FD_CLASSES_OUTPUT = "classes"; //$NON-NLS-1$
- /** proguard output folder for mapping, etc.. files */
- public final static String FD_PROGUARD = "proguard"; //$NON-NLS-1$
- /** aidl output folder for copied aidl files */
- public final static String FD_AIDL = "aidl"; //$NON-NLS-1$
-
- /* Folder Names for the Android SDK */
-
- /** Name of the SDK platforms folder. */
- public final static String FD_PLATFORMS = "platforms"; //$NON-NLS-1$
- /** Name of the SDK addons folder. */
- public final static String FD_ADDONS = "add-ons"; //$NON-NLS-1$
- /** Name of the SDK system-images folder. */
- public final static String FD_SYSTEM_IMAGES = "system-images"; //$NON-NLS-1$
- /** Name of the SDK sources folder where source packages are installed.
- * <p/>
- * Note this is not the same as {@link #FD_SOURCES} which is the folder name where sources
- * are installed inside a project. */
- public final static String FD_PKG_SOURCES = "sources"; //$NON-NLS-1$
- /** Name of the SDK tools folder. */
- public final static String FD_TOOLS = "tools"; //$NON-NLS-1$
- /** Name of the SDK tools/support folder. */
- public final static String FD_SUPPORT = "support"; //$NON-NLS-1$
- /** Name of the SDK platform tools folder. */
- public final static String FD_PLATFORM_TOOLS = "platform-tools"; //$NON-NLS-1$
- /** Name of the SDK tools/lib folder. */
- public final static String FD_LIB = "lib"; //$NON-NLS-1$
- /** Name of the SDK docs folder. */
- public final static String FD_DOCS = "docs"; //$NON-NLS-1$
- /** Name of the doc folder containing API reference doc (javadoc) */
- public static final String FD_DOCS_REFERENCE = "reference"; //$NON-NLS-1$
- /** Name of the SDK images folder. */
- public final static String FD_IMAGES = "images"; //$NON-NLS-1$
- /** Name of the ABI to support. */
- public final static String ABI_ARMEABI = "armeabi"; //$NON-NLS-1$
- public final static String ABI_ARMEABI_V7A = "armeabi-v7a"; //$NON-NLS-1$
- public final static String ABI_INTEL_ATOM = "x86"; //$NON-NLS-1$
- public final static String ABI_MIPS = "mips"; //$NON-NLS-1$
- /** Name of the CPU arch to support. */
- public final static String CPU_ARCH_ARM = "arm"; //$NON-NLS-1$
- public final static String CPU_ARCH_INTEL_ATOM = "x86"; //$NON-NLS-1$
- public final static String CPU_ARCH_MIPS = "mips"; //$NON-NLS-1$
- /** Name of the CPU model to support. */
- public final static String CPU_MODEL_CORTEX_A8 = "cortex-a8"; //$NON-NLS-1$
-
- /** Name of the SDK skins folder. */
- public final static String FD_SKINS = "skins"; //$NON-NLS-1$
- /** Name of the SDK samples folder. */
- public final static String FD_SAMPLES = "samples"; //$NON-NLS-1$
- /** Name of the SDK extras folder. */
- public final static String FD_EXTRAS = "extras"; //$NON-NLS-1$
- /** Name of the SDK templates folder, i.e. "templates" */
- public final static String FD_TEMPLATES = "templates"; //$NON-NLS-1$
- /** Name of the SDK Ant folder, i.e. "ant" */
- public final static String FD_ANT = "ant"; //$NON-NLS-1$
- /** Name of the SDK data folder, i.e. "data" */
- public final static String FD_DATA = "data"; //$NON-NLS-1$
- /** Name of the SDK renderscript folder, i.e. "rs" */
- public final static String FD_RENDERSCRIPT = "rs"; //$NON-NLS-1$
- /** Name of the SDK resources folder, i.e. "res" */
- public final static String FD_RES = "res"; //$NON-NLS-1$
- /** Name of the SDK font folder, i.e. "fonts" */
- public final static String FD_FONTS = "fonts"; //$NON-NLS-1$
- /** Name of the android sources directory */
- public static final String FD_ANDROID_SOURCES = "sources"; //$NON-NLS-1$
- /** Name of the addon libs folder. */
- public final static String FD_ADDON_LIBS = "libs"; //$NON-NLS-1$
-
- /** Name of the cache folder in the $HOME/.android. */
- public final static String FD_CACHE = "cache"; //$NON-NLS-1$
-
- /** API codename of a release (non preview) system image or platform. **/
- public final static String CODENAME_RELEASE = "REL"; //$NON-NLS-1$
-
- /** Namespace for the resource XML, i.e. "http://schemas.android.com/apk/res/android" */
- public final static String NS_RESOURCES =
- "http://schemas.android.com/apk/res/android"; //$NON-NLS-1$
-
- /** Namespace for the device schema, i.e. "http://schemas.android.com/sdk/devices/1" */
- public static final String NS_DEVICES_XSD =
- "http://schemas.android.com/sdk/devices/1"; //$NON-NLS-1$
-
-
- /** The name of the uses-library that provides "android.test.runner" */
- public final static String ANDROID_TEST_RUNNER_LIB =
- "android.test.runner"; //$NON-NLS-1$
-
- /* Folder path relative to the SDK root */
- /** Path of the documentation directory relative to the sdk folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_DOCS_FOLDER = FD_DOCS + File.separator;
-
- /** Path of the tools directory relative to the sdk folder, or to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_TOOLS_FOLDER = FD_TOOLS + File.separator;
-
- /** Path of the lib directory relative to the sdk folder, or to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_TOOLS_LIB_FOLDER =
- OS_SDK_TOOLS_FOLDER + FD_LIB + File.separator;
-
- /**
- * Path of the lib directory relative to the sdk folder, or to a platform
- * folder. This is an OS path, ending with a separator.
- */
- public final static String OS_SDK_TOOLS_LIB_EMULATOR_FOLDER = OS_SDK_TOOLS_LIB_FOLDER
- + "emulator" + File.separator; //$NON-NLS-1$
-
- /** Path of the platform tools directory relative to the sdk folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_PLATFORM_TOOLS_FOLDER = FD_PLATFORM_TOOLS + File.separator;
-
- /** Path of the Platform tools Lib directory relative to the sdk folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_PLATFORM_TOOLS_LIB_FOLDER =
- OS_SDK_PLATFORM_TOOLS_FOLDER + FD_LIB + File.separator;
-
- /** Path of the bin folder of proguard folder relative to the sdk folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SDK_TOOLS_PROGUARD_BIN_FOLDER =
- SdkConstants.OS_SDK_TOOLS_FOLDER +
- "proguard" + File.separator + //$NON-NLS-1$
- "bin" + File.separator; //$NON-NLS-1$
-
- /* Folder paths relative to a platform or add-on folder */
-
- /** Path of the images directory relative to a platform or addon folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_IMAGES_FOLDER = FD_IMAGES + File.separator;
-
- /** Path of the skin directory relative to a platform or addon folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_SKINS_FOLDER = FD_SKINS + File.separator;
-
- /* Folder paths relative to a Platform folder */
-
- /** Path of the data directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_DATA_FOLDER = FD_DATA + File.separator;
-
- /** Path of the renderscript directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_RENDERSCRIPT_FOLDER = FD_RENDERSCRIPT + File.separator;
-
-
- /** Path of the samples directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_SAMPLES_FOLDER = FD_SAMPLES + File.separator;
-
- /** Path of the resources directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_RESOURCES_FOLDER =
- OS_PLATFORM_DATA_FOLDER + FD_RES + File.separator;
-
- /** Path of the fonts directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_FONTS_FOLDER =
- OS_PLATFORM_DATA_FOLDER + FD_FONTS + File.separator;
-
- /** Path of the android source directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_SOURCES_FOLDER = FD_ANDROID_SOURCES + File.separator;
-
- /** Path of the android templates directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_TEMPLATES_FOLDER = FD_TEMPLATES + File.separator;
-
- /** Path of the Ant build rules directory relative to a platform folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_PLATFORM_ANT_FOLDER = FD_ANT + File.separator;
-
- /** Path of the attrs.xml file relative to a platform folder. */
- public final static String OS_PLATFORM_ATTRS_XML =
- OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator +
- FN_ATTRS_XML;
-
- /** Path of the attrs_manifest.xml file relative to a platform folder. */
- public final static String OS_PLATFORM_ATTRS_MANIFEST_XML =
- OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator +
- FN_ATTRS_MANIFEST_XML;
-
- /** Path of the layoutlib.jar file relative to a platform folder. */
- public final static String OS_PLATFORM_LAYOUTLIB_JAR =
- OS_PLATFORM_DATA_FOLDER + FN_LAYOUTLIB_JAR;
-
- /** Path of the renderscript include folder relative to a platform folder. */
- public final static String OS_FRAMEWORK_RS =
- FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE;
- /** Path of the renderscript (clang) include folder relative to a platform folder. */
- public final static String OS_FRAMEWORK_RS_CLANG =
- FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE_CLANG;
-
- /* Folder paths relative to a addon folder */
- /** Path of the images directory relative to a folder folder.
- * This is an OS path, ending with a separator. */
- public final static String OS_ADDON_LIBS_FOLDER = FD_ADDON_LIBS + File.separator;
-
- /** Skin default **/
- public final static String SKIN_DEFAULT = "default"; //$NON-NLS-1$
-
- /** SDK property: ant templates revision */
- public final static String PROP_SDK_ANT_TEMPLATES_REVISION =
- "sdk.ant.templates.revision"; //$NON-NLS-1$
-
- /** SDK property: default skin */
- public final static String PROP_SDK_DEFAULT_SKIN = "sdk.skin.default"; //$NON-NLS-1$
-
- /* Android Class Constants */
- public final static String CLASS_ACTIVITY = "android.app.Activity"; //$NON-NLS-1$
- public final static String CLASS_APPLICATION = "android.app.Application"; //$NON-NLS-1$
- public final static String CLASS_SERVICE = "android.app.Service"; //$NON-NLS-1$
- public final static String CLASS_BROADCASTRECEIVER = "android.content.BroadcastReceiver"; //$NON-NLS-1$
- public final static String CLASS_CONTENTPROVIDER = "android.content.ContentProvider"; //$NON-NLS-1$
- public final static String CLASS_INSTRUMENTATION = "android.app.Instrumentation"; //$NON-NLS-1$
- public final static String CLASS_INSTRUMENTATION_RUNNER =
- "android.test.InstrumentationTestRunner"; //$NON-NLS-1$
- public final static String CLASS_BUNDLE = "android.os.Bundle"; //$NON-NLS-1$
- public final static String CLASS_R = "android.R"; //$NON-NLS-1$
- public final static String CLASS_MANIFEST_PERMISSION = "android.Manifest$permission"; //$NON-NLS-1$
- public final static String CLASS_INTENT = "android.content.Intent"; //$NON-NLS-1$
- public final static String CLASS_CONTEXT = "android.content.Context"; //$NON-NLS-1$
- public final static String CLASS_VIEW = "android.view.View"; //$NON-NLS-1$
- public final static String CLASS_VIEWGROUP = "android.view.ViewGroup"; //$NON-NLS-1$
- public final static String CLASS_NAME_LAYOUTPARAMS = "LayoutParams"; //$NON-NLS-1$
- public final static String CLASS_VIEWGROUP_LAYOUTPARAMS =
- CLASS_VIEWGROUP + "$" + CLASS_NAME_LAYOUTPARAMS; //$NON-NLS-1$
- public final static String CLASS_NAME_FRAMELAYOUT = "FrameLayout"; //$NON-NLS-1$
- public final static String CLASS_FRAMELAYOUT =
- "android.widget." + CLASS_NAME_FRAMELAYOUT; //$NON-NLS-1$
- public final static String CLASS_PREFERENCE = "android.preference.Preference"; //$NON-NLS-1$
- public final static String CLASS_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; //$NON-NLS-1$
- public final static String CLASS_PREFERENCES =
- "android.preference." + CLASS_NAME_PREFERENCE_SCREEN; //$NON-NLS-1$
- public final static String CLASS_PREFERENCEGROUP = "android.preference.PreferenceGroup"; //$NON-NLS-1$
- public final static String CLASS_PARCELABLE = "android.os.Parcelable"; //$NON-NLS-1$
- public static final String CLASS_FRAGMENT = "android.app.Fragment"; //$NON-NLS-1$
- public static final String CLASS_V4_FRAGMENT = "android.support.v4.app.Fragment"; //$NON-NLS-1$
- /** MockView is part of the layoutlib bridge and used to display classes that have
- * no rendering in the graphical layout editor. */
- public final static String CLASS_MOCK_VIEW = "com.android.layoutlib.bridge.MockView"; //$NON-NLS-1$
-
-
-
- /** Returns the appropriate name for the 'android' command, which is 'android.exe' for
- * Windows and 'android' for all other platforms. */
- public static String androidCmdName() {
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- String cmd = "android"; //$NON-NLS-1$
- if (os.startsWith("Windows")) { //$NON-NLS-1$
- cmd += ".bat"; //$NON-NLS-1$
- }
- return cmd;
- }
-
- /** Returns the appropriate name for the 'mksdcard' command, which is 'mksdcard.exe' for
- * Windows and 'mkdsdcard' for all other platforms. */
- public static String mkSdCardCmdName() {
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- String cmd = "mksdcard"; //$NON-NLS-1$
- if (os.startsWith("Windows")) { //$NON-NLS-1$
- cmd += ".exe"; //$NON-NLS-1$
- }
- return cmd;
- }
-
- /**
- * Returns current platform
- *
- * @return one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN},
- * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}.
- */
- public static int currentPlatform() {
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- if (os.startsWith("Mac OS")) { //$NON-NLS-1$
- return PLATFORM_DARWIN;
- } else if (os.startsWith("Windows")) { //$NON-NLS-1$
- return PLATFORM_WINDOWS;
- } else if (os.startsWith("Linux")) { //$NON-NLS-1$
- return PLATFORM_LINUX;
- }
-
- return PLATFORM_UNKNOWN;
- }
-
- /**
- * Returns current platform's UI name
- *
- * @return one of "Windows", "Mac OS X", "Linux" or "other".
- */
- public static String currentPlatformName() {
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- if (os.startsWith("Mac OS")) { //$NON-NLS-1$
- return "Mac OS X"; //$NON-NLS-1$
- } else if (os.startsWith("Windows")) { //$NON-NLS-1$
- return "Windows"; //$NON-NLS-1$
- } else if (os.startsWith("Linux")) { //$NON-NLS-1$
- return "Linux"; //$NON-NLS-1$
- }
-
- return "Other";
- }
-
- private static String ext(String windowsExtension, String nonWindowsExtension) {
- if (CURRENT_PLATFORM == PLATFORM_WINDOWS) {
- return windowsExtension;
- } else {
- return nonWindowsExtension;
- }
- }
-}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
index 4a88568..2551e8c 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
@@ -16,6 +16,7 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/StdSdkLog.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/StdSdkLog.java
index 5b1e237..914f6ea 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/StdSdkLog.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/StdSdkLog.java
@@ -16,6 +16,8 @@
package com.android.sdklib;
+import com.android.SdkConstants;
+
/**
* An implementation of {@link ISdkLog} that prints to {@link System#out} and {@link System#err}.
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java
index e9a8c57..afc11c7 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java
@@ -16,6 +16,7 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.sdklib.io.FileOp;
import java.io.File;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
index a9b2968..ff18c8b 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
@@ -16,7 +16,7 @@
package com.android.sdklib.build;
-import com.android.sdklib.SdkConstants;
+import com.android.SdkConstants;
import com.android.sdklib.internal.build.DebugKeyProvider;
import com.android.sdklib.internal.build.DebugKeyProvider.IKeyGenOutput;
import com.android.sdklib.internal.build.DebugKeyProvider.KeytoolException;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Abi.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Abi.java
index 8089842..080ae75 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Abi.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Abi.java
@@ -16,7 +16,7 @@
package com.android.sdklib.devices;
-import com.android.sdklib.SdkConstants;
+import com.android.SdkConstants;
public enum Abi {
ARMEABI(SdkConstants.ABI_ARMEABI),
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java
index 8bf45fc..e8d7a88 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java
@@ -17,13 +17,14 @@
package com.android.sdklib.devices;
import com.android.annotations.Nullable;
+import com.android.SdkConstants;
import com.android.prefs.AndroidLocation;
import com.android.prefs.AndroidLocation.AndroidLocationException;
import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
import com.android.sdklib.ISdkLog;
-import com.android.sdklib.SdkConstants;
+import com.android.sdklib.devices.Storage.Unit;
import com.android.sdklib.internal.avd.AvdManager;
import com.android.sdklib.internal.avd.HardwareProperties;
import com.android.sdklib.repository.PkgProps;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceWriter.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceWriter.java
index 34eaab5..4480745 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceWriter.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceWriter.java
@@ -16,9 +16,9 @@
package com.android.sdklib.devices;
+import com.android.SdkConstants;
import com.android.dvlib.DeviceSchema;
import com.android.resources.UiMode;
-import com.android.sdklib.SdkConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdInfo.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdInfo.java
index d2ec9db..cdd3f84 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdInfo.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdInfo.java
@@ -16,9 +16,9 @@
package com.android.sdklib.internal.avd;
+import com.android.SdkConstants;
import com.android.prefs.AndroidLocation.AndroidLocationException;
import com.android.sdklib.IAndroidTarget;
-import com.android.sdklib.SdkConstants;
import java.io.File;
import java.util.Collections;
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 52ce5d6..df703da 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
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.avd;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.io.FileWrapper;
import com.android.prefs.AndroidLocation;
@@ -23,7 +24,6 @@ import com.android.prefs.AndroidLocation.AndroidLocationException;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.ISystemImage;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.devices.DeviceManager;
import com.android.sdklib.devices.DeviceManager.DeviceStatus;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
index f01c63a..57e9073 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
@@ -17,15 +17,15 @@
package com.android.sdklib.internal.project;
import com.android.AndroidConstants;
+import com.android.SdkConstants;
import com.android.io.FileWrapper;
import com.android.io.FolderWrapper;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISdkLog;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
-import com.android.sdklib.xml.AndroidManifest;
-import com.android.sdklib.xml.AndroidXPathFactory;
+import com.android.xml.AndroidManifest;
+import com.android.xml.AndroidXPathFactory;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
index 27879a7..458a433 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
@@ -16,11 +16,7 @@
package com.android.sdklib.internal.project;
-import static com.android.sdklib.SdkConstants.FD_PROGUARD;
-import static com.android.sdklib.SdkConstants.FD_TOOLS;
-import static com.android.sdklib.SdkConstants.FN_ANDROID_PROGUARD_FILE;
-import static com.android.sdklib.SdkConstants.FN_PROJECT_PROGUARD_FILE;
-
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.io.FolderWrapper;
@@ -28,7 +24,6 @@ import com.android.io.IAbstractFile;
import com.android.io.IAbstractFolder;
import com.android.io.StreamException;
import com.android.sdklib.ISdkLog;
-import com.android.sdklib.SdkConstants;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
@@ -200,8 +195,9 @@ public class ProjectProperties implements IPropertySource {
// Note: always use / separators in the properties paths. Both Ant and
// our ExportHelper will convert them properly according to the platform.
"#" + PROPERTY_PROGUARD_CONFIG + "=${" + PROPERTY_SDK +"}/"
- + FD_TOOLS + '/' + FD_PROGUARD + '/'
- + FN_ANDROID_PROGUARD_FILE + ':' + FN_PROJECT_PROGUARD_FILE +'\n' +
+ + SdkConstants.FD_TOOLS + '/' + SdkConstants.FD_PROGUARD + '/'
+ + SdkConstants.FN_ANDROID_PROGUARD_FILE + ':'
+ + SdkConstants.FN_PROJECT_PROGUARD_FILE +'\n' +
"\n";
private final static String BUILD_HEADER =
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java
index a2aefd0..e13ac5e 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java
@@ -16,11 +16,11 @@
package com.android.sdklib.internal.project;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.io.IAbstractFile;
import com.android.io.IAbstractFolder;
import com.android.io.StreamException;
-import com.android.sdklib.SdkConstants;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AdbWrapper.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AdbWrapper.java
index 70474a8..8d4a0c2 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AdbWrapper.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AdbWrapper.java
@@ -16,7 +16,7 @@
package com.android.sdklib.internal.repository;
-import com.android.sdklib.SdkConstants;
+import com.android.SdkConstants;
import java.io.File;
import java.io.IOException;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
index 763863a..91b054f 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.prefs.AndroidLocation;
import com.android.prefs.AndroidLocation.AndroidLocationException;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.internal.repository.UrlOpener.CanceledByUserException;
import com.android.utils.Pair;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java
index bad3125..ce39d90 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java
@@ -16,13 +16,13 @@
package com.android.sdklib.internal.repository;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.ISystemImage;
-import com.android.sdklib.SdkConstants;
-import com.android.sdklib.SdkManager;
import com.android.sdklib.ISystemImage.LocationType;
+import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
import com.android.sdklib.internal.repository.archives.Archive.Os;
import com.android.sdklib.internal.repository.packages.AddonPackage;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/archives/ArchiveInstaller.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/archives/ArchiveInstaller.java
index 17350ed..89a122e 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/archives/ArchiveInstaller.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/archives/ArchiveInstaller.java
@@ -16,10 +16,10 @@
package com.android.sdklib.internal.repository.archives;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.DownloadCache;
import com.android.sdklib.internal.repository.ITaskMonitor;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
index 98ff4ca..a388f54 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
@@ -16,13 +16,13 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
index 3ff2404..927d361 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
@@ -16,9 +16,9 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.sdklib.AndroidVersion;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ExtraPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ExtraPackage.java
index 8cb0e68..1a4a59d 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ExtraPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ExtraPackage.java
@@ -16,11 +16,11 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.NullSdkLog;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.LocalSdkParser;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
index 8bf244d..feab109 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.ITaskMonitor;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
index ed85679..71d91ef 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
index fdacfcc..c46e940 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
@@ -16,9 +16,9 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.AdbWrapper;
import com.android.sdklib.internal.repository.IDescription;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
index 66bda73..06eabb9 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
@@ -16,11 +16,11 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.AndroidVersion.AndroidVersionException;
import com.android.sdklib.IAndroidTarget;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.ITaskMonitor;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
index 785138d..fb38f40 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.AndroidVersion.AndroidVersionException;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.ITaskMonitor;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
index 344a831..d83e44c 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.AndroidVersion.AndroidVersionException;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.SystemImage;
import com.android.sdklib.internal.repository.IDescription;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
index 5527302..8084c6b 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
@@ -16,10 +16,10 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.ITaskMonitor;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/io/FileOp.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/io/FileOp.java
index 0d607a9..7f7a1f2 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/io/FileOp.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/io/FileOp.java
@@ -16,7 +16,7 @@
package com.android.sdklib.io;
-import com.android.sdklib.SdkConstants;
+import com.android.SdkConstants;
import java.io.File;
import java.io.FileInputStream;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java
deleted file mode 100644
index 93cd211..0000000
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.io.IAbstractFile;
-import com.android.io.IAbstractFolder;
-import com.android.io.StreamException;
-import com.android.sdklib.SdkConstants;
-
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-
-/**
- * Helper and Constants for the AndroidManifest.xml file.
- *
- */
-public final class AndroidManifest {
-
- public final static String NODE_MANIFEST = "manifest";
- public final static String NODE_APPLICATION = "application";
- public final static String NODE_ACTIVITY = "activity";
- public final static String NODE_ACTIVITY_ALIAS = "activity-alias";
- public final static String NODE_SERVICE = "service";
- public final static String NODE_RECEIVER = "receiver";
- public final static String NODE_PROVIDER = "provider";
- public final static String NODE_INTENT = "intent-filter";
- public final static String NODE_ACTION = "action";
- public final static String NODE_CATEGORY = "category";
- public final static String NODE_USES_SDK = "uses-sdk";
- public final static String NODE_INSTRUMENTATION = "instrumentation";
- public final static String NODE_USES_LIBRARY = "uses-library";
- public final static String NODE_SUPPORTS_SCREENS = "supports-screens";
- public final static String NODE_USES_CONFIGURATION = "uses-configuration";
- public final static String NODE_USES_FEATURE = "uses-feature";
-
- public final static String ATTRIBUTE_PACKAGE = "package";
- public final static String ATTRIBUTE_VERSIONCODE = "versionCode";
- public final static String ATTRIBUTE_NAME = "name";
- public final static String ATTRIBUTE_REQUIRED = "required";
- public final static String ATTRIBUTE_GLESVERSION = "glEsVersion";
- public final static String ATTRIBUTE_PROCESS = "process";
- public final static String ATTRIBUTE_DEBUGGABLE = "debuggable";
- public final static String ATTRIBUTE_LABEL = "label";
- public final static String ATTRIBUTE_ICON = "icon";
- public final static String ATTRIBUTE_MIN_SDK_VERSION = "minSdkVersion";
- public final static String ATTRIBUTE_TARGET_SDK_VERSION = "targetSdkVersion";
- public final static String ATTRIBUTE_TARGET_PACKAGE = "targetPackage";
- public final static String ATTRIBUTE_TARGET_ACTIVITY = "targetActivity";
- public final static String ATTRIBUTE_MANAGE_SPACE_ACTIVITY = "manageSpaceActivity";
- public final static String ATTRIBUTE_EXPORTED = "exported";
- public final static String ATTRIBUTE_RESIZEABLE = "resizeable";
- public final static String ATTRIBUTE_ANYDENSITY = "anyDensity";
- public final static String ATTRIBUTE_SMALLSCREENS = "smallScreens";
- public final static String ATTRIBUTE_NORMALSCREENS = "normalScreens";
- public final static String ATTRIBUTE_LARGESCREENS = "largeScreens";
- public final static String ATTRIBUTE_REQ_5WAYNAV = "reqFiveWayNav";
- public final static String ATTRIBUTE_REQ_NAVIGATION = "reqNavigation";
- public final static String ATTRIBUTE_REQ_HARDKEYBOARD = "reqHardKeyboard";
- public final static String ATTRIBUTE_REQ_KEYBOARDTYPE = "reqKeyboardType";
- public final static String ATTRIBUTE_REQ_TOUCHSCREEN = "reqTouchScreen";
- public static final String ATTRIBUTE_THEME = "theme";
-
- /**
- * Returns an {@link IAbstractFile} object representing the manifest for the given project.
- *
- * @param projectFolder The project containing the manifest file.
- * @return An IAbstractFile object pointing to the manifest or null if the manifest
- * is missing.
- */
- public static IAbstractFile getManifest(IAbstractFolder projectFolder) {
- IAbstractFile file = projectFolder.getFile(SdkConstants.FN_ANDROID_MANIFEST_XML);
- if (file.exists()) {
- return file;
- }
-
- return null;
- }
-
- /**
- * Returns the package for a given project.
- * @param projectFolder the folder of the project.
- * @return the package info or null (or empty) if not found.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static String getPackage(IAbstractFolder projectFolder)
- throws XPathExpressionException, StreamException {
- IAbstractFile file = getManifest(projectFolder);
- if (file != null) {
- return getPackage(file);
- }
-
- return null;
- }
-
- /**
- * Returns the package for a given manifest.
- * @param manifestFile the manifest to parse.
- * @return the package info or null (or empty) if not found.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static String getPackage(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- return xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/@" + ATTRIBUTE_PACKAGE,
- new InputSource(manifestFile.getContents()));
- }
-
- /**
- * Returns whether the manifest is set to make the application debuggable.
- *
- * If the give manifest does not contain the debuggable attribute then the application
- * is considered to not be debuggable.
- *
- * @param manifestFile the manifest to parse.
- * @return true if the application is debuggable.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static boolean getDebuggable(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- String value = xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/" + NODE_APPLICATION +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_DEBUGGABLE,
- new InputSource(manifestFile.getContents()));
-
- // default is not debuggable, which is the same behavior as parseBoolean
- return Boolean.parseBoolean(value);
- }
-
- /**
- * Returns the value of the versionCode attribute or -1 if the value is not set.
- * @param manifestFile the manifest file to read the attribute from.
- * @return the integer value or -1 if not set.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static int getVersionCode(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- String result = xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_VERSIONCODE,
- new InputSource(manifestFile.getContents()));
-
- try {
- return Integer.parseInt(result);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Returns whether the version Code attribute is set in a given manifest.
- * @param manifestFile the manifest to check
- * @return true if the versionCode attribute is present and its value is not empty.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static boolean hasVersionCode(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- Object result = xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_VERSIONCODE,
- new InputSource(manifestFile.getContents()),
- XPathConstants.NODE);
-
- if (result != null) {
- Node node = (Node)result;
- if (node.getNodeValue().length() > 0) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns the value of the minSdkVersion attribute.
- * <p/>
- * If the attribute is set with an int value, the method returns an Integer object.
- * <p/>
- * If the attribute is set with a codename, it returns the codename as a String object.
- * <p/>
- * If the attribute is not set, it returns null.
- *
- * @param manifestFile the manifest file to read the attribute from.
- * @return the attribute value.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static Object getMinSdkVersion(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- String result = xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/" + NODE_USES_SDK +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_MIN_SDK_VERSION,
- new InputSource(manifestFile.getContents()));
-
- try {
- return Integer.valueOf(result);
- } catch (NumberFormatException e) {
- return result.length() > 0 ? result : null;
- }
- }
-
- /**
- * Returns the value of the targetSdkVersion attribute (defaults to 1 if the attribute is
- * not set), or -1 if the value is a codename.
- * @param manifestFile the manifest file to read the attribute from.
- * @return the integer value or -1 if not set.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static Integer getTargetSdkVersion(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- String result = xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/" + NODE_USES_SDK +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_TARGET_SDK_VERSION,
- new InputSource(manifestFile.getContents()));
-
- try {
- return Integer.valueOf(result);
- } catch (NumberFormatException e) {
- return result.length() > 0 ? -1 : null;
- }
- }
-
- /**
- * Returns the application icon for a given manifest.
- * @param manifestFile the manifest to parse.
- * @return the icon or null (or empty) if not found.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static String getApplicationIcon(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- return xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/" + NODE_APPLICATION +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_ICON,
- new InputSource(manifestFile.getContents()));
- }
-
- /**
- * Returns the application label for a given manifest.
- * @param manifestFile the manifest to parse.
- * @return the label or null (or empty) if not found.
- * @throws XPathExpressionException
- * @throws StreamException If any error happens when reading the manifest.
- */
- public static String getApplicationLabel(IAbstractFile manifestFile)
- throws XPathExpressionException, StreamException {
- XPath xPath = AndroidXPathFactory.newXPath();
-
- return xPath.evaluate(
- "/" + NODE_MANIFEST +
- "/" + NODE_APPLICATION +
- "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX +
- ":" + ATTRIBUTE_LABEL,
- new InputSource(manifestFile.getContents()));
- }
-
- /**
- * Combines a java package, with a class value from the manifest to make a fully qualified
- * class name
- * @param javaPackage the java package from the manifest.
- * @param className the class name from the manifest.
- * @return the fully qualified class name.
- */
- public static String combinePackageAndClassName(String javaPackage, String className) {
- if (className == null || className.length() == 0) {
- return javaPackage;
- }
- if (javaPackage == null || javaPackage.length() == 0) {
- return className;
- }
-
- // the class name can be a subpackage (starts with a '.'
- // char), a simple class name (no dot), or a full java package
- boolean startWithDot = (className.charAt(0) == '.');
- boolean hasDot = (className.indexOf('.') != -1);
- if (startWithDot || hasDot == false) {
-
- // add the concatenation of the package and class name
- if (startWithDot) {
- return javaPackage + className;
- } else {
- return javaPackage + '.' + className;
- }
- } else {
- // just add the class as it should be a fully qualified java name.
- return className;
- }
- }
-
- /**
- * Given a fully qualified activity name (e.g. com.foo.test.MyClass) and given a project
- * package base name (e.g. com.foo), returns the relative activity name that would be used
- * the "name" attribute of an "activity" element.
- *
- * @param fullActivityName a fully qualified activity class name, e.g. "com.foo.test.MyClass"
- * @param packageName The project base package name, e.g. "com.foo"
- * @return The relative activity name if it can be computed or the original fullActivityName.
- */
- public static String extractActivityName(String fullActivityName, String packageName) {
- if (packageName != null && fullActivityName != null) {
- if (packageName.length() > 0 && fullActivityName.startsWith(packageName)) {
- String name = fullActivityName.substring(packageName.length());
- if (name.length() > 0 && name.charAt(0) == '.') {
- return name;
- }
- }
- }
-
- return fullActivityName;
- }
-}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java
deleted file mode 100644
index 1c10828..0000000
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.io.IAbstractFile;
-import com.android.io.IAbstractFolder;
-import com.android.io.StreamException;
-import com.android.resources.Keyboard;
-import com.android.resources.Navigation;
-import com.android.resources.TouchScreen;
-import com.android.sdklib.SdkConstants;
-import com.android.sdklib.xml.ManifestData.Activity;
-import com.android.sdklib.xml.ManifestData.Instrumentation;
-import com.android.sdklib.xml.ManifestData.SupportsScreens;
-import com.android.sdklib.xml.ManifestData.UsesConfiguration;
-import com.android.sdklib.xml.ManifestData.UsesFeature;
-import com.android.sdklib.xml.ManifestData.UsesLibrary;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-public class AndroidManifestParser {
-
- private final static int LEVEL_TOP = 0;
- private final static int LEVEL_INSIDE_MANIFEST = 1;
- private final static int LEVEL_INSIDE_APPLICATION = 2;
- private final static int LEVEL_INSIDE_APP_COMPONENT = 3;
- private final static int LEVEL_INSIDE_INTENT_FILTER = 4;
-
- private final static String ACTION_MAIN = "android.intent.action.MAIN"; //$NON-NLS-1$
- private final static String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; //$NON-NLS-1$
-
- public interface ManifestErrorHandler extends ErrorHandler {
- /**
- * Handles a parsing error and an optional line number.
- */
- void handleError(Exception exception, int lineNumber);
-
- /**
- * Checks that a class is valid and can be used in the Android Manifest.
- * <p/>
- * Errors are put as {@code org.eclipse.core.resources.IMarker} on the manifest file.
- *
- * @param locator
- * @param className the fully qualified name of the class to test.
- * @param superClassName the fully qualified name of the class it is supposed to extend.
- * @param testVisibility if <code>true</code>, the method will check the visibility of
- * the class or of its constructors.
- */
- void checkClass(Locator locator, String className, String superClassName,
- boolean testVisibility);
- }
-
- /**
- * XML error & data handler used when parsing the AndroidManifest.xml file.
- * <p/>
- * During parsing this will fill up the {@link ManifestData} object given to the constructor
- * and call out errors to the given {@link ManifestErrorHandler}.
- */
- private static class ManifestHandler extends DefaultHandler {
-
- //--- temporary data/flags used during parsing
- private final ManifestData mManifestData;
- private final ManifestErrorHandler mErrorHandler;
- private int mCurrentLevel = 0;
- private int mValidLevel = 0;
- private Activity mCurrentActivity = null;
- private Locator mLocator;
-
- /**
- * Creates a new {@link ManifestHandler}.
- *
- * @param manifestFile The manifest file being parsed. Can be null.
- * @param manifestData Class containing the manifest info obtained during the parsing.
- * @param errorHandler An optional error handler.
- */
- ManifestHandler(IAbstractFile manifestFile, ManifestData manifestData,
- ManifestErrorHandler errorHandler) {
- super();
- mManifestData = manifestData;
- mErrorHandler = errorHandler;
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#setDocumentLocator(org.xml.sax.Locator)
- */
- @Override
- public void setDocumentLocator(Locator locator) {
- mLocator = locator;
- super.setDocumentLocator(locator);
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String,
- * java.lang.String, org.xml.sax.Attributes)
- */
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes)
- throws SAXException {
- try {
- if (mManifestData == null) {
- return;
- }
-
- // if we're at a valid level
- if (mValidLevel == mCurrentLevel) {
- String value;
- switch (mValidLevel) {
- case LEVEL_TOP:
- if (AndroidManifest.NODE_MANIFEST.equals(localName)) {
- // lets get the package name.
- mManifestData.mPackage = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_PACKAGE,
- false /* hasNamespace */);
-
- // and the versionCode
- String tmp = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_VERSIONCODE, true);
- if (tmp != null) {
- try {
- mManifestData.mVersionCode = Integer.valueOf(tmp);
- } catch (NumberFormatException e) {
- // keep null in the field.
- }
- }
- mValidLevel++;
- }
- break;
- case LEVEL_INSIDE_MANIFEST:
- if (AndroidManifest.NODE_APPLICATION.equals(localName)) {
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_PROCESS,
- true /* hasNamespace */);
- if (value != null) {
- mManifestData.addProcessName(value);
- }
-
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_DEBUGGABLE,
- true /* hasNamespace*/);
- if (value != null) {
- mManifestData.mDebuggable = Boolean.parseBoolean(value);
- }
-
- mValidLevel++;
- } else if (AndroidManifest.NODE_USES_SDK.equals(localName)) {
- mManifestData.setMinSdkVersionString(getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
- true /* hasNamespace */));
- mManifestData.setTargetSdkVersionString(getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_TARGET_SDK_VERSION,
- true /* hasNamespace */));
- } else if (AndroidManifest.NODE_INSTRUMENTATION.equals(localName)) {
- processInstrumentationNode(attributes);
-
- } else if (AndroidManifest.NODE_SUPPORTS_SCREENS.equals(localName)) {
- processSupportsScreensNode(attributes);
-
- } else if (AndroidManifest.NODE_USES_CONFIGURATION.equals(localName)) {
- processUsesConfiguration(attributes);
-
- } else if (AndroidManifest.NODE_USES_FEATURE.equals(localName)) {
- UsesFeature feature = new UsesFeature();
-
- // get the name
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (value != null) {
- feature.mName = value;
- }
-
- // read the required attribute
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_REQUIRED,
- true /*hasNamespace*/);
- if (value != null) {
- Boolean b = Boolean.valueOf(value);
- if (b != null) {
- feature.mRequired = b;
- }
- }
-
- // read the gl es attribute
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_GLESVERSION,
- true /*hasNamespace*/);
- if (value != null) {
- try {
- int version = Integer.decode(value);
- feature.mGlEsVersion = version;
- } catch (NumberFormatException e) {
- // ignore
- }
-
- }
-
- mManifestData.mFeatures.add(feature);
- }
- break;
- case LEVEL_INSIDE_APPLICATION:
- if (AndroidManifest.NODE_ACTIVITY.equals(localName)) {
- processActivityNode(attributes);
- mValidLevel++;
- } else if (AndroidManifest.NODE_SERVICE.equals(localName)) {
- processNode(attributes, SdkConstants.CLASS_SERVICE);
- mValidLevel++;
- } else if (AndroidManifest.NODE_RECEIVER.equals(localName)) {
- processNode(attributes, SdkConstants.CLASS_BROADCASTRECEIVER);
- mValidLevel++;
- } else if (AndroidManifest.NODE_PROVIDER.equals(localName)) {
- processNode(attributes, SdkConstants.CLASS_CONTENTPROVIDER);
- mValidLevel++;
- } else if (AndroidManifest.NODE_USES_LIBRARY.equals(localName)) {
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (value != null) {
- UsesLibrary library = new UsesLibrary();
- library.mName = value;
-
- // read the required attribute
- value = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_REQUIRED,
- true /*hasNamespace*/);
- if (value != null) {
- Boolean b = Boolean.valueOf(value);
- if (b != null) {
- library.mRequired = b;
- }
- }
-
- mManifestData.mLibraries.add(library);
- }
- }
- break;
- case LEVEL_INSIDE_APP_COMPONENT:
- // only process this level if we are in an activity
- if (mCurrentActivity != null &&
- AndroidManifest.NODE_INTENT.equals(localName)) {
- mCurrentActivity.resetIntentFilter();
- mValidLevel++;
- }
- break;
- case LEVEL_INSIDE_INTENT_FILTER:
- if (mCurrentActivity != null) {
- if (AndroidManifest.NODE_ACTION.equals(localName)) {
- // get the name attribute
- String action = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (action != null) {
- mCurrentActivity.setHasAction(true);
- mCurrentActivity.setHasMainAction(
- ACTION_MAIN.equals(action));
- }
- } else if (AndroidManifest.NODE_CATEGORY.equals(localName)) {
- String category = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (CATEGORY_LAUNCHER.equals(category)) {
- mCurrentActivity.setHasLauncherCategory(true);
- }
- }
-
- // no need to increase mValidLevel as we don't process anything
- // below this level.
- }
- break;
- }
- }
-
- mCurrentLevel++;
- } finally {
- super.startElement(uri, localName, name, attributes);
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String,
- * java.lang.String)
- */
- @Override
- public void endElement(String uri, String localName, String name) throws SAXException {
- try {
- if (mManifestData == null) {
- return;
- }
-
- // decrement the levels.
- if (mValidLevel == mCurrentLevel) {
- mValidLevel--;
- }
- mCurrentLevel--;
-
- // if we're at a valid level
- // process the end of the element
- if (mValidLevel == mCurrentLevel) {
- switch (mValidLevel) {
- case LEVEL_INSIDE_APPLICATION:
- mCurrentActivity = null;
- break;
- case LEVEL_INSIDE_APP_COMPONENT:
- // if we found both a main action and a launcher category, this is our
- // launcher activity!
- if (mManifestData.mLauncherActivity == null &&
- mCurrentActivity != null &&
- mCurrentActivity.isHomeActivity() &&
- mCurrentActivity.isExported()) {
- mManifestData.mLauncherActivity = mCurrentActivity;
- }
- break;
- default:
- break;
- }
-
- }
- } finally {
- super.endElement(uri, localName, name);
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#error(org.xml.sax.SAXParseException)
- */
- @Override
- public void error(SAXParseException e) {
- if (mErrorHandler != null) {
- mErrorHandler.handleError(e, e.getLineNumber());
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#fatalError(org.xml.sax.SAXParseException)
- */
- @Override
- public void fatalError(SAXParseException e) {
- if (mErrorHandler != null) {
- mErrorHandler.handleError(e, e.getLineNumber());
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.helpers.DefaultHandler#warning(org.xml.sax.SAXParseException)
- */
- @Override
- public void warning(SAXParseException e) throws SAXException {
- if (mErrorHandler != null) {
- mErrorHandler.warning(e);
- }
- }
-
- /**
- * Processes the activity node.
- * @param attributes the attributes for the activity node.
- */
- private void processActivityNode(Attributes attributes) {
- // lets get the activity name, and add it to the list
- String activityName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (activityName != null) {
- activityName = AndroidManifest.combinePackageAndClassName(mManifestData.mPackage,
- activityName);
-
- // get the exported flag.
- String exportedStr = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_EXPORTED, true);
- boolean exported = exportedStr == null ||
- exportedStr.toLowerCase(Locale.US).equals("true"); //$NON-NLS-1$
- mCurrentActivity = new Activity(activityName, exported);
- mManifestData.mActivities.add(mCurrentActivity);
-
- if (mErrorHandler != null) {
- mErrorHandler.checkClass(mLocator, activityName, SdkConstants.CLASS_ACTIVITY,
- true /* testVisibility */);
- }
- } else {
- // no activity found! Aapt will output an error,
- // so we don't have to do anything
- mCurrentActivity = null;
- }
-
- String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
- true /* hasNamespace */);
- if (processName != null) {
- mManifestData.addProcessName(processName);
- }
- }
-
- /**
- * Processes the service/receiver/provider nodes.
- * @param attributes the attributes for the activity node.
- * @param superClassName the fully qualified name of the super class that this
- * node is representing
- */
- private void processNode(Attributes attributes, String superClassName) {
- // lets get the class name, and check it if required.
- String serviceName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (serviceName != null) {
- serviceName = AndroidManifest.combinePackageAndClassName(mManifestData.mPackage,
- serviceName);
-
- if (mErrorHandler != null) {
- mErrorHandler.checkClass(mLocator, serviceName, superClassName,
- false /* testVisibility */);
- }
- }
-
- String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
- true /* hasNamespace */);
- if (processName != null) {
- mManifestData.addProcessName(processName);
- }
- }
-
- /**
- * Processes the instrumentation node.
- * @param attributes the attributes for the instrumentation node.
- */
- private void processInstrumentationNode(Attributes attributes) {
- // lets get the class name, and check it if required.
- String instrumentationName = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_NAME,
- true /* hasNamespace */);
- if (instrumentationName != null) {
- String instrClassName = AndroidManifest.combinePackageAndClassName(
- mManifestData.mPackage, instrumentationName);
- String targetPackage = getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_TARGET_PACKAGE,
- true /* hasNamespace */);
- mManifestData.mInstrumentations.add(
- new Instrumentation(instrClassName, targetPackage));
- if (mErrorHandler != null) {
- mErrorHandler.checkClass(mLocator, instrClassName,
- SdkConstants.CLASS_INSTRUMENTATION, true /* testVisibility */);
- }
- }
- }
-
- /**
- * Processes the supports-screens node.
- * @param attributes the attributes for the supports-screens node.
- */
- private void processSupportsScreensNode(Attributes attributes) {
- mManifestData.mSupportsScreensFromManifest = new SupportsScreens();
-
- mManifestData.mSupportsScreensFromManifest.setResizeable(getAttributeBooleanValue(
- attributes, AndroidManifest.ATTRIBUTE_RESIZEABLE, true /*hasNamespace*/));
-
- mManifestData.mSupportsScreensFromManifest.setAnyDensity(getAttributeBooleanValue(
- attributes, AndroidManifest.ATTRIBUTE_ANYDENSITY, true /*hasNamespace*/));
-
- mManifestData.mSupportsScreensFromManifest.setSmallScreens(getAttributeBooleanValue(
- attributes, AndroidManifest.ATTRIBUTE_SMALLSCREENS, true /*hasNamespace*/));
-
- mManifestData.mSupportsScreensFromManifest.setNormalScreens(getAttributeBooleanValue(
- attributes, AndroidManifest.ATTRIBUTE_NORMALSCREENS, true /*hasNamespace*/));
-
- mManifestData.mSupportsScreensFromManifest.setLargeScreens(getAttributeBooleanValue(
- attributes, AndroidManifest.ATTRIBUTE_LARGESCREENS, true /*hasNamespace*/));
- }
-
- /**
- * Processes the supports-screens node.
- * @param attributes the attributes for the supports-screens node.
- */
- private void processUsesConfiguration(Attributes attributes) {
- mManifestData.mUsesConfiguration = new UsesConfiguration();
-
- mManifestData.mUsesConfiguration.mReqFiveWayNav = getAttributeBooleanValue(
- attributes,
- AndroidManifest.ATTRIBUTE_REQ_5WAYNAV, true /*hasNamespace*/);
- mManifestData.mUsesConfiguration.mReqNavigation = Navigation.getEnum(
- getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_REQ_NAVIGATION, true /*hasNamespace*/));
- mManifestData.mUsesConfiguration.mReqHardKeyboard = getAttributeBooleanValue(
- attributes,
- AndroidManifest.ATTRIBUTE_REQ_HARDKEYBOARD, true /*hasNamespace*/);
- mManifestData.mUsesConfiguration.mReqKeyboardType = Keyboard.getEnum(
- getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_REQ_KEYBOARDTYPE, true /*hasNamespace*/));
- mManifestData.mUsesConfiguration.mReqTouchScreen = TouchScreen.getEnum(
- getAttributeValue(attributes,
- AndroidManifest.ATTRIBUTE_REQ_TOUCHSCREEN, true /*hasNamespace*/));
- }
-
- /**
- * Searches through the attributes list for a particular one and returns its value.
- * @param attributes the attribute list to search through
- * @param attributeName the name of the attribute to look for.
- * @param hasNamespace Indicates whether the attribute has an android namespace.
- * @return a String with the value or null if the attribute was not found.
- * @see SdkConstants#NS_RESOURCES
- */
- private String getAttributeValue(Attributes attributes, String attributeName,
- boolean hasNamespace) {
- int count = attributes.getLength();
- for (int i = 0 ; i < count ; i++) {
- if (attributeName.equals(attributes.getLocalName(i)) &&
- ((hasNamespace &&
- SdkConstants.NS_RESOURCES.equals(attributes.getURI(i))) ||
- (hasNamespace == false && attributes.getURI(i).length() == 0))) {
- return attributes.getValue(i);
- }
- }
-
- return null;
- }
-
- /**
- * Searches through the attributes list for a particular one and returns its value as a
- * Boolean. If the attribute is not present, this will return null.
- * @param attributes the attribute list to search through
- * @param attributeName the name of the attribute to look for.
- * @param hasNamespace Indicates whether the attribute has an android namespace.
- * @return a String with the value or null if the attribute was not found.
- * @see SdkConstants#NS_RESOURCES
- */
- private Boolean getAttributeBooleanValue(Attributes attributes, String attributeName,
- boolean hasNamespace) {
- int count = attributes.getLength();
- for (int i = 0 ; i < count ; i++) {
- if (attributeName.equals(attributes.getLocalName(i)) &&
- ((hasNamespace &&
- SdkConstants.NS_RESOURCES.equals(attributes.getURI(i))) ||
- (hasNamespace == false && attributes.getURI(i).length() == 0))) {
- String attr = attributes.getValue(i);
- if (attr != null) {
- return Boolean.valueOf(attr);
- } else {
- return null;
- }
- }
- }
-
- return null;
- }
-
- }
-
- private final static SAXParserFactory sParserFactory;
-
- static {
- sParserFactory = SAXParserFactory.newInstance();
- sParserFactory.setNamespaceAware(true);
- }
-
- /**
- * Parses the Android Manifest, and returns a {@link ManifestData} object containing the
- * result of the parsing.
- *
- * @param manifestFile the {@link IAbstractFile} representing the manifest file.
- * @param gatherData indicates whether the parsing will extract data from the manifest. If false
- * the method will always return null.
- * @param errorHandler an optional errorHandler.
- * @return A class containing the manifest info obtained during the parsing, or null on error.
- *
- * @throws StreamException
- * @throws IOException
- * @throws SAXException
- * @throws ParserConfigurationException
- */
- public static ManifestData parse(
- IAbstractFile manifestFile,
- boolean gatherData,
- ManifestErrorHandler errorHandler)
- throws SAXException, IOException, StreamException, ParserConfigurationException {
- if (manifestFile != null) {
- SAXParser parser = sParserFactory.newSAXParser();
-
- ManifestData data = null;
- if (gatherData) {
- data = new ManifestData();
- }
-
- ManifestHandler manifestHandler = new ManifestHandler(manifestFile,
- data, errorHandler);
- parser.parse(new InputSource(manifestFile.getContents()), manifestHandler);
-
- return data;
- }
-
- return null;
- }
-
- /**
- * Parses the Android Manifest, and returns an object containing the result of the parsing.
- *
- * <p/>
- * This is the equivalent of calling <pre>parse(manifestFile, true, null)</pre>
- *
- * @param manifestFile the manifest file to parse.
- *
- * @throws ParserConfigurationException
- * @throws StreamException
- * @throws IOException
- * @throws SAXException
- */
- public static ManifestData parse(IAbstractFile manifestFile)
- throws SAXException, IOException, StreamException, ParserConfigurationException {
- return parse(manifestFile, true, null);
- }
-
- public static ManifestData parse(IAbstractFolder projectFolder)
- throws SAXException, IOException, StreamException, ParserConfigurationException {
- IAbstractFile manifestFile = AndroidManifest.getManifest(projectFolder);
- if (manifestFile == null) {
- throw new FileNotFoundException();
- }
-
- return parse(manifestFile, true, null);
- }
-
- /**
- * Parses the Android Manifest from an {@link InputStream}, and returns a {@link ManifestData}
- * object containing the result of the parsing.
- *
- * @param manifestFileStream the {@link InputStream} representing the manifest file.
- * @return A class containing the manifest info obtained during the parsing or null on error.
- *
- * @throws StreamException
- * @throws IOException
- * @throws SAXException
- * @throws ParserConfigurationException
- */
- public static ManifestData parse(InputStream manifestFileStream)
- throws SAXException, IOException, StreamException, ParserConfigurationException {
- if (manifestFileStream != null) {
- SAXParser parser = sParserFactory.newSAXParser();
-
- ManifestData data = new ManifestData();
-
- ManifestHandler manifestHandler = new ManifestHandler(null, data, null);
- parser.parse(new InputSource(manifestFileStream), manifestHandler);
-
- return data;
- }
-
- return null;
- }
-}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java
deleted file mode 100644
index d6b2a6b..0000000
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.sdklib.SdkConstants;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathFactory;
-
-/**
- * XPath factory with automatic support for the android name space.
- */
-public class AndroidXPathFactory {
- /** Default prefix for android name space: 'android' */
- public final static String DEFAULT_NS_PREFIX = "android"; //$NON-NLS-1$
-
- private final static XPathFactory sFactory = XPathFactory.newInstance();
-
- /** Name space context for Android resource XML files. */
- private static class AndroidNamespaceContext implements NamespaceContext {
- private final static AndroidNamespaceContext sThis = new AndroidNamespaceContext(
- DEFAULT_NS_PREFIX);
-
- private final String mAndroidPrefix;
- private final List<String> mAndroidPrefixes;
-
- /**
- * Returns the default {@link AndroidNamespaceContext}.
- */
- private static AndroidNamespaceContext getDefault() {
- return sThis;
- }
-
- /**
- * Construct the context with the prefix associated with the android namespace.
- * @param androidPrefix the Prefix
- */
- public AndroidNamespaceContext(String androidPrefix) {
- mAndroidPrefix = androidPrefix;
- mAndroidPrefixes = Collections.singletonList(mAndroidPrefix);
- }
-
- @Override
- public String getNamespaceURI(String prefix) {
- if (prefix != null) {
- if (prefix.equals(mAndroidPrefix)) {
- return SdkConstants.NS_RESOURCES;
- }
- }
-
- return XMLConstants.NULL_NS_URI;
- }
-
- @Override
- public String getPrefix(String namespaceURI) {
- if (SdkConstants.NS_RESOURCES.equals(namespaceURI)) {
- return mAndroidPrefix;
- }
-
- return null;
- }
-
- @Override
- public Iterator<?> getPrefixes(String namespaceURI) {
- if (SdkConstants.NS_RESOURCES.equals(namespaceURI)) {
- return mAndroidPrefixes.iterator();
- }
-
- return null;
- }
- }
-
- /**
- * Creates a new XPath object, specifying which prefix in the query is used for the
- * android namespace.
- * @param androidPrefix The namespace prefix.
- */
- public static XPath newXPath(String androidPrefix) {
- XPath xpath = sFactory.newXPath();
- xpath.setNamespaceContext(new AndroidNamespaceContext(androidPrefix));
- return xpath;
- }
-
- /**
- * Creates a new XPath object using the default prefix for the android namespace.
- * @see #DEFAULT_NS_PREFIX
- */
- public static XPath newXPath() {
- XPath xpath = sFactory.newXPath();
- xpath.setNamespaceContext(AndroidNamespaceContext.getDefault());
- return xpath;
- }
-}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java
deleted file mode 100644
index 501a237..0000000
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java
+++ /dev/null
@@ -1,747 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.resources.Keyboard;
-import com.android.resources.Navigation;
-import com.android.resources.TouchScreen;
-
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Class containing the manifest info obtained during the parsing.
- */
-public final class ManifestData {
-
- /**
- * Value returned by {@link #getMinSdkVersion()} when the value of the minSdkVersion attribute
- * in the manifest is a codename and not an integer value.
- */
- public final static int MIN_SDK_CODENAME = 0;
-
- /**
- * Value returned by {@link #getGlEsVersion()} when there are no <uses-feature> node with the
- * attribute glEsVersion set.
- */
- public final static int GL_ES_VERSION_NOT_SET = -1;
-
- /** Application package */
- String mPackage;
- /** Application version Code, null if the attribute is not present. */
- Integer mVersionCode = null;
- /** List of all activities */
- final ArrayList<Activity> mActivities = new ArrayList<Activity>();
- /** Launcher activity */
- Activity mLauncherActivity = null;
- /** list of process names declared by the manifest */
- Set<String> mProcesses = null;
- /** debuggable attribute value. If null, the attribute is not present. */
- Boolean mDebuggable = null;
- /** API level requirement. if null the attribute was not present. */
- private String mMinSdkVersionString = null;
- /** API level requirement. Default is 1 even if missing. If value is a codename, then it'll be
- * 0 instead. */
- private int mMinSdkVersion = 1;
- private int mTargetSdkVersion = 0;
- /** List of all instrumentations declared by the manifest */
- final ArrayList<Instrumentation> mInstrumentations =
- new ArrayList<Instrumentation>();
- /** List of all libraries in use declared by the manifest */
- final ArrayList<UsesLibrary> mLibraries = new ArrayList<UsesLibrary>();
- /** List of all feature in use declared by the manifest */
- final ArrayList<UsesFeature> mFeatures = new ArrayList<UsesFeature>();
-
- SupportsScreens mSupportsScreensFromManifest;
- SupportsScreens mSupportsScreensValues;
- UsesConfiguration mUsesConfiguration;
-
- /**
- * Instrumentation info obtained from manifest
- */
- public final static class Instrumentation {
- private final String mName;
- private final String mTargetPackage;
-
- Instrumentation(String name, String targetPackage) {
- mName = name;
- mTargetPackage = targetPackage;
- }
-
- /**
- * Returns the fully qualified instrumentation class name
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Returns the Android app package that is the target of this instrumentation
- */
- public String getTargetPackage() {
- return mTargetPackage;
- }
- }
-
- /**
- * Activity info obtained from the manifest.
- */
- public final static class Activity {
- private final String mName;
- private final boolean mIsExported;
- private boolean mHasAction = false;
- private boolean mHasMainAction = false;
- private boolean mHasLauncherCategory = false;
-
- public Activity(String name, boolean exported) {
- mName = name;
- mIsExported = exported;
- }
-
- public String getName() {
- return mName;
- }
-
- public boolean isExported() {
- return mIsExported;
- }
-
- public boolean hasAction() {
- return mHasAction;
- }
-
- public boolean isHomeActivity() {
- return mHasMainAction && mHasLauncherCategory;
- }
-
- void setHasAction(boolean hasAction) {
- mHasAction = hasAction;
- }
-
- /** If the activity doesn't yet have a filter set for the launcher, this resets both
- * flags. This is to handle multiple intent-filters where one could have the valid
- * action, and another one of the valid category.
- */
- void resetIntentFilter() {
- if (isHomeActivity() == false) {
- mHasMainAction = mHasLauncherCategory = false;
- }
- }
-
- void setHasMainAction(boolean hasMainAction) {
- mHasMainAction = hasMainAction;
- }
-
- void setHasLauncherCategory(boolean hasLauncherCategory) {
- mHasLauncherCategory = hasLauncherCategory;
- }
- }
-
- /**
- * Class representing the <code>supports-screens</code> node in the manifest.
- * By default, all the getters will return null if there was no value defined in the manifest.
- *
- * To get an instance with all the actual values, use {@link #resolveSupportsScreensValues(int)}
- */
- public final static class SupportsScreens {
- private Boolean mResizeable;
- private Boolean mAnyDensity;
- private Boolean mSmallScreens;
- private Boolean mNormalScreens;
- private Boolean mLargeScreens;
-
- public SupportsScreens() {
- }
-
- /**
- * Instantiate an instance from a string. The string must have been created with
- * {@link #getEncodedValues()}.
- * @param value the string.
- */
- public SupportsScreens(String value) {
- String[] values = value.split("\\|");
-
- mAnyDensity = Boolean.valueOf(values[0]);
- mResizeable = Boolean.valueOf(values[1]);
- mSmallScreens = Boolean.valueOf(values[2]);
- mNormalScreens = Boolean.valueOf(values[3]);
- mLargeScreens = Boolean.valueOf(values[4]);
- }
-
- /**
- * Returns an instance of {@link SupportsScreens} initialized with the default values
- * based on the given targetSdkVersion.
- * @param targetSdkVersion
- */
- public static SupportsScreens getDefaultValues(int targetSdkVersion) {
- SupportsScreens result = new SupportsScreens();
-
- result.mNormalScreens = Boolean.TRUE;
- // Screen size and density became available in Android 1.5/API3, so before that
- // non normal screens were not supported by default. After they are considered
- // supported.
- result.mResizeable = result.mAnyDensity = result.mSmallScreens = result.mLargeScreens =
- targetSdkVersion <= 3 ? Boolean.FALSE : Boolean.TRUE;
-
- return result;
- }
-
- /**
- * Returns a version of the receiver for which all values have been set, even if they
- * were not present in the manifest.
- * @param targetSdkVersion the target api level of the app, since this has an effect
- * on default values.
- */
- public SupportsScreens resolveSupportsScreensValues(int targetSdkVersion) {
- SupportsScreens result = getDefaultValues(targetSdkVersion);
-
- // Override the default with the existing values:
- if (mResizeable != null) result.mResizeable = mResizeable;
- if (mAnyDensity != null) result.mAnyDensity = mAnyDensity;
- if (mSmallScreens != null) result.mSmallScreens = mSmallScreens;
- if (mNormalScreens != null) result.mNormalScreens = mNormalScreens;
- if (mLargeScreens != null) result.mLargeScreens = mLargeScreens;
-
- return result;
- }
-
- /**
- * returns the value of the <code>resizeable</code> attribute or null if not present.
- */
- public Boolean getResizeable() {
- return mResizeable;
- }
-
- void setResizeable(Boolean resizeable) {
- mResizeable = getConstantBoolean(resizeable);
- }
-
- /**
- * returns the value of the <code>anyDensity</code> attribute or null if not present.
- */
- public Boolean getAnyDensity() {
- return mAnyDensity;
- }
-
- void setAnyDensity(Boolean anyDensity) {
- mAnyDensity = getConstantBoolean(anyDensity);
- }
-
- /**
- * returns the value of the <code>smallScreens</code> attribute or null if not present.
- */
- public Boolean getSmallScreens() {
- return mSmallScreens;
- }
-
- void setSmallScreens(Boolean smallScreens) {
- mSmallScreens = getConstantBoolean(smallScreens);
- }
-
- /**
- * returns the value of the <code>normalScreens</code> attribute or null if not present.
- */
- public Boolean getNormalScreens() {
- return mNormalScreens;
- }
-
- void setNormalScreens(Boolean normalScreens) {
- mNormalScreens = getConstantBoolean(normalScreens);
- }
-
- /**
- * returns the value of the <code>largeScreens</code> attribute or null if not present.
- */
- public Boolean getLargeScreens() {
- return mLargeScreens;
- }
-
- void setLargeScreens(Boolean largeScreens) {
- mLargeScreens = getConstantBoolean(largeScreens);
- }
-
- /**
- * Returns either {@link Boolean#TRUE} or {@link Boolean#FALSE} based on the value of
- * the given Boolean object.
- */
- private Boolean getConstantBoolean(Boolean v) {
- if (v != null) {
- if (v.equals(Boolean.TRUE)) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
-
- return null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof SupportsScreens) {
- SupportsScreens support = (SupportsScreens) obj;
- // since all the fields are guaranteed to be either Boolean.TRUE or Boolean.FALSE
- // (or null), we can simply check they are identical and not bother with
- // calling equals (which would require to check != null.
- // see #getConstanntBoolean(Boolean)
- return mResizeable == support.mResizeable &&
- mAnyDensity == support.mAnyDensity &&
- mSmallScreens == support.mSmallScreens &&
- mNormalScreens == support.mNormalScreens &&
- mLargeScreens == support.mLargeScreens;
- }
-
- return false;
- }
-
- /* Override hashCode, mostly to make Eclipse happy and not warn about it.
- * And if you ever put this in a Map or Set, it will avoid surprises. */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((mAnyDensity == null) ? 0 : mAnyDensity.hashCode());
- result = prime * result + ((mLargeScreens == null) ? 0 : mLargeScreens.hashCode());
- result = prime * result + ((mNormalScreens == null) ? 0 : mNormalScreens.hashCode());
- result = prime * result + ((mResizeable == null) ? 0 : mResizeable.hashCode());
- result = prime * result + ((mSmallScreens == null) ? 0 : mSmallScreens.hashCode());
- return result;
- }
-
- /**
- * Returns true if the two instances support the same screen sizes.
- * This is similar to {@link #equals(Object)} except that it ignores the values of
- * {@link #getAnyDensity()} and {@link #getResizeable()}.
- * @param support the other instance to compare to.
- * @return true if the two instances support the same screen sizes.
- */
- public boolean hasSameScreenSupportAs(SupportsScreens support) {
- // since all the fields are guaranteed to be either Boolean.TRUE or Boolean.FALSE
- // (or null), we can simply check they are identical and not bother with
- // calling equals (which would require to check != null.
- // see #getConstanntBoolean(Boolean)
-
- // This only checks that matter here are the screen sizes. resizeable and anyDensity
- // are not checked.
- return mSmallScreens == support.mSmallScreens &&
- mNormalScreens == support.mNormalScreens &&
- mLargeScreens == support.mLargeScreens;
- }
-
- /**
- * Returns true if the two instances have strictly different screen size support.
- * This means that there is no screen size that they both support.
- * @param support the other instance to compare to.
- * @return true if they are stricly different.
- */
- public boolean hasStrictlyDifferentScreenSupportAs(SupportsScreens support) {
- // since all the fields are guaranteed to be either Boolean.TRUE or Boolean.FALSE
- // (or null), we can simply check they are identical and not bother with
- // calling equals (which would require to check != null.
- // see #getConstanntBoolean(Boolean)
-
- // This only checks that matter here are the screen sizes. resizeable and anyDensity
- // are not checked.
- return (mSmallScreens != Boolean.TRUE || support.mSmallScreens != Boolean.TRUE) &&
- (mNormalScreens != Boolean.TRUE || support.mNormalScreens != Boolean.TRUE) &&
- (mLargeScreens != Boolean.TRUE || support.mLargeScreens != Boolean.TRUE);
- }
-
- /**
- * Comparison of 2 Supports-screens. This only uses screen sizes (ignores resizeable and
- * anyDensity), and considers that
- * {@link #hasStrictlyDifferentScreenSupportAs(SupportsScreens)} returns true and
- * {@link #overlapWith(SupportsScreens)} returns false.
- * @throws IllegalArgumentException if the two instanced are not strictly different or
- * overlap each other
- * @see #hasStrictlyDifferentScreenSupportAs(SupportsScreens)
- * @see #overlapWith(SupportsScreens)
- */
- public int compareScreenSizesWith(SupportsScreens o) {
- if (hasStrictlyDifferentScreenSupportAs(o) == false) {
- throw new IllegalArgumentException("The two instances are not strictly different.");
- }
- if (overlapWith(o)) {
- throw new IllegalArgumentException("The two instances overlap each other.");
- }
-
- int comp = mLargeScreens.compareTo(o.mLargeScreens);
- if (comp != 0) return comp;
-
- comp = mNormalScreens.compareTo(o.mNormalScreens);
- if (comp != 0) return comp;
-
- comp = mSmallScreens.compareTo(o.mSmallScreens);
- if (comp != 0) return comp;
-
- return 0;
- }
-
- /**
- * Returns a string encoding of the content of the instance. This string can be used to
- * instantiate a {@link SupportsScreens} object through
- * {@link #SupportsScreens(String)}.
- */
- public String getEncodedValues() {
- return String.format("%1$s|%2$s|%3$s|%4$s|%5$s",
- mAnyDensity, mResizeable, mSmallScreens, mNormalScreens, mLargeScreens);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
-
- boolean alreadyOutputSomething = false;
-
- if (Boolean.TRUE.equals(mSmallScreens)) {
- alreadyOutputSomething = true;
- sb.append("small");
- }
-
- if (Boolean.TRUE.equals(mNormalScreens)) {
- if (alreadyOutputSomething) {
- sb.append(", ");
- }
- alreadyOutputSomething = true;
- sb.append("normal");
- }
-
- if (Boolean.TRUE.equals(mLargeScreens)) {
- if (alreadyOutputSomething) {
- sb.append(", ");
- }
- alreadyOutputSomething = true;
- sb.append("large");
- }
-
- if (alreadyOutputSomething == false) {
- sb.append("<none>");
- }
-
- return sb.toString();
- }
-
- /**
- * Returns true if the two instance overlap with each other.
- * This can happen if one instances supports a size, when the other instance doesn't while
- * supporting a size above and a size below.
- * @param otherSS the other supports-screens to compare to.
- */
- public boolean overlapWith(SupportsScreens otherSS) {
- if (mSmallScreens == null || mNormalScreens == null || mLargeScreens == null ||
- otherSS.mSmallScreens == null || otherSS.mNormalScreens == null ||
- otherSS.mLargeScreens == null) {
- throw new IllegalArgumentException("Some screen sizes Boolean are not initialized");
- }
-
- if (mSmallScreens == Boolean.TRUE && mNormalScreens == Boolean.FALSE &&
- mLargeScreens == Boolean.TRUE) {
- return otherSS.mNormalScreens == Boolean.TRUE;
- }
-
- if (otherSS.mSmallScreens == Boolean.TRUE && otherSS.mNormalScreens == Boolean.FALSE &&
- otherSS.mLargeScreens == Boolean.TRUE) {
- return mNormalScreens == Boolean.TRUE;
- }
-
- return false;
- }
- }
-
- /**
- * Class representing a <code>uses-library</code> node in the manifest.
- */
- public final static class UsesLibrary {
- String mName;
- Boolean mRequired = Boolean.TRUE; // default is true even if missing
-
- public String getName() {
- return mName;
- }
-
- public Boolean getRequired() {
- return mRequired;
- }
- }
-
- /**
- * Class representing a <code>uses-feature</code> node in the manifest.
- */
- public final static class UsesFeature {
- String mName;
- int mGlEsVersion = 0;
- Boolean mRequired = Boolean.TRUE; // default is true even if missing
-
- public String getName() {
- return mName;
- }
-
- /**
- * Returns the value of the glEsVersion attribute, or 0 if the attribute was not present.
- */
- public int getGlEsVersion() {
- return mGlEsVersion;
- }
-
- public Boolean getRequired() {
- return mRequired;
- }
- }
-
- /**
- * Class representing the <code>uses-configuration</code> node in the manifest.
- */
- public final static class UsesConfiguration {
- Boolean mReqFiveWayNav;
- Boolean mReqHardKeyboard;
- Keyboard mReqKeyboardType;
- TouchScreen mReqTouchScreen;
- Navigation mReqNavigation;
-
- /**
- * returns the value of the <code>reqFiveWayNav</code> attribute or null if not present.
- */
- public Boolean getReqFiveWayNav() {
- return mReqFiveWayNav;
- }
-
- /**
- * returns the value of the <code>reqNavigation</code> attribute or null if not present.
- */
- public Navigation getReqNavigation() {
- return mReqNavigation;
- }
-
- /**
- * returns the value of the <code>reqHardKeyboard</code> attribute or null if not present.
- */
- public Boolean getReqHardKeyboard() {
- return mReqHardKeyboard;
- }
-
- /**
- * returns the value of the <code>reqKeyboardType</code> attribute or null if not present.
- */
- public Keyboard getReqKeyboardType() {
- return mReqKeyboardType;
- }
-
- /**
- * returns the value of the <code>reqTouchScreen</code> attribute or null if not present.
- */
- public TouchScreen getReqTouchScreen() {
- return mReqTouchScreen;
- }
- }
-
- /**
- * Returns the package defined in the manifest, if found.
- * @return The package name or null if not found.
- */
- public String getPackage() {
- return mPackage;
- }
-
- /**
- * Returns the versionCode value defined in the manifest, if found, null otherwise.
- * @return the versionCode or null if not found.
- */
- public Integer getVersionCode() {
- return mVersionCode;
- }
-
- /**
- * Returns the list of activities found in the manifest.
- * @return An array of fully qualified class names, or empty if no activity were found.
- */
- public Activity[] getActivities() {
- return mActivities.toArray(new Activity[mActivities.size()]);
- }
-
- /**
- * Returns the name of one activity found in the manifest, that is configured to show
- * up in the HOME screen.
- * @return the fully qualified name of a HOME activity or null if none were found.
- */
- public Activity getLauncherActivity() {
- return mLauncherActivity;
- }
-
- /**
- * Returns the list of process names declared by the manifest.
- */
- public String[] getProcesses() {
- if (mProcesses != null) {
- return mProcesses.toArray(new String[mProcesses.size()]);
- }
-
- return new String[0];
- }
-
- /**
- * Returns the <code>debuggable</code> attribute value or null if it is not set.
- */
- public Boolean getDebuggable() {
- return mDebuggable;
- }
-
- /**
- * Returns the <code>minSdkVersion</code> attribute, or null if it's not set.
- */
- public String getMinSdkVersionString() {
- return mMinSdkVersionString;
- }
-
- /**
- * Sets the value of the <code>minSdkVersion</code> attribute.
- * @param minSdkVersion the string value of the attribute in the manifest.
- */
- public void setMinSdkVersionString(String minSdkVersion) {
- mMinSdkVersionString = minSdkVersion;
- if (mMinSdkVersionString != null) {
- try {
- mMinSdkVersion = Integer.parseInt(mMinSdkVersionString);
- } catch (NumberFormatException e) {
- mMinSdkVersion = MIN_SDK_CODENAME;
- }
- }
- }
-
- /**
- * Returns the <code>minSdkVersion</code> attribute, or 0 if it's not set or is a codename.
- * @see #getMinSdkVersionString()
- */
- public int getMinSdkVersion() {
- return mMinSdkVersion;
- }
-
-
- /**
- * Sets the value of the <code>minSdkVersion</code> attribute.
- * @param targetSdkVersion the string value of the attribute in the manifest.
- */
- public void setTargetSdkVersionString(String targetSdkVersion) {
- if (targetSdkVersion != null) {
- try {
- mTargetSdkVersion = Integer.parseInt(targetSdkVersion);
- } catch (NumberFormatException e) {
- // keep the value at 0.
- }
- }
- }
-
- /**
- * Returns the <code>targetSdkVersion</code> attribute, or the same value as
- * {@link #getMinSdkVersion()} if it was not set in the manifest.
- */
- public int getTargetSdkVersion() {
- if (mTargetSdkVersion == 0) {
- return getMinSdkVersion();
- }
-
- return mTargetSdkVersion;
- }
-
- /**
- * Returns the list of instrumentations found in the manifest.
- * @return An array of {@link Instrumentation}, or empty if no instrumentations were
- * found.
- */
- public Instrumentation[] getInstrumentations() {
- return mInstrumentations.toArray(new Instrumentation[mInstrumentations.size()]);
- }
-
- /**
- * Returns the list of libraries in use found in the manifest.
- * @return An array of {@link UsesLibrary} objects, or empty if no libraries were found.
- */
- public UsesLibrary[] getUsesLibraries() {
- return mLibraries.toArray(new UsesLibrary[mLibraries.size()]);
- }
-
- /**
- * Returns the list of features in use found in the manifest.
- * @return An array of {@link UsesFeature} objects, or empty if no libraries were found.
- */
- public UsesFeature[] getUsesFeatures() {
- return mFeatures.toArray(new UsesFeature[mFeatures.size()]);
- }
-
- /**
- * Returns the glEsVersion from a <uses-feature> or {@link #GL_ES_VERSION_NOT_SET} if not set.
- */
- public int getGlEsVersion() {
- for (UsesFeature feature : mFeatures) {
- if (feature.mGlEsVersion > 0) {
- return feature.mGlEsVersion;
- }
- }
- return GL_ES_VERSION_NOT_SET;
- }
-
- /**
- * Returns the {@link SupportsScreens} object representing the <code>supports-screens</code>
- * node, or null if the node doesn't exist at all.
- * Some values in the {@link SupportsScreens} instance maybe null, indicating that they
- * were not present in the manifest. To get an instance that contains the values, as seen
- * by the Android platform when the app is running, use {@link #getSupportsScreensValues()}.
- */
- public SupportsScreens getSupportsScreensFromManifest() {
- return mSupportsScreensFromManifest;
- }
-
- /**
- * Returns an always non-null instance of {@link SupportsScreens} that's been initialized with
- * the default values, and the values from the manifest.
- * The default values depends on the manifest values for minSdkVersion and targetSdkVersion.
- */
- public synchronized SupportsScreens getSupportsScreensValues() {
- if (mSupportsScreensValues == null) {
- if (mSupportsScreensFromManifest == null) {
- mSupportsScreensValues = SupportsScreens.getDefaultValues(getTargetSdkVersion());
- } else {
- // get a SupportsScreen that replace the missing values with default values.
- mSupportsScreensValues = mSupportsScreensFromManifest.resolveSupportsScreensValues(
- getTargetSdkVersion());
- }
- }
-
- return mSupportsScreensValues;
- }
-
- /**
- * Returns the {@link UsesConfiguration} object representing the <code>uses-configuration</code>
- * node, or null if the node doesn't exist at all.
- */
- public UsesConfiguration getUsesConfiguration() {
- return mUsesConfiguration;
- }
-
- void addProcessName(String processName) {
- if (mProcesses == null) {
- mProcesses = new TreeSet<String>();
- }
-
- if (processName.startsWith(":")) {
- mProcesses.add(mPackage + processName);
- } else {
- mProcesses.add(processName);
- }
- }
-
-}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTest.java
index 8df9627..487a96a 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTest.java
@@ -17,6 +17,7 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.sdklib.ISystemImage.LocationType;
import com.android.sdklib.SdkManager.LayoutlibVersion;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java
index b00dfc9..a93978c 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java
@@ -17,11 +17,9 @@
package com.android.sdklib;
+import com.android.SdkConstants;
import com.android.prefs.AndroidLocation;
import com.android.prefs.AndroidLocation.AndroidLocationException;
-import com.android.sdklib.ISdkLog;
-import com.android.sdklib.SdkConstants;
-import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.avd.AvdManager;
import com.android.sdklib.io.FileOp;
import com.android.sdklib.mock.MockLog;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java
index f66adb8..645d2bb 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java
@@ -16,12 +16,12 @@
package com.android.sdklib.internal.repository;
+import com.android.SdkConstants;
import com.android.sdklib.IAndroidTarget;
-import com.android.sdklib.SdkConstants;
+import com.android.sdklib.ISystemImage.LocationType;
import com.android.sdklib.SdkManager;
import com.android.sdklib.SdkManagerTestCase;
import com.android.sdklib.SystemImage;
-import com.android.sdklib.ISystemImage.LocationType;
import java.util.Arrays;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformTarget.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformTarget.java
index 64ece4f..1d9bb7b 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformTarget.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformTarget.java
@@ -16,11 +16,11 @@
package com.android.sdklib.internal.repository;
+import com.android.SdkConstants;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISystemImage;
import com.android.sdklib.ISystemImage.LocationType;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SystemImage;
import com.android.sdklib.io.FileOp;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockAddonPackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockAddonPackage.java
index bf10a48..7a52e7d 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockAddonPackage.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockAddonPackage.java
@@ -16,13 +16,12 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.SdkConstants;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISystemImage;
import com.android.sdklib.ISystemImage.LocationType;
-import com.android.sdklib.SdkConstants;
import com.android.sdklib.SystemImage;
-import com.android.sdklib.internal.repository.packages.AddonPackage;
import com.android.sdklib.internal.repository.sources.SdkSource;
import com.android.sdklib.io.FileOp;
import com.android.sdklib.repository.PkgProps;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/io/MockFileOp.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/io/MockFileOp.java
index 374bb99..2af4742 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/io/MockFileOp.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/io/MockFileOp.java
@@ -16,7 +16,7 @@
package com.android.sdklib.io;
-import com.android.sdklib.SdkConstants;
+import com.android.SdkConstants;
import java.io.ByteArrayOutputStream;
import java.io.File;
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/AndroidManifestParserTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/AndroidManifestParserTest.java
deleted file mode 100644
index 02725f4..0000000
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/AndroidManifestParserTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.resources.Keyboard;
-import com.android.resources.Navigation;
-import com.android.resources.TouchScreen;
-import com.android.sdklib.xml.ManifestData.UsesFeature;
-import com.android.sdklib.xml.ManifestData.UsesLibrary;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for {@link AndroidManifestParser}
- */
-public class AndroidManifestParserTest extends TestCase {
- private ManifestData mManifestTestApp;
- private ManifestData mManifestInstrumentation;
-
- private static final String TESTDATA_PATH =
- "/com/android/sdklib/testdata/"; //$NON-NLS-1$
- private static final String INSTRUMENTATION_XML = TESTDATA_PATH +
- "AndroidManifest-instrumentation.xml"; //$NON-NLS-1$
- private static final String TESTAPP_XML = TESTDATA_PATH +
- "AndroidManifest-testapp.xml"; //$NON-NLS-1$
- private static final String PACKAGE_NAME = "com.android.testapp"; //$NON-NLS-1$
- private static final Integer VERSION_CODE = 42;
- private static final String ACTIVITY_NAME = "com.android.testapp.MainActivity"; //$NON-NLS-1$
- private static final String LIBRARY_NAME = "android.test.runner"; //$NON-NLS-1$
- private static final String LIBRARY_NAME2 = "android.test.runner2"; //$NON-NLS-1$
- private static final String FEATURE_NAME = "com.foo.feature"; //$NON-NLS-1$
- private static final String INSTRUMENTATION_NAME = "android.test.InstrumentationTestRunner"; //$NON-NLS-1$
- private static final String INSTRUMENTATION_TARGET = "com.android.AndroidProject"; //$NON-NLS-1$
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- InputStream manifestStream = this.getClass().getResourceAsStream(TESTAPP_XML);
-
- mManifestTestApp = AndroidManifestParser.parse(manifestStream);
- assertNotNull(mManifestTestApp);
-
- manifestStream = this.getClass().getResourceAsStream(INSTRUMENTATION_XML);
- mManifestInstrumentation = AndroidManifestParser.parse(manifestStream);
- assertNotNull(mManifestInstrumentation);
- }
-
- public void testGetInstrumentationInformation() {
- assertEquals(1, mManifestInstrumentation.getInstrumentations().length);
- assertEquals(INSTRUMENTATION_NAME,
- mManifestInstrumentation.getInstrumentations()[0].getName());
- assertEquals(INSTRUMENTATION_TARGET,
- mManifestInstrumentation.getInstrumentations()[0].getTargetPackage());
- }
-
- public void testGetPackage() {
- assertEquals(PACKAGE_NAME, mManifestTestApp.getPackage());
- }
-
- public void testGetVersionCode() {
- assertEquals(VERSION_CODE, mManifestTestApp.getVersionCode());
- assertEquals(null, mManifestInstrumentation.getVersionCode());
- }
-
- public void testMinSdkVersion() {
- assertEquals(7, mManifestTestApp.getMinSdkVersion());
- assertEquals(8, mManifestTestApp.getTargetSdkVersion());
-
- assertEquals("foo", mManifestInstrumentation.getMinSdkVersionString());
- assertEquals(ManifestData.MIN_SDK_CODENAME, mManifestInstrumentation.getMinSdkVersion());
- }
-
- public void testGetActivities() {
- assertEquals(1, mManifestTestApp.getActivities().length);
- ManifestData.Activity activity = mManifestTestApp.getActivities()[0];
- assertEquals(ACTIVITY_NAME, activity.getName());
- assertTrue(activity.hasAction());
- assertTrue(activity.isHomeActivity());
- assertTrue(activity.hasAction());
- assertEquals(activity, mManifestTestApp.getActivities()[0]);
- }
-
- public void testGetLauncherActivity() {
- ManifestData.Activity activity = mManifestTestApp.getLauncherActivity();
- assertEquals(ACTIVITY_NAME, activity.getName());
- assertTrue(activity.hasAction());
- assertTrue(activity.isHomeActivity());
- }
-
- public void testSupportsScreen() {
- ManifestData.SupportsScreens supportsScreens =
- mManifestTestApp.getSupportsScreensFromManifest();
-
- assertNotNull(supportsScreens);
- assertEquals(Boolean.TRUE, supportsScreens.getAnyDensity());
- assertEquals(Boolean.TRUE, supportsScreens.getResizeable());
- assertEquals(Boolean.TRUE, supportsScreens.getSmallScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getNormalScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getLargeScreens());
- }
-
- public void testUsesConfiguration() {
- ManifestData.UsesConfiguration usesConfig = mManifestTestApp.getUsesConfiguration();
-
- assertNotNull(usesConfig);
- assertEquals(Boolean.TRUE, usesConfig.getReqFiveWayNav());
- assertEquals(Navigation.NONAV, usesConfig.getReqNavigation());
- assertEquals(Boolean.TRUE, usesConfig.getReqHardKeyboard());
- assertEquals(Keyboard.TWELVEKEY, usesConfig.getReqKeyboardType());
- assertEquals(TouchScreen.FINGER, usesConfig.getReqTouchScreen());
- }
-
- private void assertEquals(ManifestData.Activity lhs, ManifestData.Activity rhs) {
- assertTrue(lhs == rhs || (lhs != null && rhs != null));
- if (lhs != null && rhs != null) {
- assertEquals(lhs.getName(), rhs.getName());
- assertEquals(lhs.isExported(), rhs.isExported());
- assertEquals(lhs.hasAction(), rhs.hasAction());
- assertEquals(lhs.isHomeActivity(), rhs.isHomeActivity());
- }
- }
-
- public void testGetUsesLibraries() {
- UsesLibrary[] libraries = mManifestTestApp.getUsesLibraries();
-
- assertEquals(2, libraries.length);
- assertEquals(LIBRARY_NAME, libraries[0].getName());
- assertEquals(Boolean.FALSE, libraries[0].getRequired());
- assertEquals(LIBRARY_NAME2, libraries[1].getName());
- assertEquals(Boolean.TRUE, libraries[1].getRequired());
- }
-
- public void testGetUsesFeatures() {
- UsesFeature[] features = mManifestTestApp.getUsesFeatures();
-
- assertEquals(2, features.length);
- assertEquals(0x00020001, features[0].mGlEsVersion);
- assertEquals(Boolean.TRUE, features[0].getRequired());
- assertEquals(FEATURE_NAME, features[1].getName());
- assertEquals(Boolean.TRUE, features[1].getRequired());
- }
-
- public void testGetPackageName() {
- assertEquals(PACKAGE_NAME, mManifestTestApp.getPackage());
- }
-}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/SupportsScreensTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/SupportsScreensTest.java
deleted file mode 100644
index baf13b1..0000000
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/xml/SupportsScreensTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-package com.android.sdklib.xml;
-
-import com.android.sdklib.xml.ManifestData.SupportsScreens;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-public class SupportsScreensTest extends TestCase {
-
- private static final String TESTDATA_PATH =
- "/com/android/sdklib/testdata/"; //$NON-NLS-1$
- private static final String TESTAPP2_XML = TESTDATA_PATH +
- "AndroidManifest-testapp2.xml"; //$NON-NLS-1$
-
- public void testDefaultValuesApi3() {
- SupportsScreens supportsScreens = SupportsScreens.getDefaultValues(3);
-
- assertNotNull(supportsScreens);
- assertEquals(Boolean.FALSE, supportsScreens.getAnyDensity());
- assertEquals(Boolean.FALSE, supportsScreens.getResizeable());
- assertEquals(Boolean.FALSE, supportsScreens.getSmallScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getNormalScreens());
- assertEquals(Boolean.FALSE, supportsScreens.getLargeScreens());
- }
-
- public void testDefaultValuesApi4() {
- SupportsScreens supportsScreens = SupportsScreens.getDefaultValues(4);
-
- assertNotNull(supportsScreens);
- assertEquals(Boolean.TRUE, supportsScreens.getAnyDensity());
- assertEquals(Boolean.TRUE, supportsScreens.getResizeable());
- assertEquals(Boolean.TRUE, supportsScreens.getSmallScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getNormalScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getLargeScreens());
- }
-
- public void testManifestParsing() throws Exception {
- InputStream manifestStream = this.getClass().getResourceAsStream(TESTAPP2_XML);
-
- ManifestData data = AndroidManifestParser.parse(manifestStream);
- assertNotNull(data);
-
- SupportsScreens supportsScreens = data.getSupportsScreensFromManifest();
- assertNotNull(supportsScreens);
- assertEquals(null, supportsScreens.getAnyDensity());
- assertEquals(null, supportsScreens.getResizeable());
- assertEquals(null, supportsScreens.getSmallScreens());
- assertEquals(null, supportsScreens.getNormalScreens());
- assertEquals(Boolean.FALSE, supportsScreens.getLargeScreens());
-
- supportsScreens = data.getSupportsScreensValues();
- assertNotNull(supportsScreens);
- assertEquals(Boolean.TRUE, supportsScreens.getAnyDensity());
- assertEquals(Boolean.TRUE, supportsScreens.getResizeable());
- assertEquals(Boolean.TRUE, supportsScreens.getSmallScreens());
- assertEquals(Boolean.TRUE, supportsScreens.getNormalScreens());
- assertEquals(Boolean.FALSE, supportsScreens.getLargeScreens());
- }
-
- public void testOverlapWith() {
- SupportsScreens supportsN = new SupportsScreens("false|false|false|true|false");
- SupportsScreens supportsSL = new SupportsScreens("false|false|true|false|true");
-
- assertTrue(supportsN.overlapWith(supportsSL));
- assertTrue(supportsSL.overlapWith(supportsN));
- }
-
- public void testCompareScreenSizesWith() {
- // set instance that support all combo of the three sizes.
- SupportsScreens supportsS = new SupportsScreens("false|false|true|false|false");
- SupportsScreens supportsN = new SupportsScreens("false|false|false|true|false");
- SupportsScreens supportsL = new SupportsScreens("false|false|false|false|true");
- SupportsScreens supportsSL = new SupportsScreens("false|false|true|false|true");
-
- assertEquals(-1, supportsS.compareScreenSizesWith(supportsN));
- assertEquals( 1, supportsN.compareScreenSizesWith(supportsS));
- assertEquals(-1, supportsN.compareScreenSizesWith(supportsL));
- assertEquals(-1, supportsS.compareScreenSizesWith(supportsL));
-
- // test thrown exception for overlapWith == true
- try {
- supportsSL.compareScreenSizesWith(supportsN);
- fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- // success!
- }
-
- // test thrown exception for hasStrictlyDifferentScreenSupportAs == false
- try {
- supportsSL.compareScreenSizesWith(supportsS);
- fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- // success!
- }
-
- }
-
- public void testHasStrictlyDifferentScreenSupportAs() {
- SupportsScreens supportsS = new SupportsScreens("false|false|true|false|false");
- SupportsScreens supportsN = new SupportsScreens("false|false|false|true|false");
- SupportsScreens supportsL = new SupportsScreens("false|false|false|false|true");
-
- SupportsScreens supportsSN = new SupportsScreens("false|false|true|true|false");
- SupportsScreens supportsNL = new SupportsScreens("false|false|false|true|true");
- SupportsScreens supportsSL = new SupportsScreens("false|false|true|false|true");
- SupportsScreens supportsSNL = new SupportsScreens("false|false|true|true|true");
-
- assertTrue(supportsS.hasStrictlyDifferentScreenSupportAs(supportsN));
- assertTrue(supportsS.hasStrictlyDifferentScreenSupportAs(supportsL));
- assertTrue(supportsN.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertTrue(supportsN.hasStrictlyDifferentScreenSupportAs(supportsL));
- assertTrue(supportsL.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertTrue(supportsL.hasStrictlyDifferentScreenSupportAs(supportsN));
-
-
- assertFalse(supportsSN.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertFalse(supportsSN.hasStrictlyDifferentScreenSupportAs(supportsN));
- assertTrue(supportsSN.hasStrictlyDifferentScreenSupportAs(supportsL));
- assertFalse(supportsSL.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertTrue(supportsSL.hasStrictlyDifferentScreenSupportAs(supportsN));
- assertFalse(supportsSL.hasStrictlyDifferentScreenSupportAs(supportsL));
- assertTrue(supportsNL.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertFalse(supportsNL.hasStrictlyDifferentScreenSupportAs(supportsN));
- assertFalse(supportsNL.hasStrictlyDifferentScreenSupportAs(supportsL));
- assertFalse(supportsSNL.hasStrictlyDifferentScreenSupportAs(supportsS));
- assertFalse(supportsSNL.hasStrictlyDifferentScreenSupportAs(supportsN));
- assertFalse(supportsSNL.hasStrictlyDifferentScreenSupportAs(supportsL));
- }
-}