From 5f2bce3e2034922cb5fc93acdb3ecd5c78a31106 Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Tue, 27 Sep 2022 09:39:24 +0000 Subject: [PATCH] Make bitmap nullable in ViewCapture Fixes local compilation in SysUI studio. The callback interface has @NullableDecl annotation that Kotlin compiler treats as Kotlin nullable. Not sure why it compiles successfully in soong though (different compiler version?). Bug: 236188940 Change-Id: Ia8cf1dd25c3ea6a162ad3dddd58b4bf4c0f889a9 Test: build from sysui studio --- .../com/android/systemui/testing/screenshot/ViewCapture.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewCapture.kt b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewCapture.kt index cdedc64ed0e9c..97665145ce764 100644 --- a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewCapture.kt +++ b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewCapture.kt @@ -93,8 +93,8 @@ fun View.toBitmap(window: Window? = null): Bitmap { Futures.addCallback( captureToBitmap(window), object : FutureCallback { - override fun onSuccess(result: Bitmap) { - continuation.resumeWith(Result.success(result)) + override fun onSuccess(result: Bitmap?) { + continuation.resumeWith(Result.success(result!!)) } override fun onFailure(t: Throwable) {