Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97468b73 authored by George Lin's avatar George Lin
Browse files

Fix SurfaceControlViewHost holding surface view (3/4)

Test: Use dumpsys to check if SurfaceControlViewHost still exists
Bug: 410052692
Flag: com.android.systemui.shared.new_customization_picker_ui
Change-Id: Ifdc20946e3c0fb4eebe7c6be2c3be0311d041f2c
parent 6ba17c18
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -124,8 +124,9 @@ constructor(
) {
    private var host: SurfaceControlViewHost

    private var _surfacePackage: SurfaceControlViewHost.SurfacePackage? = null
    val surfacePackage: SurfaceControlViewHost.SurfacePackage
        get() = checkNotNull(host.surfacePackage)
        get() = _surfacePackage ?: checkNotNull(host.surfacePackage).also { _surfacePackage = it }

    private var smartSpaceView: View? = null
    private var largeDateView: View? = null
@@ -155,7 +156,11 @@ constructor(
                    previewViewModel.hostToken?.let { InputTransferToken(it) },
                    TAG,
                )
            disposables += DisposableHandle { host.release() }
            disposables += DisposableHandle {
                _surfacePackage?.release()
                _surfacePackage = null
                host.release()
            }
        }
    }