Merge "Improve flakiness of PlatformCompatGating test" am: d500b8afd6

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556300

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9dfe826f3686ea3173a3dd300b2c837b4dd736ec
This commit is contained in:
Andrei-Valentin Onea
2021-01-26 13:11:54 +00:00
committed by Automerger Merge Worker

View File

@@ -131,6 +131,10 @@ class PlatformCompatCommandNotInstalledTest {
assertThat(platformCompat.isChangeEnabled(TEST_CHANGE_ID, appInfo)).isEqualTo(params.result)
}
private fun command(command: String) =
FileReader(uiAutomation.executeShellCommand(command).fileDescriptor).readText()
private fun command(command: String): String {
val fileDescriptor = uiAutomation.executeShellCommand(command)
return String(ParcelFileDescriptor.AutoCloseInputStream(fileDescriptor).use {
inputStream -> inputStream.readBytes()
})
}
}