summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-03 00:27:04 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-03 00:27:04 +0000
commita6146e7109029c6d338566390e3675d8cfa52ada (patch)
tree3d1e353664f4ee299b593888a77250a3724ebb3a
parent9b3c43f6866ed7e49b343106bb8d907478188f1d (diff)
parentdd2dd29751bcbff01c0df978dae9d71dcf483e7c (diff)
downloadplatform_testing-a6146e7109029c6d338566390e3675d8cfa52ada.tar.gz
Snap for 9682271 from dd2dd29751bcbff01c0df978dae9d71dcf483e7c to tm-qpr3-release
Change-Id: Ibc66a68bf5ed79c74708f32ad2cbc0ed68d9ab9e
-rw-r--r--ktfmt_includes.txt2
-rw-r--r--libraries/health/rules/src/android/platform/test/rule/ScreenRecordRule.kt12
-rw-r--r--libraries/screenshot/src/main/java/platform/test/screenshot/MaterialYouColorsRule.kt2
-rw-r--r--libraries/sts-common-util/host-side/src/com/android/sts/common/NativePoc.java17
-rw-r--r--libraries/systemui-helper/src/android/platform/helpers/LaunchAppUtils.kt4
-rw-r--r--libraries/systemui-helper/src/android/platform/helpers/foldable/SensorInjectionController.kt4
-rw-r--r--libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/BetterSwipe.kt4
-rw-r--r--libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/DeviceHelpers.kt5
8 files changed, 40 insertions, 10 deletions
diff --git a/ktfmt_includes.txt b/ktfmt_includes.txt
index 3a232eeef..993333198 100644
--- a/ktfmt_includes.txt
+++ b/ktfmt_includes.txt
@@ -245,11 +245,13 @@
-libraries/flicker/test/src/com/android/server/wm/flicker/windowmanager/WindowManagerTraceSubjectTest.kt
-libraries/flicker/test/src/com/android/server/wm/flicker/windowmanager/WindowManagerTraceTest.kt
-libraries/flicker/test/src/com/android/server/wm/flicker/windowmanager/WindowStateSubjectTest.kt
+-libraries/health/rules/src/android/platform/test/rule/EnsureKeepScreenAwakeSetRule.kt
-libraries/screenshot/src/androidTest/java/platform/test/screenshot/GoldenImagePathManagerTest.kt
-libraries/screenshot/src/androidTest/java/platform/test/screenshot/MSSIMMatcherTest.kt
-libraries/screenshot/src/androidTest/java/platform/test/screenshot/PixelPerfectMatcherTest.kt
-libraries/screenshot/src/androidTest/java/platform/test/screenshot/ScreenshotTestRuleTest.kt
-libraries/screenshot/src/androidTest/java/platform/test/screenshot/matchers/AlmostPerfectMatcherTest.kt
+-libraries/screenshot/src/main/java/platform/test/screenshot/DeviceEmulationRule.kt
-libraries/screenshot/src/main/java/platform/test/screenshot/GoldenImagePathManager.kt
-libraries/screenshot/src/main/java/platform/test/screenshot/PlatformScreenshotTestRule.kt
-libraries/screenshot/src/main/java/platform/test/screenshot/ScreenshotTestRule.kt
diff --git a/libraries/health/rules/src/android/platform/test/rule/ScreenRecordRule.kt b/libraries/health/rules/src/android/platform/test/rule/ScreenRecordRule.kt
index a81a04b6c..b543e7c82 100644
--- a/libraries/health/rules/src/android/platform/test/rule/ScreenRecordRule.kt
+++ b/libraries/health/rules/src/android/platform/test/rule/ScreenRecordRule.kt
@@ -48,8 +48,8 @@ import org.junit.runners.model.Statement
* After adding this rule to the test class either:
* - apply the annotation [ScreenRecord] to individual tests or classes
* - pass the [SCREEN_RECORDING_TEST_LEVEL_OVERRIDE_KEY] or
- * [SCREEN_RECORDING_CLASS_LEVEL_OVERRIDE_KEY] instrumentation argument. e.g. `adb shell am
- * instrument -w -e <key> true <test>`).
+ * [SCREEN_RECORDING_CLASS_LEVEL_OVERRIDE_KEY] instrumentation argument. e.g. `adb shell am
+ * instrument -w -e <key> true <test>`).
*/
class ScreenRecordRule : TestRule {
@@ -130,8 +130,8 @@ class ScreenRecordRule : TestRule {
File size: ${Files.size(outputFile.toPath()) / 1024} KB
screenrecord command output:
- """.trimIndent() +
- screenRecordOutput.prependIndent(" ")
+ """
+ .trimIndent() + screenRecordOutput.prependIndent(" ")
)
}
@@ -157,7 +157,9 @@ class ScreenRecordRule : TestRule {
waitForValueToSettle(
"Screen recording output size",
minimumSettleTime = Duration.ofSeconds(5)
- ) { length() }
+ ) {
+ length()
+ }
} catch (e: FailedEnsureException) {
Log.e(TAG, "Recording size didn't settle.", e)
}
diff --git a/libraries/screenshot/src/main/java/platform/test/screenshot/MaterialYouColorsRule.kt b/libraries/screenshot/src/main/java/platform/test/screenshot/MaterialYouColorsRule.kt
index ab8c73de6..cfad14069 100644
--- a/libraries/screenshot/src/main/java/platform/test/screenshot/MaterialYouColorsRule.kt
+++ b/libraries/screenshot/src/main/java/platform/test/screenshot/MaterialYouColorsRule.kt
@@ -75,7 +75,7 @@ class MaterialYouColors(
* Create a [MaterialYouColors] from [colors], where:
* - `colors[i]` should be the value of `FIRST_RESOURCE_COLOR_ID + i`.
* - [colors] must contain all values of all system colors, i.e. `colors.size` should be
- * `LAST_RESOURCE_COLOR_ID - FIRST_RESOURCE_COLOR_ID + 1`.
+ * `LAST_RESOURCE_COLOR_ID - FIRST_RESOURCE_COLOR_ID + 1`.
*/
private fun fromColors(colors: IntArray): MaterialYouColors {
val expectedSize = LAST_RESOURCE_COLOR_ID - FIRST_RESOURCE_COLOR_ID + 1
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/NativePoc.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/NativePoc.java
index 1aabaa990..1acbdd00b 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/NativePoc.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/NativePoc.java
@@ -85,6 +85,12 @@ public abstract class NativePoc {
.assumePocExitSuccess(true);
}
+ public static enum Bitness {
+ AUTO, // push 32 or 64 bit version of PoC depending on device arch
+ ONLY32, // push only 32bit version of PoC
+ ONLY64 // push only 64bit version of PoC; raises error when running on 32bit-only device
+ }
+
@AutoValue.Builder
public abstract static class Builder {
/** Name of executable to be uploaded and run. Do not include "_sts??" suffix. */
@@ -146,6 +152,17 @@ public abstract class NativePoc {
abstract Builder only64(boolean value);
+ /** Force using 32bit or 64bit version of the native poc */
+ public Builder bitness(Bitness bitness) {
+ if (bitness == Bitness.ONLY32) {
+ return only32(true).only64(false);
+ }
+ if (bitness == Bitness.ONLY64) {
+ return only32(false).only64(true);
+ }
+ return only32(false).only64(false);
+ }
+
/**
* Function to run after the PoC finishes executing but before assertion or cleanups.
*
diff --git a/libraries/systemui-helper/src/android/platform/helpers/LaunchAppUtils.kt b/libraries/systemui-helper/src/android/platform/helpers/LaunchAppUtils.kt
index ce6d4ff9a..ddb20ad9c 100644
--- a/libraries/systemui-helper/src/android/platform/helpers/LaunchAppUtils.kt
+++ b/libraries/systemui-helper/src/android/platform/helpers/LaunchAppUtils.kt
@@ -46,7 +46,9 @@ object LaunchAppUtils {
fun assertAppInForeground(app: App) {
check(
device.wait(Until.hasObject(By.pkg(app.packageName).depth(0)), MAX_TIMEOUT.toMillis())
- ) { "$app not in the foreground after ${MAX_TIMEOUT.toSeconds()} seconds" }
+ ) {
+ "$app not in the foreground after ${MAX_TIMEOUT.toSeconds()} seconds"
+ }
}
private val device: UiDevice
diff --git a/libraries/systemui-helper/src/android/platform/helpers/foldable/SensorInjectionController.kt b/libraries/systemui-helper/src/android/platform/helpers/foldable/SensorInjectionController.kt
index ce2e0fcf0..1572edfa6 100644
--- a/libraries/systemui-helper/src/android/platform/helpers/foldable/SensorInjectionController.kt
+++ b/libraries/systemui-helper/src/android/platform/helpers/foldable/SensorInjectionController.kt
@@ -58,7 +58,9 @@ class SensorInjectionController(sensorType: Int) : TestWatcher() {
SensorManager.SENSOR_STATUS_ACCURACY_HIGH,
System.currentTimeMillis()
)
- ) { "Error while injecting sensor data." }
+ ) {
+ "Error while injecting sensor data."
+ }
}
companion object {
diff --git a/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/BetterSwipe.kt b/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/BetterSwipe.kt
index 94e7600e8..d97a91313 100644
--- a/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/BetterSwipe.kt
+++ b/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/BetterSwipe.kt
@@ -162,7 +162,9 @@ object BetterSwipe {
getInstrumentation()
.uiAutomation
.injectInputEvent(event, sync, /* waitForAnimations= */ false)
- ) { "Touch injection failed" }
+ ) {
+ "Touch injection failed"
+ }
event.recycle()
}
diff --git a/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/DeviceHelpers.kt b/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/DeviceHelpers.kt
index 6c4a91045..b6b48942d 100644
--- a/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/DeviceHelpers.kt
+++ b/libraries/uiautomator-helpers/src/android/platform/uiautomator_helpers/DeviceHelpers.kt
@@ -55,6 +55,7 @@ object DeviceHelpers {
* Waits for an object to be visible and returns it.
*
* Throws an error with message provided by [errorProvider] if the object is not found.
+ *
* @deprecated Use [DeviceHelpers.waitForObj] instead.
*/
fun UiDevice.waitForObj(
@@ -151,7 +152,9 @@ object DeviceHelpers {
"$selector is ${visible.asVisibilityBoolean()} inside $this",
timeout,
errorProvider
- ) { hasObject(selector) == visible }
+ ) {
+ hasObject(selector) == visible
+ }
}
/** Asserts that a this selector is visible. Throws otherwise. */