Fix warning log in DialogLaunchAnimator

This CL fixes a warning log that is now logged every time a dialog is
launched from a View, instead of being logged only when launching from a
View that does not implement LaunchableView. This log was broken by the
refactoring of http://ag/20139844, which abstracted away the View we
launch from into a Controller.

Bug: 230830644
Test: Looked at logs during dialog launch
Change-Id: I9e7ee5bff4dbea109a8e53137a8613d5e5d4ef37
This commit is contained in:
Jordan Demeulenaere
2023-01-16 12:12:16 +01:00
parent 9758d71bd9
commit f05f5f9324
2 changed files with 8 additions and 4 deletions

View File

@@ -237,13 +237,17 @@ constructor(
openedDialogs.firstOrNull {
it.dialog.window.decorView.viewRootImpl == controller.viewRoot
}
val animateFrom =
val controller =
animatedParent?.dialogContentWithBackground?.let {
Controller.fromView(it, controller.cuj)
}
?: controller
if (animatedParent == null && animateFrom !is LaunchableView) {
if (
animatedParent == null &&
controller is ViewDialogLaunchAnimatorController &&
controller.source !is LaunchableView
) {
// Make sure the View we launch from implements LaunchableView to avoid visibility
// issues. Given that we don't own dialog decorViews so we can't enforce it for launches
// from a dialog.
@@ -272,7 +276,7 @@ constructor(
launchAnimator,
callback,
interactionJankMonitor,
animateFrom,
controller,
onDialogDismissed = { openedDialogs.remove(it) },
dialog = dialog,
animateBackgroundBoundsChange,

View File

@@ -25,7 +25,7 @@ import com.android.internal.jank.InteractionJankMonitor
/** A [DialogLaunchAnimator.Controller] that can animate a [View] from/to a dialog. */
class ViewDialogLaunchAnimatorController
internal constructor(
private val source: View,
internal val source: View,
override val cuj: DialogCuj?,
) : DialogLaunchAnimator.Controller {
override val viewRoot: ViewRootImpl?