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

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

Merge "launch coroutine to start transition to prevent binder call from...

Merge "launch coroutine to start transition to prevent binder call from blocking main thread" into main
parents 8d822721 06e4ca5e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ constructor(
        surfaceControlSupplier,
        taskOrganizer,
        handler,
        mainScope,
        transitions,
    ) {
    private var appToWebRepository =
        AppToWebRepository(userContext, taskInfo.taskId, assistContentRequester, genericLinksParser)
+24 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.view.SurfaceControlViewHost
import android.view.View
import android.view.WindowInsets
import android.view.WindowManager.LayoutParams
import android.view.WindowManager.TRANSIT_CHANGE
import android.view.WindowlessWindowManager
import android.window.DesktopExperienceFlags
import android.window.TaskConstants
@@ -47,9 +48,12 @@ import com.android.wm.shell.common.BoxShadowHelper
import com.android.wm.shell.common.DisplayController
import com.android.wm.shell.common.DisplayController.OnDisplaysChangedListener
import com.android.wm.shell.shared.annotations.ShellMainThread
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.windowdecor.caption.CaptionController
import com.android.wm.shell.windowdecor.extension.getDimensionPixelSize
import com.android.wm.shell.windowdecor.extension.isVisible
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

/**
 * Manages a container surface and a windowless window to show window decorations. Responsible to
@@ -74,6 +78,8 @@ abstract class WindowDecoration2<T>(
    private val surfaceControlSupplier: () -> SurfaceControl,
    private val taskOrganizer: ShellTaskOrganizer,
    @ShellMainThread private val handler: Handler,
    @ShellMainThread private val mainScope: CoroutineScope,
    private val transitions: Transitions,
    private val surfaceControlBuilderSupplier: () -> SurfaceControl.Builder = {
        SurfaceControl.Builder()
    },
@@ -286,8 +292,16 @@ abstract class WindowDecoration2<T>(
        val t = surfaceControlTransactionSupplier()
        captionController?.releaseViews(wct, t)
        t.apply()
        if (!wct.isEmpty) {
            if (DesktopExperienceFlags.ENABLE_DESKTOP_WINDOWING_PIP.isTrue) {
                mainScope.launch {
                    transitions.startTransition(TRANSIT_CHANGE, wct, /* handler= */ null)
                }
            } else {
                taskOrganizer.applyTransaction(wct)
            }
        }
    }

    private fun updateTaskSurface(
        params: RelayoutParams,
@@ -527,7 +541,15 @@ abstract class WindowDecoration2<T>(
            captionController?.close()
            val wct = windowContainerTransactionSupplier()
            releaseViews(wct)
            if (!wct.isEmpty) {
                if (DesktopExperienceFlags.ENABLE_DESKTOP_WINDOWING_PIP.isTrue) {
                    mainScope.launch {
                        transitions.startTransition(TRANSIT_CHANGE, wct, /* handler= */ null)
                    }
                } else {
                    taskOrganizer.applyTransaction(wct)
                }
            }
            taskSurface.release()
        }