summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pawan Wagh <waghpawan@google.com> 2025-03-14 06:23:29 +0000
committer Pawan Wagh <waghpawan@google.com> 2025-03-14 07:11:35 +0000
commit7b549ddffdfd2d9ef7ba15082fd714f58667fd37 (patch)
treeeeba2d0a1ad2af83a2082e762c905471675647cc
parent06312a453d892b8728855cb10c178a09bfa0bc40 (diff)
Wait for device to be available
- UI tests are flaky due to device is not available. - Add OWNERS for tests Test: atest -c FileSystemUtilsTests Bug: 403414971 Change-Id: Ie4eaaa283bd60acbe224572f633cc6c1c0fbcc5e
-rw-r--r--core/tests/FileSystemUtilsTest/OWNERS2
-rw-r--r--core/tests/FileSystemUtilsTest/src/com/android/internal/content/FileSystemUtilsTest.java14
2 files changed, 16 insertions, 0 deletions
diff --git a/core/tests/FileSystemUtilsTest/OWNERS b/core/tests/FileSystemUtilsTest/OWNERS
new file mode 100644
index 000000000000..74eeacfeb973
--- /dev/null
+++ b/core/tests/FileSystemUtilsTest/OWNERS
@@ -0,0 +1,2 @@
+waghpawan@google.com
+kaleshsingh@google.com
diff --git a/core/tests/FileSystemUtilsTest/src/com/android/internal/content/FileSystemUtilsTest.java b/core/tests/FileSystemUtilsTest/src/com/android/internal/content/FileSystemUtilsTest.java
index 208d74e49afe..dbfd3e8ccdaa 100644
--- a/core/tests/FileSystemUtilsTest/src/com/android/internal/content/FileSystemUtilsTest.java
+++ b/core/tests/FileSystemUtilsTest/src/com/android/internal/content/FileSystemUtilsTest.java
@@ -38,6 +38,8 @@ public class FileSystemUtilsTest extends BaseHostJUnit4Test {
private static final String PAGE_SIZE_COMPAT_ENABLED_BY_PLATFORM =
"app_with_4kb_elf_no_override.apk";
+ private static final int DEVICE_WAIT_TIMEOUT = 120000;
+
@Test
@AppModeFull
public void runPunchedApp_embeddedNativeLibs() throws DeviceNotAvailableException {
@@ -98,8 +100,20 @@ public class FileSystemUtilsTest extends BaseHostJUnit4Test {
@AppModeFull
public void runAppWith4KbLib_compatByAlignmentChecks()
throws DeviceNotAvailableException, TargetSetupError {
+ // make sure that device is available for UI test
+ prepareDevice();
// This test is expected to fail since compat is disabled in manifest
runPageSizeCompatTest(PAGE_SIZE_COMPAT_ENABLED_BY_PLATFORM,
"testPageSizeCompat_compatByAlignmentChecks");
}
+
+ private void prepareDevice() throws DeviceNotAvailableException {
+ // Verify that device is online before running test and enable root
+ getDevice().waitForDeviceAvailable(DEVICE_WAIT_TIMEOUT);
+ getDevice().enableAdbRoot();
+ getDevice().waitForDeviceAvailable(DEVICE_WAIT_TIMEOUT);
+
+ getDevice().executeShellCommand("input keyevent KEYCODE_WAKEUP");
+ getDevice().executeShellCommand("wm dismiss-keyguard");
+ }
}