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

Commit 0c4ffe02 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge "Prevent dialog launch from crashing in rare cases" into main

parents 84b7fb75 fa842bed
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package com.android.systemui.animation

import android.util.Log
import android.view.GhostView
import android.view.View
import android.view.ViewGroup
import android.view.ViewRootImpl
import com.android.internal.jank.InteractionJankMonitor

private const val TAG = "ViewDialogLaunchAnimatorController"

/** A [DialogLaunchAnimator.Controller] that can animate a [View] from/to a dialog. */
class ViewDialogLaunchAnimatorController
internal constructor(
@@ -42,8 +45,14 @@ internal constructor(

        // Create a temporary ghost of the source (which will make it invisible) and add it
        // to the host dialog.
        if (source.parent !is ViewGroup) {
            // This should usually not happen, but let's make sure we don't call GhostView.addGhost
            // and crash if the view was detached right before we started the animation.
            Log.w(TAG, "source was detached right before drawing was moved to overlay")
        } else {
            GhostView.addGhost(source, viewGroup)
        }
    }

    override fun stopDrawingInOverlay() {
        // Note: here we should remove the ghost from the overlay, but in practice this is