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

Commit ce4b0f4b authored by Jorge Gil's avatar Jorge Gil
Browse files

Use CATEGORY_SECONDARY_HOME on CD during drag-to-desktop transition

Otherwise the default launcher activity is used instead of
SecondaryDisplayLauncher, which causes the start transition to not
contain the transient home change nor the dragging task's to-back change
leading to an illegal state exception.

Flag: EXEMPT BUGFIX
Fix: 444506626
Test: with a tablet, launch desktop app in primary display, move to
fullscreen, then drag handle to enter desktop, then close it. Repeat in
the external display - verify it can enter desktop with no crash

Change-Id: I3161633a45579b71a78a39128247a7bf538aa1ec
parent 058a35fa
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.SystemClock
import android.os.SystemProperties
import android.os.UserHandle
import android.view.Choreographer
import android.view.Display.DEFAULT_DISPLAY
import android.view.SurfaceControl
import android.view.SurfaceControl.Transaction
import android.view.WindowManager.TRANSIT_CHANGE
@@ -96,7 +97,6 @@ sealed class DragToDesktopTransitionHandler(
) : TransitionHandler {

    protected val rectEvaluator = RectEvaluator(Rect())
    private val launchHomeIntent = Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)

    private lateinit var splitScreenController: SplitScreenController
    private var transitionState: TransitionState? = null
@@ -140,6 +140,14 @@ sealed class DragToDesktopTransitionHandler(
            return
        }

        val launchHomeIntent =
            Intent(Intent.ACTION_MAIN).apply {
                if (taskInfo.displayId != DEFAULT_DISPLAY) {
                    addCategory(Intent.CATEGORY_SECONDARY_HOME)
                } else {
                    addCategory(Intent.CATEGORY_HOME)
                }
            }
        val options =
            ActivityOptions.makeBasic().apply {
                setTransientLaunch()