Skip to content

Commit a7fad7d

Browse files
author
Nader Jawad
committed
Fix failing GLFrontBufferedRendererTests on Cuttlefish
Avoid configuring the front buffer usage flag if we are running on a cuttlefish instance. Fixes: 280669216 Test: re-ran GLFrontBufferedRendererTests Change-Id: Idcc32ee4b60a4e5624d7404eab568e9f2f8cb079
1 parent bafed9b commit a7fad7d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLFrontBufferedRendererTest.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,9 @@ class GLFrontBufferedRendererTest {
753753
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
754754
fun testUsageFlagContainsFrontBufferUsage() {
755755
val usageFlags = FrontBufferUtils.obtainHardwareBufferUsageFlags()
756-
if (UsageFlagsVerificationHelper.isSupported(HardwareBuffer.USAGE_FRONT_BUFFER)) {
756+
// See b/280866371
757+
if (UsageFlagsVerificationHelper.isSupported(HardwareBuffer.USAGE_FRONT_BUFFER) &&
758+
!Build.MODEL.contains("Cuttlefish")) {
757759
assertNotEquals(0, usageFlags and HardwareBuffer.USAGE_FRONT_BUFFER)
758760
} else {
759761
assertEquals(0, usageFlags and HardwareBuffer.USAGE_FRONT_BUFFER)

graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferUtils.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ internal class UsageFlagsVerificationHelper private constructor() {
9393
fun obtainUsageFlagsV33(): Long {
9494
// First verify if the front buffer usage flag is supported along with the
9595
// "usage composer overlay" flag that was introduced in API level 33
96-
return if (isSupported(HardwareBuffer.USAGE_FRONT_BUFFER)) {
96+
// SF Seems to log errors when configuring HardwareBuffer instances with the
97+
// front buffer usage flag on Cuttlefish, so only include it for actual devices.
98+
// See b/280866371
99+
return if (isSupported(HardwareBuffer.USAGE_FRONT_BUFFER) &&
100+
!Build.MODEL.contains("Cuttlefish")) {
97101
FrontBufferUtils.BaseFlags or HardwareBuffer.USAGE_FRONT_BUFFER
98102
} else {
99103
FrontBufferUtils.BaseFlags

0 commit comments

Comments
 (0)