From f05f5f9324a1641bc0ba347a686e2a809b5efbd8 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Mon, 16 Jan 2023 12:12:16 +0100 Subject: [PATCH] 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 --- .../android/systemui/animation/DialogLaunchAnimator.kt | 10 +++++++--- .../animation/ViewDialogLaunchAnimatorController.kt | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt index 9a9236be9c8a0..a3ed0856c60ae 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt @@ -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, diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ViewDialogLaunchAnimatorController.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ViewDialogLaunchAnimatorController.kt index 46d5a5c0af8c0..9257f99efe966 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/ViewDialogLaunchAnimatorController.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ViewDialogLaunchAnimatorController.kt @@ -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?