From 82ea78014f56a6ad8b62926cc03c17f32c6b2ea3 Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Fri, 5 May 2023 15:04:24 +0000 Subject: Subsequent blind fix for runBlocking Interrupted Exceptions We fix this slightly mysterious issue by using a good old android handler instead of the fancy coroutine stuff. Bug: 280075104 Test: Exercised existing KeyguardPreviewRenderer use cases Change-Id: I56b818c7b13e238bad025cab76139f5a0c7ffe7b --- .../systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt index 3aa57dde3178..4470bf0a7b51 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt @@ -25,6 +25,7 @@ import android.content.IntentFilter import android.graphics.Rect import android.hardware.display.DisplayManager import android.os.Bundle +import android.os.Handler import android.os.IBinder import android.view.LayoutInflater import android.view.SurfaceControlViewHost @@ -57,6 +58,7 @@ class KeyguardPreviewRenderer constructor( @Application private val context: Context, @Main private val mainDispatcher: CoroutineDispatcher, + @Main private val mainHandler: Handler, private val bottomAreaViewModel: KeyguardBottomAreaViewModel, displayManager: DisplayManager, private val windowManager: WindowManager, @@ -112,7 +114,7 @@ constructor( } fun render() { - runBlocking(mainDispatcher) { + mainHandler.post { val rootView = FrameLayout(context) setUpBottomArea(rootView) @@ -168,14 +170,12 @@ constructor( * @param hide TRUE hides smartspace, FALSE shows smartspace */ fun hideSmartspace(hide: Boolean) { - runBlocking(mainDispatcher) { - smartSpaceView?.visibility = if (hide) View.INVISIBLE else View.VISIBLE - } + mainHandler.post { smartSpaceView?.visibility = if (hide) View.INVISIBLE else View.VISIBLE } } /** Sets the clock's color to the overridden seed color. */ fun onColorOverridden(@ColorInt color: Int?) { - runBlocking(mainDispatcher) { + mainHandler.post { colorOverride = color clockController.clock?.run { events.onSeedColorChanged(color) } } -- cgit v1.2.3-59-g8ed1b