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

Commit 8b9becf5 authored by Maryam Dehaini's avatar Maryam Dehaini Committed by Android (Google) Code Review
Browse files

Merge "Set CaptionController to null when views are released" into main

parents 8ff038e4 b5379deb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -290,7 +290,8 @@ abstract class WindowDecoration2<T>(
    private fun releaseCaptionController() {
        val wct = windowContainerTransactionSupplier()
        val t = surfaceControlTransactionSupplier()
        captionController?.releaseViews(wct, t)
        captionController?.close(wct, t)
        captionController = null
        t.apply()
        if (!wct.isEmpty) {
            if (DesktopExperienceFlags.ENABLE_DESKTOP_WINDOWING_PIP.isTrue) {
@@ -527,7 +528,8 @@ abstract class WindowDecoration2<T>(
                released = true
            }

            released = released or (captionController?.releaseViews(wct, t) == true)
            released = released or (captionController?.close(wct, t) == true)
            captionController = null

            if (released) {
                t.apply()
@@ -538,7 +540,6 @@ abstract class WindowDecoration2<T>(
        traceSection(traceTag = Trace.TRACE_TAG_WINDOW_MANAGER, name = "WindowDecoration2#close") {
            displayController.removeDisplayWindowListener(onDisplaysChangedListener)
            taskDragResizer?.close()
            captionController?.close()
            val wct = windowContainerTransactionSupplier()
            releaseViews(wct)
            if (!wct.isEmpty) {
+2 −11
Original line number Diff line number Diff line
@@ -498,21 +498,12 @@ class AppHandleController(

    override val occludingElements: List<OccludingElement> = emptyList()

    override fun releaseViews(
        wct: WindowContainerTransaction,
        t: SurfaceControl.Transaction,
    ): Boolean {
        closeHandleMenu()
        closeManageWindowsMenu()
        disposeStatusBarInputLayer()
        return super.releaseViews(wct, t)
    }

    override fun close() {
    override fun close(wct: WindowContainerTransaction, t: SurfaceControl.Transaction): Boolean {
        closeHandleMenu()
        closeManageWindowsMenu()
        disposeStatusBarInputLayer()
        viewHolder.close()
        notifyNoCaption()
        return super.close(wct, t)
    }
}
+2 −11
Original line number Diff line number Diff line
@@ -725,17 +725,7 @@ class AppHeaderController(
        viewHolder.a11yAnnounceFocused()
    }

    override fun releaseViews(
        wct: WindowContainerTransaction,
        t: SurfaceControl.Transaction,
    ): Boolean {
        closeHandleMenu()
        closeManageWindowsMenu()
        closeMaximizeMenu()
        return super.releaseViews(wct, t)
    }

    override fun close() {
    override fun close(wct: WindowContainerTransaction, t: SurfaceControl.Transaction): Boolean {
        loadAppInfoJob?.cancel()
        closeHandleMenu()
        closeManageWindowsMenu()
@@ -744,6 +734,7 @@ class AppHeaderController(
        if (desktopState.canEnterDesktopMode && isEducationEnabled) {
            notifyNoCaption()
        }
        return super.close(wct, t)
    }

    private companion object {
+1 −4
Original line number Diff line number Diff line
@@ -92,9 +92,6 @@ abstract class CaptionController<T>(
    /** Type of caption. */
    abstract val captionType: CaptionType

    /** Called when [WindowDecoration2] is closing. */
    abstract fun close()

    /**
     * Returns the caption height including any additional padding that will be added to the
     * caption.
@@ -497,7 +494,7 @@ abstract class CaptionController<T>(
    }

    /** Releases all caption views. Returns true if caption view host is released. */
    open fun releaseViews(wct: WindowContainerTransaction, t: SurfaceControl.Transaction): Boolean =
    open fun close(wct: WindowContainerTransaction, t: SurfaceControl.Transaction): Boolean =
        traceSection(
            traceTag = Trace.TRACE_TAG_WINDOW_MANAGER,
            name = "CaptionController#releaseViews",