aboutsummaryrefslogtreecommitdiffstats
path: root/manifmerger/tests/src/com/android/manifmerger/data/14_receiver_dup.xml
blob: a2547aff7ac6af93dc1341c9764b7930eedc9cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# Test:
# - Activities from libraries are merged in the main manifest.
# - Acts on activity / activity-alias / service / receiver / provider.
# - Elements are merged as-is with the first comment element preceding them.
# - Whitespace preceding the merged elements is transfered over too.
#
# Note:
# - New elements are always merged at the end of the application element.
# - It's an error if an element with the same @name attribute is defined
#   or merged more than once unless the definition is *exactly* the same,
#   the "same" being defined by the exact XML elements, whitespace excluded.
#
# This tests that an error is generated because the libraries define
# receivers which are already defined differently.
#

@fails

@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:label="@string/app_name"
        android:icon="@drawable/app_icon"
        android:backupAgent="com.example.app.BackupAgentClass"
        android:restoreAnyVersion="true"
        android:allowBackup="true"
        android:killAfterRestore="true"
        android:name="com.example.TheApp" >

        <receiver
            android:name="com.example.AppReceiver1"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>

        <receiver
            android:name="com.example.AppReceiver2"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>

    </application>

</manifest>

@lib1

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lib1">

    <application android:label="@string/lib_name1" >

        <!-- Same as 1 in main -->
        <receiver
            android:name="com.example.AppReceiver1"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>

        <!-- Differs from 2 in main -->
        <receiver
            android:name="com.example.AppReceiver2" />

        <!-- A new one defined by lib1 -->
        <receiver
            android:name="com.example.AppReceiver3"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM1" />
                <action android:name="com.example.action.ACTION_CUSTOM2" />
                <action android:name="com.example.action.ACTION_CUSTOM3" />
            </intent-filter>
        </receiver>

    </application>

</manifest>

@lib2

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lib2">

    <application android:label="@string/lib_name2" >

        <!-- Conflicts with 3 from lib1 -->
        <receiver
            android:name="com.example.AppReceiver3"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>
    </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:label="@string/app_name"
        android:icon="@drawable/app_icon"
        android:backupAgent="com.example.app.BackupAgentClass"
        android:restoreAnyVersion="true"
        android:allowBackup="true"
        android:killAfterRestore="true"
        android:name="com.example.TheApp" >

        <receiver
            android:name="com.example.AppReceiver1"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>

        <receiver
            android:name="com.example.AppReceiver2"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM" />
            </intent-filter>
        </receiver>

        <!-- A new one defined by lib1 -->
        <receiver
            android:name="com.example.AppReceiver3"
            android:icon="@drawable/app_icon">
            <intent-filter>
                <action android:name="com.example.action.ACTION_CUSTOM1" />
                <action android:name="com.example.action.ACTION_CUSTOM2" />
                <action android:name="com.example.action.ACTION_CUSTOM3" />
            </intent-filter>
        </receiver>

    </application>

</manifest>

@errors

P [ManifestMergerTest0_main.xml:6, ManifestMergerTest1_lib1.xml:6] Skipping identical /manifest/application/receiver[@name=com.example.AppReceiver1] element.
E [ManifestMergerTest0_main.xml:12, ManifestMergerTest1_lib1.xml:13] Trying to merge incompatible /manifest/application/receiver[@name=com.example.AppReceiver2] element:
  <receiver android:name=com.example.AppReceiver2>
++    @android:icon = @drawable/app_icon
      @android:name = com.example.AppReceiver2
E [ManifestMergerTest0_main.xml, ManifestMergerTest2_lib2.xml:6] Trying to merge incompatible /manifest/application/receiver[@name=com.example.AppReceiver3] element:
  <receiver android:name=com.example.AppReceiver3>
    <intent-filter>
      <action android:name=com.example.action.ACTION_CUSTOM>
--        @android:name = com.example.action.ACTION_CUSTOM
++        @android:name = com.example.action.ACTION_CUSTOM1