aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2012-09-21 13:05:25 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-09-21 13:05:25 -0700
commit944abd952560b2a40474cabad2d2ad786172164b (patch)
treee85cdfc089dcfeaf1307429c1c231dbc0f28f9a5
parente5762ef6945caff26742d5429f99ed288ee84855 (diff)
parent78a419fa36b7d7184b42afbbb6b2bba75a4c8aef (diff)
downloadsdk-944abd952560b2a40474cabad2d2ad786172164b.zip
sdk-944abd952560b2a40474cabad2d2ad786172164b.tar.gz
sdk-944abd952560b2a40474cabad2d2ad786172164b.tar.bz2
Merge "Manifest Merger: expand FQCNs to merge them properly."
-rwxr-xr-xmanifmerger/src/com/android/manifmerger/ManifestMerger.java162
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/ManifestMergerTest.java8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/00_noop.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/01_ignore_app_attr.xml7
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/10_activity_merge.xml26
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/11_activity_dup.xml26
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/12_alias_dup.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/13_service_dup.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/15_provider_dup.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/16_fqcn_merge.xml129
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/17_fqcn_conflict.xml118
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/20_uses_lib_merge.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/21_uses_lib_errors.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/25_permission_merge.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/26_permission_dup.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/28_uses_perm_merge.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/30_uses_sdk_ok.xml12
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/32_uses_sdk_minsdk_ok.xml12
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/33_uses_sdk_minsdk_conflict.xml32
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/36_uses_sdk_targetsdk_warning.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/40_uses_feat_merge.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/41_uses_feat_errors.xml16
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/45_uses_feat_gles_once.xml12
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/47_uses_feat_gles_conflict.xml12
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/50_uses_conf_warning.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/52_support_screens_warning.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/54_compat_screens_warning.xml8
-rwxr-xr-xmanifmerger/tests/src/com/android/manifmerger/data/56_support_gltext_warning.xml8
29 files changed, 617 insertions, 139 deletions
diff --git a/manifmerger/src/com/android/manifmerger/ManifestMerger.java b/manifmerger/src/com/android/manifmerger/ManifestMerger.java
index 2d5d3ec..d6063ea 100755
--- a/manifmerger/src/com/android/manifmerger/ManifestMerger.java
+++ b/manifmerger/src/com/android/manifmerger/ManifestMerger.java
@@ -51,7 +51,11 @@ import javax.xml.xpath.XPathExpressionException;
* <pre> Merge operations:
* - root manifest: attributes ignored, warn if defined.
* - application:
- * {@code @attributes}: ignored in libs
+ * G- {@code @attributes}: most attributes are ignored in libs
+ * except: application:name if defined, it must match.
+ * except: application:agentBackup if defined, it must match.
+ * (these represent class names and we don't want a lib to assume their app or backup
+ * classes are being used when that will never be the case.)
* C- activity / activity-alias / service / receiver / provider
* => Merge as-is. Error if exists in the destination (same {@code @name})
* unless the definitions are exactly the same.
@@ -94,7 +98,7 @@ import javax.xml.xpath.XPathExpressionException;
* B = Do not merge but if defined in both must match equally.
* C = Must not exist in dest or be exactly the same (key is the {@code @name} attribute).
* D = Add new or merge with same key {@code @name}, adjust {@code @required} true>false.
- * E, F = Custom strategies; see above.
+ * E, F, G = Custom strategies; see above.
*
* What happens when merging libraries with conflicting information?
* Say for example a main manifest has a minSdkVersion of 3, whereas libraries have
@@ -129,6 +133,21 @@ public class ManifestMerger {
private int destMinSdk;
/**
+ * Sets of element/attribute that need to be treated as class names.
+ * The attribute name must be the local name for the Android namespace.
+ * For example "application/name" maps to &lt;application android:name=...&gt;.
+ */
+ private static final String[] sClassAttributes = {
+ "application/name",
+ "application/backupAgent",
+ "activity/name",
+ "receiver/name",
+ "service/name",
+ "provider/name",
+ "instrumentation/name"
+ };
+
+ /**
* Creates a new {@link ManifestMerger}.
*
* @param log A non-null merger log to capture all warnings, errors and their location.
@@ -172,9 +191,12 @@ public class ManifestMerger {
* <p/>
* This does NOT stop on errors, in an attempt to accumulate as much
* info as possible to return to the user.
+ * <p/>
+ * The method might modify the input XML document in-place for its own processing.
*
* @param mainDoc The document to merge into. Will be modified in-place.
* @param libraryFiles The library manifest paths to read. Must not be null.
+ * These will be modified in-place.
* @return True on success, false if any error occurred (printed to the {@link IMergerLog}).
*/
public boolean process(Document mainDoc, File[] libraryFiles) {
@@ -186,6 +208,7 @@ public class ManifestMerger {
String prefix = XmlUtils.lookupNsPrefix(mainDoc, SdkConstants.NS_RESOURCES);
mXPath = AndroidXPathFactory.newXPath(prefix);
+ expandFqcns(mainDoc);
for (File libFile : libraryFiles) {
Document libDoc = XmlUtils.parseDocument(libFile, mLog);
if (libDoc == null || !mergeLibDoc(libDoc)) {
@@ -203,9 +226,12 @@ public class ManifestMerger {
* <p/>
* This does NOT stop on errors, in an attempt to accumulate as much
* info as possible to return to the user.
+ * <p/>
+ * The method might modify the input XML documents in-place for its own processing.
*
* @param mainDoc The document to merge into. Will be modified in-place.
* @param libraryDocs The library manifest documents to merge in. Must not be null.
+ * These will be modified in-place.
* @return True on success, false if any error occurred (printed to the {@link IMergerLog}).
*/
public boolean process(@NonNull Document mainDoc, @NonNull Document... libraryDocs) {
@@ -217,6 +243,7 @@ public class ManifestMerger {
String prefix = XmlUtils.lookupNsPrefix(mainDoc, SdkConstants.NS_RESOURCES);
mXPath = AndroidXPathFactory.newXPath(prefix);
+ expandFqcns(mainDoc);
for (Document libDoc : libraryDocs) {
XmlUtils.decorateDocument(libDoc, IMergerLog.LIBRARY);
if (!mergeLibDoc(libDoc)) {
@@ -242,6 +269,11 @@ public class ManifestMerger {
boolean err = false;
+ expandFqcns(libDoc);
+
+ // Strategy G (check <application> is compatible)
+ err |= !checkApplication(libDoc);
+
// Strategy B
err |= !doNotMergeCheckEqual("/manifest/uses-configuration", libDoc); //$NON-NLS-1$
err |= !doNotMergeCheckEqual("/manifest/supports-screens", libDoc); //$NON-NLS-1$
@@ -319,6 +351,115 @@ public class ManifestMerger {
}
/**
+ * Expand all possible class names attributes in the given document.
+ * <p/>
+ * Some manifest attributes represent class names. These can be specified as fully
+ * qualified class names or use a short notation consisting of just the terminal
+ * class simple name or a dot followed by a partial class name. Unfortunately this
+ * makes textual comparison of the attributes impossible. To simplify this, we can
+ * modify the document to fully expand all these class names. The list of elements
+ * and attributes to process is listed by {@link #sClassAttributes} and the expansion
+ * simply consists of appending the manifest' package if defined.
+ *
+ * @param doc The document in which to expand potential FQCNs.
+ */
+ private void expandFqcns(Document doc) {
+ // Find the package attribute of the manifest.
+ String pkg = null;
+ Element manifest = findFirstElement(doc, "/manifest");
+ if (manifest != null) {
+ pkg = manifest.getAttribute("package");
+ }
+
+ if (pkg == null || pkg.length() == 0) {
+ // We can't adjust FQCNs if we don't know the root package name.
+ // It's not a proper manifest if this is missing anyway.
+ mLog.error(Severity.WARNING,
+ xmlFileAndLine(manifest),
+ "Missing 'package' attribute in manifest.");
+ return;
+ }
+
+ for (String elementAttr : sClassAttributes) {
+ String[] names = elementAttr.split("/");
+ if (names.length != 2) {
+ continue;
+ }
+ String elemName = names[0];
+ String attrName = names[1];
+ NodeList elements = doc.getElementsByTagName(elemName);
+ for (int i = 0; i < elements.getLength(); i++) {
+ Node elem = elements.item(i);
+ if (elem instanceof Element) {
+ Attr attr = ((Element) elem).getAttributeNodeNS(NS_URI, attrName);
+ if (attr != null) {
+ String value = attr.getNodeValue();
+
+ // We know it's a shortened FQCN if it starts with a dot
+ // or does not contain any dot.
+ if (value != null && value.length() > 0 &&
+ (value.indexOf('.') == -1 || value.charAt(0) == '.')) {
+ if (value.charAt(0) == '.') {
+ value = pkg + value;
+ } else {
+ value = pkg + '.' + value;
+ }
+ attr.setNodeValue(value);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks (but does not merge) the application attributes using the following rules:
+ * <pre>
+ * - {@code @name}: Ignore if empty. Warning if its expanded FQCN doesn't match the main doc.
+ * - {@code @backupAgent}: Ignore if empty. Warning if its expanded FQCN doesn't match main doc.
+ * - All other attributes are ignored.
+ * </pre>
+ * The name and backupAgent represent classes and the merger will warn since if a lib has
+ * these defined they will never be used anyway.
+ * @param libDoc The library document to merge from. Must not be null.
+ * @return True on success, false if any error occurred (printed to the {@link IMergerLog}).
+ */
+ private boolean checkApplication(Document libDoc) {
+
+ Element mainApp = findFirstElement(mMainDoc, "/manifest/application"); //$NON-NLS-1$
+ Element libApp = findFirstElement(libDoc, "/manifest/application"); //$NON-NLS-1$
+
+ // A manifest does not necessarily define an application.
+ // If the lib has none, there's nothing to check for.
+ if (libApp == null) {
+ return true;
+ }
+
+ for (String attrName : new String[] { "name", "backupAgent" }) {
+ String libValue = getAttributeValue(libApp, attrName);
+ if (libValue == null || libValue.length() == 0) {
+ // Nothing to do if the attribute is not defined in the lib.
+ continue;
+ }
+ // The main doc does not have to have an application node.
+ String mainValue = mainApp == null ? "" : getAttributeValue(mainApp, attrName);
+ if (!libValue.equals(mainValue)) {
+ mLog.conflict(Severity.WARNING,
+ xmlFileAndLine(mainApp),
+ xmlFileAndLine(libApp),
+ mainApp == null ?
+ "Library has <application android:%1$s='%3$s'> but main manifest has no application element." :
+ "Main manifest has <application android:%1$s='%2$s'> but library uses %1$s='%3$s'.",
+ attrName,
+ mainValue,
+ libValue);
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Do not merge anything. Instead it checks that the requested elements from the
* given library are all present and equal in the destination and prints a warning
* if it's not the case.
@@ -401,8 +542,7 @@ public class ManifestMerger {
boolean success = true;
nextSource: for (Element src : findElements(libDoc, path)) {
- Attr attr = src.getAttributeNodeNS(NS_URI, keyAttr);
- String name = attr == null ? "" : attr.getNodeValue(); //$NON-NLS-1$
+ String name = getAttributeValue(src, keyAttr);
if (name.length() == 0) {
mLog.error(Severity.ERROR,
xmlFileAndLine(src),
@@ -456,6 +596,20 @@ public class ManifestMerger {
}
/**
+ * Returns the value of the given "android:attribute" in the given element.
+ *
+ * @param element The non-null element where to extract the attribute.
+ * @param attrName The local name of the attribute.
+ * It must use the {@link #NS_URI} but no prefix should be specified here.
+ * @return The value of the attribute or a non-null empty string if not found.
+ */
+ private String getAttributeValue(Element element, String attrName) {
+ Attr attr = element.getAttributeNodeNS(NS_URI, attrName);
+ String value = attr == null ? "" : attr.getNodeValue(); //$NON-NLS-1$
+ return value;
+ }
+
+ /**
* Merge elements as identified by their key name attribute.
* The element must have an option boolean "required" attribute which can be either "true" or
* "false". Default is true if the attribute is misisng. When merging, a "false" is superseded
diff --git a/manifmerger/tests/src/com/android/manifmerger/ManifestMergerTest.java b/manifmerger/tests/src/com/android/manifmerger/ManifestMergerTest.java
index 6a78a5d..1482792 100755
--- a/manifmerger/tests/src/com/android/manifmerger/ManifestMergerTest.java
+++ b/manifmerger/tests/src/com/android/manifmerger/ManifestMergerTest.java
@@ -70,6 +70,14 @@ public class ManifestMergerTest extends ManifestMergerTestCase {
processTestFiles();
}
+ public void test16_fqcn_merge() throws Exception {
+ processTestFiles();
+ }
+
+ public void test17_fqcn_conflict() throws Exception {
+ processTestFiles();
+ }
+
public void test20_uses_lib_merge() throws Exception {
processTestFiles();
}
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/00_noop.xml b/manifmerger/tests/src/com/android/manifmerger/data/00_noop.xml
index fa0cac0..2160f69 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/00_noop.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/00_noop.xml
@@ -111,7 +111,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
</manifest>
@@ -212,7 +214,8 @@
</activity>
<!-- Provider extracted from ApiDemos -->
- <provider android:name=".app.LoaderThrottle$SimpleProvider"
+ <provider
+ android:name="com.example.app1.app.LoaderThrottle$SimpleProvider"
android:authorities="com.example.android.apis.app.LoaderThrottle"
android:enabled="@bool/atLeastHoneycomb" />
@@ -223,3 +226,4 @@
@errors
+W [ManifestMergerTest2_lib2.xml:1] Missing 'package' attribute in manifest.
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/01_ignore_app_attr.xml b/manifmerger/tests/src/com/android/manifmerger/data/01_ignore_app_attr.xml
index b8d02e6..b939dd7 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/01_ignore_app_attr.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/01_ignore_app_attr.xml
@@ -1,6 +1,6 @@
#
# Test:
-# - Attributes from the application element in a library are ignored.
+# - Attributes from the application element in a library are ignored (except name)
# - Comments from nodes ignored in libraries are not merged either.
#
@@ -33,12 +33,13 @@
android:versionCode="100"
android:versionName="1.0.0">
- <!-- The attributes from <application> in a library are not merged nor checked.
+ <!-- The attributes from <application> in a library are not merged nor checked
+ except for 'name' and 'backupAgent' which must match.
This comment is ignored. -->
<application
android:label="@string/lib_name"
android:icon="@drawable/lib_icon"
- android:name="com.example.TheLib" >
+ android:name="com.example.TheApp" >
</application>
</manifest>
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/10_activity_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/10_activity_merge.xml
index b37ae66..59c5c42 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/10_activity_merge.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/10_activity_merge.xml
@@ -99,11 +99,11 @@
@lib1_widget
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- Broadcast Receiver for a widget. -->
<receiver
@@ -140,11 +140,11 @@
@lib2_activity
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- This won't be merged because there's already an identical definition in the main. -->
<activity
@@ -182,13 +182,13 @@
@lib3_alias
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
<!-- This comment is ignored. -->
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- The first comment just before the element
is carried over as-is.
@@ -345,7 +345,7 @@
</activity>
<!-- Provider extracted from ApiDemos -->
- <provider android:name=".app.LoaderThrottle$SimpleProvider"
+ <provider android:name="com.example.lib2.app.LoaderThrottle$SimpleProvider"
android:authorities="com.example.android.apis.app.LoaderThrottle"
android:enabled="@bool/atLeastHoneycomb" />
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/11_activity_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/11_activity_dup.xml
index dc2b28b..5ba6688 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/11_activity_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/11_activity_dup.xml
@@ -104,11 +104,11 @@
@lib1_widget
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- Broadcast Receiver for a widget. -->
<receiver
@@ -145,11 +145,11 @@
@lib2_activity
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- This won't be merged because there's already an identical definition in the main. -->
<activity
@@ -187,13 +187,13 @@
@lib3_alias
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
<!-- This comment is ignored. -->
- <application
- android:label="@string/lib_name"
- android:name="com.example.WidgetLibrary" >
+ <application android:label="@string/lib_name" >
<!-- The first comment just before the element
is carried over as-is.
@@ -339,7 +339,7 @@
</activity>
<!-- Provider extracted from ApiDemos -->
- <provider android:name=".app.LoaderThrottle$SimpleProvider"
+ <provider android:name="com.example.lib2.app.LoaderThrottle$SimpleProvider"
android:authorities="com.example.android.apis.app.LoaderThrottle"
android:enabled="@bool/atLeastHoneycomb" />
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/12_alias_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/12_alias_dup.xml
index cfc2082..696965f 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/12_alias_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/12_alias_dup.xml
@@ -65,11 +65,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Same as 1 in main -->
<activity-alias
@@ -109,11 +109,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name2"
- android:name="com.example.Library2" >
+ <application android:label="@string/lib_name2" >
<!-- Conflicts with 3 from lib1 -->
<activity-alias
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/13_service_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/13_service_dup.xml
index d735b92..36d7e24 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/13_service_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/13_service_dup.xml
@@ -49,11 +49,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Same as 1 in main -->
<service
@@ -86,11 +86,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name2"
- android:name="com.example.Library2" >
+ <application android:label="@string/lib_name2" >
<!-- Conflicts with 3 from lib1 -->
<service
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml
index 91f3bf0..a2547af 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml
@@ -57,11 +57,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Same as 1 in main -->
<receiver
@@ -93,11 +93,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name2"
- android:name="com.example.Library2" >
+ <application android:label="@string/lib_name2" >
<!-- Conflicts with 3 from lib1 -->
<receiver
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/15_provider_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/15_provider_dup.xml
index 9f6e5fa..7938c1e 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/15_provider_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/15_provider_dup.xml
@@ -49,11 +49,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Same as MyActivity1 in main -->
<provider
@@ -79,11 +79,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name2"
- android:name="com.example.Library2" >
+ <application android:label="@string/lib_name2" >
<!-- Conflicts with 3 from lib1 -->
<provider
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/16_fqcn_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/16_fqcn_merge.xml
new file mode 100755
index 0000000..8414a3c
--- /dev/null
+++ b/manifmerger/tests/src/com/android/manifmerger/data/16_fqcn_merge.xml
@@ -0,0 +1,129 @@
+#
+# Test how FQCN class names are expanded and handled:
+# - A library application can be merged doesn't have an app class name.
+# - A library application can be merged if it has the same class name as the app.
+# - A partial class name is expanded using the package name in a library or app.
+#
+
+@main
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.app1"
+ android:versionCode="100"
+ android:versionName="1.0.0">
+
+ <application
+ android:name="TheApp"
+ android:backupAgent=".MyBackupAgent" >
+ <activity android:name=".MainActivity" />
+ <receiver android:name="AppReceiver" />
+ <activity android:name="com.example.lib2.LibActivity" />
+ </application>
+</manifest>
+
+
+@lib1_widget
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
+
+ <application android:name="com.example.app1.TheApp" >
+ <activity android:name=".WidgetLibrary" />
+ <receiver android:name=".WidgetReceiver" />
+ <service android:name="AppService" />
+ <activity android:name="com.example.lib1.WidgetConfigurationUI" />
+ </application>
+</manifest>
+
+
+@lib2_activity
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
+
+ <application>
+ <!-- This won't be merged because there's already an identical definition in the main. -->
+ <activity android:name="LibActivity" />
+
+ <!-- Provider extracted from ApiDemos -->
+ <provider android:name=".app.LoaderThrottle$SimpleProvider" />
+
+ <!-- This one does not conflict with the main -->
+ <activity android:name="com.example.lib2.LibActivity2" />
+
+ </application>
+</manifest>
+
+
+@lib3_alias
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3" >
+ <!-- This manifest has a 'package' attribute and FQCNs get resolved. -->
+
+ <application
+ android:name="com.example.app1.TheApp"
+ android:backupAgent="com.example.app1.MyBackupAgent">
+ <activity-alias android:name="com.example.lib3.MyActivity"
+ android:targetActivity="com.example.app1.MainActivity" />
+
+ <!-- This is a dup of the 2nd activity in lib2 -->
+ <activity android:name="com.example.lib2.LibActivity2" />
+
+ <!-- These class name should be expanded. -->
+ <activity android:name=".LibActivity3" />
+ <service android:name=".LibService3" />
+ <receiver android:name=".LibReceiver3" />
+ <provider android:name=".LibProvider3" />
+
+ </application>
+
+</manifest>
+
+
+@result
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.app1"
+ android:versionCode="100"
+ android:versionName="1.0.0">
+
+ <application
+ android:name="com.example.app1.TheApp"
+ android:backupAgent="com.example.app1.MyBackupAgent" >
+ <activity android:name="com.example.app1.MainActivity" />
+ <receiver android:name="com.example.app1.AppReceiver" />
+ <activity android:name="com.example.lib2.LibActivity" />
+# from @lib1_widget
+ <activity android:name="com.example.lib1.WidgetLibrary" />
+ <activity android:name="com.example.lib1.WidgetConfigurationUI" />
+ <service android:name="com.example.lib1.AppService" />
+ <receiver android:name="com.example.lib1.WidgetReceiver" />
+
+# from @lib2_activity
+ <!-- This one does not conflict with the main -->
+ <activity android:name="com.example.lib2.LibActivity2" />
+
+ <!-- Provider extracted from ApiDemos -->
+ <provider android:name="com.example.lib2.app.LoaderThrottle$SimpleProvider" />
+
+# from @lib3_alias
+ <!-- These class name should be expanded. -->
+ <activity android:name="com.example.lib3.LibActivity3" />
+ <activity-alias android:name="com.example.lib3.MyActivity"
+ android:targetActivity="com.example.app1.MainActivity" />
+ <service android:name="com.example.lib3.LibService3" />
+ <receiver android:name="com.example.lib3.LibReceiver3" />
+ <provider android:name="com.example.lib3.LibProvider3" />
+ </application>
+</manifest>
+
+@errors
+
+P [ManifestMergerTest0_main.xml:6, ManifestMergerTest2_lib2_activity.xml:5] Skipping identical /manifest/application/activity[@name=com.example.lib2.LibActivity] element.
+P [ManifestMergerTest0_main.xml, ManifestMergerTest3_lib3_alias.xml:8] Skipping identical /manifest/application/activity[@name=com.example.lib2.LibActivity2] element.
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/17_fqcn_conflict.xml b/manifmerger/tests/src/com/android/manifmerger/data/17_fqcn_conflict.xml
new file mode 100755
index 0000000..7b95027
--- /dev/null
+++ b/manifmerger/tests/src/com/android/manifmerger/data/17_fqcn_conflict.xml
@@ -0,0 +1,118 @@
+#
+# Test how FQCN class names are expanded and handled:
+# - A library application can be merged doesn't have an app class name.
+# - A library application can be merged if it has the same class name as the app.
+# - A partial class name is expanded using the package name in a library or app.
+#
+# All tests fail with just warnings, no solid errors.
+#
+
+@main
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.app1"
+ android:versionCode="100"
+ android:versionName="1.0.0">
+
+ <application
+ android:name="TheApp"
+ android:backupAgent=".MyBackupAgent" >
+ <activity android:name=".MainActivity" />
+ <receiver android:name="AppReceiver" />
+ <activity android:name="com.example.lib2.LibActivity" />
+ </application>
+</manifest>
+
+
+@lib1_widget
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
+
+ <!-- App name is different, will not merge. -->
+ <application android:name="TheApp" >
+ <activity android:name=".WidgetLibrary1" />
+ </application>
+</manifest>
+
+
+@lib2_widget
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
+
+ <!-- App name is good, but backupAgent is mentioned and is different, will not merge. -->
+ <application
+ android:name="com.example.app1.TheApp"
+ android:backupAgent=".MyBackupAgent" >
+ <activity android:name=".WidgetLibrary2" />
+ <activity android:name=".LibActivity" />
+ </application>
+</manifest>
+
+
+@lib3_widget
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
+
+ <application android:name="com.example.app1.TheApp">
+ <activity android:name=".WidgetLibrary3" />
+ </application>
+
+</manifest>
+
+
+@lib4_not_package
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- It's an error for the manifest to lack a 'package' attribute. -->
+
+ <application>
+ <!-- These class name can't be expanded due to the lack of 'package' attribute. -->
+ <activity android:name=".LibActivity4" />
+ <service android:name=".LibService4" />
+ <receiver android:name=".LibReceiver4" />
+ <provider android:name=".LibProvider4" />
+
+ </application>
+
+</manifest>
+
+
+@result
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.app1"
+ android:versionCode="100"
+ android:versionName="1.0.0">
+
+ <application
+ android:name="com.example.app1.TheApp"
+ android:backupAgent="com.example.app1.MyBackupAgent" >
+ <activity android:name="com.example.app1.MainActivity" />
+ <receiver android:name="com.example.app1.AppReceiver" />
+ <activity android:name="com.example.lib2.LibActivity" />
+ <activity android:name="com.example.lib1.WidgetLibrary1" />
+ <activity android:name="com.example.lib2.WidgetLibrary2" />
+ <activity android:name="com.example.lib3.WidgetLibrary3" />
+# from @lib4_alias
+ <!-- These class name can't be expanded due to the lack of 'package' attribute. -->
+ <activity android:name=".LibActivity4" />
+ <service android:name=".LibService4" />
+ <receiver android:name=".LibReceiver4" />
+ <provider android:name=".LibProvider4" />
+ </application>
+</manifest>
+
+@errors
+
+W [ManifestMergerTest0_main.xml:3, ManifestMergerTest1_lib1_widget.xml:4] Main manifest has <application android:name='com.example.app1.TheApp'> but library uses name='com.example.lib1.TheApp'.
+W [ManifestMergerTest0_main.xml:3, ManifestMergerTest2_lib2_widget.xml:4] Main manifest has <application android:backupAgent='com.example.app1.MyBackupAgent'> but library uses backupAgent='com.example.lib2.MyBackupAgent'.
+P [ManifestMergerTest0_main.xml:6, ManifestMergerTest2_lib2_widget.xml:6] Skipping identical /manifest/application/activity[@name=com.example.lib2.LibActivity] element.
+W [ManifestMergerTest4_lib4_not_package.xml:1] Missing 'package' attribute in manifest.
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/20_uses_lib_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/20_uses_lib_merge.xml
index 9e37577..a5eecce 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/20_uses_lib_merge.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/20_uses_lib_merge.xml
@@ -52,11 +52,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Same as 1 from main, marking it as required=false -->
<uses-library
@@ -89,11 +89,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Overrides 3, changing it from required=false to true -->
<uses-library
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/21_uses_lib_errors.xml b/manifmerger/tests/src/com/android/manifmerger/data/21_uses_lib_errors.xml
index aa35bdd..65f0fb6 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/21_uses_lib_errors.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/21_uses_lib_errors.xml
@@ -59,11 +59,11 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Error: android:name attribute is missing. -->
<uses-library />
@@ -101,11 +101,11 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
<!-- Overrides 3, changing it from required=false to true -->
<uses-library
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/25_permission_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/25_permission_merge.xml
index 26782b8..07208ad 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/25_permission_merge.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/25_permission_merge.xml
@@ -80,7 +80,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Same permissions as main manifest -->
<permission
@@ -118,7 +120,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Redefine one permission from main manifest -->
<permission
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/26_permission_dup.xml b/manifmerger/tests/src/com/android/manifmerger/data/26_permission_dup.xml
index 7d94c41..3862249 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/26_permission_dup.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/26_permission_dup.xml
@@ -85,7 +85,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Similar permissions as main manifest, but with slight conflicts -->
<permission
@@ -127,7 +129,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Redefine one permission from main manifest -->
<permission
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/28_uses_perm_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/28_uses_perm_merge.xml
index 42f79e2..ecc644a 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/28_uses_perm_merge.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/28_uses_perm_merge.xml
@@ -57,7 +57,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Same permissions as main manifest -->
<uses-permission android:name="android.permission.INTERNET" />
@@ -74,7 +76,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Redefine one permission from main manifest -->
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/30_uses_sdk_ok.xml b/manifmerger/tests/src/com/android/manifmerger/data/30_uses_sdk_ok.xml
index 2d3670d..bcee4ce 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/30_uses_sdk_ok.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/30_uses_sdk_ok.xml
@@ -22,7 +22,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- This app requires cupcake. -->
<uses-sdk android:minSdkVersion="3" />
@@ -32,7 +34,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- This only defines a max-sdk, and we purposely ignore this attribute.
It doesn't get merged and doesn't generate a conflict either.
@@ -46,7 +50,9 @@
@lib3
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
<!-- Lib3 redefines the same requirements as lib1.
-->
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/32_uses_sdk_minsdk_ok.xml b/manifmerger/tests/src/com/android/manifmerger/data/32_uses_sdk_minsdk_ok.xml
index ffe7353..b94efe8 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/32_uses_sdk_minsdk_ok.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/32_uses_sdk_minsdk_ok.xml
@@ -19,7 +19,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- it's ok for a library to have a smaller minSdkVersion than the main manifest. -->
<uses-sdk android:minSdkVersion="4" />
@@ -29,7 +31,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<uses-sdk android:minSdkVersion="10" />
@@ -38,7 +42,9 @@
@lib3
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
<uses-sdk android:minSdkVersion="11" />
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/33_uses_sdk_minsdk_conflict.xml b/manifmerger/tests/src/com/android/manifmerger/data/33_uses_sdk_minsdk_conflict.xml
index b38aad3..8edbedb 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/33_uses_sdk_minsdk_conflict.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/33_uses_sdk_minsdk_conflict.xml
@@ -25,7 +25,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- The app can cope with API 1 but this library can only cope with API 4. -->
<uses-sdk android:minSdkVersion="4" />
@@ -35,7 +37,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<uses-sdk android:minSdkVersion="10" />
@@ -44,7 +48,9 @@
@lib3
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib3">
<uses-sdk android:minSdkVersion="11" />
@@ -53,7 +59,9 @@
@lib4_parsingError
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib4">
<!-- Parsing errors -->
<uses-sdk android:minSdkVersion="abcd" />
@@ -63,7 +71,9 @@
@lib5_parsingError
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib5">
<!-- Parsing errors -->
<uses-sdk android:minSdkVersion="123456789123456789" />
@@ -73,7 +83,9 @@
@lib6_parsingError
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib6">
<!-- Parsing errors -->
<uses-sdk android:minSdkVersion="0xFFFFFFFFFFFFFFFF" />
@@ -83,7 +95,9 @@
@lib7_parsingError
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib7">
<!-- Parsing errors -->
<uses-sdk android:minSdkVersion="InvalidMinSdk" android:targetSdkVersion="InvalidTargetSdk" />
@@ -93,7 +107,9 @@
@lib8_parsingCodename
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib8">
<!-- Test code names -->
<uses-sdk android:minSdkVersion="ApiCodename1" android:targetSdkVersion="ApiCodename10" />
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/36_uses_sdk_targetsdk_warning.xml b/manifmerger/tests/src/com/android/manifmerger/data/36_uses_sdk_targetsdk_warning.xml
index 2fdbaaa..df8b717 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/36_uses_sdk_targetsdk_warning.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/36_uses_sdk_targetsdk_warning.xml
@@ -26,7 +26,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- This lib requires cupcake and targets 11 which is > 10 so it's a warning. -->
<uses-sdk
@@ -39,7 +41,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- This is not an error nor a warning. -->
<uses-sdk
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/40_uses_feat_merge.xml b/manifmerger/tests/src/com/android/manifmerger/data/40_uses_feat_merge.xml
index 1e88473..d14dcaa 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/40_uses_feat_merge.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/40_uses_feat_merge.xml
@@ -54,7 +54,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Same as 1 from main, marking it as required=false -->
<uses-feature
@@ -81,9 +83,7 @@
android:name="com.example.SomeFeature6_RequiredFalse"
android:required="false" />
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
</application>
</manifest>
@@ -91,7 +91,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Overrides 3, changing it from required=false to true -->
<uses-feature
@@ -107,9 +109,7 @@
<uses-feature
android:name="com.example.SomeFeature6_RequiredFalse" />
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name2" >
</application>
</manifest>
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/41_uses_feat_errors.xml b/manifmerger/tests/src/com/android/manifmerger/data/41_uses_feat_errors.xml
index b052462..b86f74a 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/41_uses_feat_errors.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/41_uses_feat_errors.xml
@@ -61,7 +61,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Error: android:name attribute is missing. -->
<uses-feature />
@@ -93,9 +95,7 @@
android:name="com.example.SomeFeature6_RequiredFalse"
android:required="false" />
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name1" >
</application>
</manifest>
@@ -103,7 +103,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Overrides 3, changing it from required=false to true -->
<uses-feature
@@ -119,9 +121,7 @@
<uses-feature
android:name="com.example.SomeFeature6_RequiredFalse" />
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" >
+ <application android:label="@string/lib_name2" >
</application>
</manifest>
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/45_uses_feat_gles_once.xml b/manifmerger/tests/src/com/android/manifmerger/data/45_uses_feat_gles_once.xml
index 8928ae4..57937a6 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/45_uses_feat_gles_once.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/45_uses_feat_gles_once.xml
@@ -39,7 +39,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Add a new feature with a glEsVersion of 2.1 -->
<uses-feature
@@ -53,16 +55,16 @@
android:glEsVersion="0x00020000"
/>
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" />
+ <application android:label="@string/lib_name1" />
</manifest>
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Add a new feature with a glEsVersion of 1.1 which will be ignored -->
<uses-feature
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/47_uses_feat_gles_conflict.xml b/manifmerger/tests/src/com/android/manifmerger/data/47_uses_feat_gles_conflict.xml
index f369a5c..936d009 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/47_uses_feat_gles_conflict.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/47_uses_feat_gles_conflict.xml
@@ -41,7 +41,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- Add a new feature with a glEsVersion of 2.1 -->
<uses-feature
@@ -55,16 +57,16 @@
android:glEsVersion="0x00020000"
/>
- <application
- android:label="@string/lib_name1"
- android:name="com.example.Library1" />
+ <application android:label="@string/lib_name1" />
</manifest>
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- Add a new feature with a glEsVersion of 1.1 which will be ignored -->
<uses-feature
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/50_uses_conf_warning.xml b/manifmerger/tests/src/com/android/manifmerger/data/50_uses_conf_warning.xml
index e8c0a09..b1cb3f9 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/50_uses_conf_warning.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/50_uses_conf_warning.xml
@@ -65,7 +65,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- this is the same uses-conf than in the main. -->
<uses-configuration
@@ -81,7 +83,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- this is the not same uses-conf than in the main. -->
<uses-configuration
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/52_support_screens_warning.xml b/manifmerger/tests/src/com/android/manifmerger/data/52_support_screens_warning.xml
index 6659000..363fb2b 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/52_support_screens_warning.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/52_support_screens_warning.xml
@@ -65,7 +65,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- this is the same supports-screens than in the main. -->
<supports-screens
@@ -81,7 +83,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- this is the not same supports-screens than in the main. -->
<supports-screens
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/54_compat_screens_warning.xml b/manifmerger/tests/src/com/android/manifmerger/data/54_compat_screens_warning.xml
index b93ea99..1e1c2d2 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/54_compat_screens_warning.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/54_compat_screens_warning.xml
@@ -70,7 +70,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- this is the same compatible-screens than in the main. -->
<compatible-screens>
@@ -84,7 +86,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- this is the not same compatible-screens than in the main. -->
<compatible-screens>
diff --git a/manifmerger/tests/src/com/android/manifmerger/data/56_support_gltext_warning.xml b/manifmerger/tests/src/com/android/manifmerger/data/56_support_gltext_warning.xml
index 5882cfc..494fd2e 100755
--- a/manifmerger/tests/src/com/android/manifmerger/data/56_support_gltext_warning.xml
+++ b/manifmerger/tests/src/com/android/manifmerger/data/56_support_gltext_warning.xml
@@ -65,7 +65,9 @@
@lib1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib1">
<!-- this is the same supports-gl-texture than in the main. -->
<supports-gl-texture android:name="some.gl.texture1" />
@@ -75,7 +77,9 @@
@lib2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.lib2">
<!-- this is the not same supports-gl-texture than in the main. -->
<supports-gl-texture android:name="some.gl.texture3" />