Move TaskThumbnailViewData initialisation to init.

This is because onLayout can be called before onAttachedToWindow so this property needs to be initialised as it is used in onLayout.

Fix:  383733481
Flag: com.android.launcher3.enable_refactor_task_thumbnail
Test: Manual checking of split select and incorrect orientation for now but will be tested by view screenshot tests.

Change-Id: I40937b8b1b98209e77cb5ee64f5c4342b90faf97
This commit is contained in:
Uwais Ashraf
2024-12-19 13:28:58 +00:00
parent ed7a726091
commit a08b7c4218
@@ -52,7 +52,10 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
private val recentsCoroutineScope: CoroutineScope = RecentsDependencies.get()
private val dispatcherProvider: DispatcherProvider = RecentsDependencies.get()
private lateinit var viewData: TaskThumbnailViewData
// This is initialised here and set in onAttachedToWindow because onLayout can be called before
// onAttachedToWindow so this property needs to be initialised as it is used below.
private var viewData: TaskThumbnailViewData = RecentsDependencies.get(this)
private lateinit var viewModel: TaskThumbnailViewModel
private lateinit var viewAttachedScope: CoroutineScope