aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-05-31 13:03:11 -0700
committerTor Norbye <tnorbye@google.com>2012-05-31 13:35:43 -0700
commit34230d8dd05143b85d520f5e34a5ea4f055e0e96 (patch)
tree6a0a76868be5699d366a33b3272f9fa09ac4d4bf
parentb7e8d98c68beba6f5f7e3ae1c37f7cda830da7a7 (diff)
downloadsdk-34230d8dd05143b85d520f5e34a5ea4f055e0e96.zip
sdk-34230d8dd05143b85d520f5e34a5ea4f055e0e96.tar.gz
sdk-34230d8dd05143b85d520f5e34a5ea4f055e0e96.tar.bz2
Fix bug in manifest metadata handler
The ManifestInfo class keeps a cache of the manifest metadata, such as the package name, minSdkVersion, etc. However, the code which cached the minSdkVersion and targetSdkVersion fields was incorrectly placed inside an unrelated if-block, which meant that in some cases (in particular, manifests specifying a default theme) these fields would not get set, and the class would return an incorrect value of 1 for minSdkVersion, regardless of the actual value specified. Change-Id: I32423cad45c9f6f775b7334ee3fd9bd183497abd
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
index 8479b0d..993b6fc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
@@ -226,7 +226,6 @@ public class ManifestInfo {
}
NodeList applications = root.getElementsByTagName(AndroidManifest.NODE_APPLICATION);
- String defaultTheme = null;
if (applications.getLength() > 0) {
assert applications.getLength() == 1;
Element application = (Element) applications.item(0);
@@ -237,23 +236,22 @@ public class ManifestInfo {
mApplicationLabel = application.getAttributeNS(NS_RESOURCES, ATTRIBUTE_LABEL);
}
- defaultTheme = application.getAttributeNS(NS_RESOURCES, ATTRIBUTE_THEME);
+ String defaultTheme = application.getAttributeNS(NS_RESOURCES, ATTRIBUTE_THEME);
+ if (defaultTheme != null && !defaultTheme.isEmpty()) {
+ // From manifest theme documentation:
+ // "If that attribute is also not set, the default system theme is used."
+ mManifestTheme = defaultTheme;
+ }
}
// Look up target SDK
- if (defaultTheme == null || defaultTheme.length() == 0) {
- // From manifest theme documentation:
- // "If that attribute is also not set, the default system theme is used."
-
- NodeList usesSdks = root.getElementsByTagName(NODE_USES_SDK);
- if (usesSdks.getLength() > 0) {
- Element usesSdk = (Element) usesSdks.item(0);
- mMinSdk = getApiVersion(usesSdk, ATTRIBUTE_MIN_SDK_VERSION, 1);
- mTargetSdk = getApiVersion(usesSdk, ATTRIBUTE_TARGET_SDK_VERSION, mMinSdk);
- }
- } else {
- mManifestTheme = defaultTheme;
+ NodeList usesSdks = root.getElementsByTagName(NODE_USES_SDK);
+ if (usesSdks.getLength() > 0) {
+ Element usesSdk = (Element) usesSdks.item(0);
+ mMinSdk = getApiVersion(usesSdk, ATTRIBUTE_MIN_SDK_VERSION, 1);
+ mTargetSdk = getApiVersion(usesSdk, ATTRIBUTE_TARGET_SDK_VERSION, mMinSdk);
}
+
} catch (SAXException e) {
AdtPlugin.log(e, "Malformed manifest");
} catch (Exception e) {