Push OverlayDeviceTests onto /system

Since OverlayDeviceTests needs to use the OverlayManager API directly,
push the test APk onto the system image and reboot the device before
running tests.

Bug: 119916381
Test: atest OverlayDeviceTests
Change-Id: I8f54e1532902b984e32da68ed8aa32bf6c5b9272
This commit is contained in:
Ryan Mitchell
2020-12-28 11:41:43 -08:00
parent ac6bbdb6b0
commit 2b1b3b282f
5 changed files with 21 additions and 4 deletions

View File

@@ -16,7 +16,11 @@ android_test {
name: "OverlayDeviceTests",
srcs: ["src/**/*.java"],
platform_apis: true,
static_libs: ["androidx.test.rules"],
certificate: "platform",
static_libs: [
"androidx.test.rules",
"testng",
],
test_suites: ["device-tests"],
data: [
":OverlayDeviceTests_AppOverlayOne",

View File

@@ -19,6 +19,8 @@
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.CHANGE_OVERLAY_PACKAGES" />
<application>
<uses-library android:name="android.test.runner"/>
</application>

View File

@@ -19,9 +19,20 @@
<option name="test-suite-tag" value="apct" />
<option name="test-suite-tag" value="apct-instrumentation" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="cleanup" value="true" />
<option name="remount-system" value="true" />
<option name="push" value="OverlayDeviceTests.apk->/system/app/OverlayDeviceTests.apk" />
</target_preparer>
<!-- Reboot to have the test APK scanned by PM and reboot after to remove the test APK. -->
<target_preparer class="com.android.tradefed.targetprep.RebootTargetPreparer">
<option name="pre-reboot" value="true" />
<option name="post-reboot" value="true" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="OverlayDeviceTests.apk" />
<option name="test-file-name" value="OverlayDeviceTests_AppOverlayOne.apk" />
<option name="test-file-name" value="OverlayDeviceTests_AppOverlayTwo.apk" />
<option name="test-file-name" value="OverlayDeviceTests_FrameworkOverlay.apk" />

View File

@@ -15,6 +15,6 @@
android_test {
name: "OverlayDeviceTests_AppOverlayOne",
sdk_version: "current",
certificate: "platform",
aaptflags: ["--no-resource-removal"],
}

View File

@@ -15,6 +15,6 @@
android_test {
name: "OverlayDeviceTests_AppOverlayTwo",
sdk_version: "current",
certificate: "platform",
aaptflags: ["--no-resource-removal"],
}