Skip to content

Commit 5cc748c

Browse files
youenn98gstepniewski-google
authored andcommitted
Fix the androidTest build
1. Remove package namespace definition in Manifest. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported. 2. Specify an explicit value for `android:exported` when the component has an intent filter defined. 3. Add androidx.appcompat:appcompat build dependency in build.gradle 4. Complete the PwaWrapperSplashScreenStrategy()'s startChromeBeforeAnimationComplete argument in test
1 parent e6bbf1d commit 5cc748c

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

androidbrowserhelper/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ dependencies {
6868

6969
implementation 'androidx.annotation:annotation:1.1.0'
7070
implementation 'androidx.core:core:1.0.2'
71+
implementation 'androidx.appcompat:appcompat:1.7.0'
7172

7273
testImplementation 'junit:junit:4.12'
7374
testImplementation 'org.mockito:mockito-core:3.0.0'

androidbrowserhelper/src/androidTest/AndroidManifest.xml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@
1414
limitations under the License.
1515
-->
1616
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
17-
package="android.support.customtabs">
17+
xmlns:tools="http://schemas.android.com/tools">
1818
<uses-sdk android:minSdkVersion="16"/>
1919

2020
<application>
21+
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
22+
android:exported="true"
23+
tools:node="merge"
24+
tools:replace="android:exported" />
25+
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
26+
android:exported="true"
27+
tools:node="merge"
28+
tools:replace="android:exported" />
29+
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
30+
android:exported="true"
31+
tools:node="merge"
32+
tools:replace="android:exported" />
2133

2234
<activity android:name="com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity">
2335
<meta-data
@@ -26,7 +38,7 @@
2638
</activity>
2739

2840
<activity android:name="com.google.androidbrowserhelper.trusted.testcomponents.TestActivity"
29-
android:enabled="false">
41+
android:enabled="false" android:exported="true">
3042
<!-- A browsable intent filter is required for the DelegationService. -->
3143
<intent-filter>
3244
<action android:name="android.intent.action.VIEW"/>
@@ -43,14 +55,14 @@
4355
</activity>
4456

4557
<service android:name="com.google.androidbrowserhelper.trusted.testcomponents.TestCustomTabsService"
46-
android:enabled="false">
58+
android:enabled="false" android:exported="true">
4759
<intent-filter>
4860
<category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
4961
</intent-filter>
5062
</service>
5163

5264
<service android:name="com.google.androidbrowserhelper.trusted.testcomponents.TestCustomTabsServiceSupportsTwas"
53-
android:enabled="false">
65+
android:enabled="false" android:exported="true">
5466
<intent-filter>
5567
<action android:name="android.support.customtabs.action.CustomTabsService" />
5668
<category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
@@ -60,7 +72,7 @@
6072
</service>
6173

6274
<service android:name="com.google.androidbrowserhelper.trusted.testcomponents.TestCustomTabsServiceNoSplashScreens"
63-
android:enabled="false">
75+
android:enabled="false" android:exported="true">
6476
<intent-filter>
6577
<action android:name="android.support.customtabs.action.CustomTabsService" />
6678
<category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
@@ -82,9 +94,10 @@
8294
</activity>
8395

8496
<activity android:name="com.google.androidbrowserhelper.trusted.LauncherActivity"
85-
android:label="Test Launcher Activity"
8697
android:theme="@style/Theme.AppCompat.Light"
87-
android:enabled="false">
98+
android:label="Test Launcher Activity"
99+
android:enabled="false"
100+
android:exported="true">
88101

89102
<meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
90103
android:value="https://www.test.com/default_url/" />

androidbrowserhelper/src/androidTest/java/com/google/androidbrowserhelper/trusted/splashscreens/PwaWrapperSplashScreenStrategyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void setUp() {
100100
mActivity = mActivityTestRule.getActivity();
101101
mSession = mConnectionRule.establishSessionBlocking(mActivity);
102102
mStrategy = new PwaWrapperSplashScreenStrategy(mActivity, R.drawable.splash, 0,
103-
ImageView.ScaleType.FIT_XY, null, 0, FILE_PROVIDER_AUTHORITY);
103+
ImageView.ScaleType.FIT_XY, null, 0, FILE_PROVIDER_AUTHORITY, false);
104104
}
105105

106106
@After
@@ -145,7 +145,7 @@ public void setsParametersOnTwaBuilder() throws InterruptedException {
145145

146146
PwaWrapperSplashScreenStrategy strategy = new PwaWrapperSplashScreenStrategy(mActivity,
147147
R.drawable.splash, bgColor, scaleType, matrix, fadeOutDuration,
148-
FILE_PROVIDER_AUTHORITY);
148+
FILE_PROVIDER_AUTHORITY, false);
149149
strategy.onActivityEnterAnimationComplete();
150150
initiateLaunch(strategy);
151151

0 commit comments

Comments
 (0)