Merge "Fix NPE in DialogLaunchAnimator" into tm-qpr-dev am: 120867a3c9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20608947 Change-Id: I34450518262a6509999b1a2e73e87bd4bb716b26 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -75,7 +75,7 @@ constructor(
|
||||
*/
|
||||
interface Controller {
|
||||
/** The [ViewRootImpl] of this controller. */
|
||||
val viewRoot: ViewRootImpl
|
||||
val viewRoot: ViewRootImpl?
|
||||
|
||||
/**
|
||||
* The identity object of the source animated by this controller. This animator will ensure
|
||||
@@ -807,15 +807,17 @@ private class AnimatedDialog(
|
||||
* inversely, removed from the overlay when the source is moved back to its original position).
|
||||
*/
|
||||
private fun synchronizeNextDraw(then: () -> Unit) {
|
||||
if (forceDisableSynchronization) {
|
||||
// Don't synchronize when inside an automated test.
|
||||
val controllerRootView = controller.viewRoot?.view
|
||||
if (forceDisableSynchronization || controllerRootView == null) {
|
||||
// Don't synchronize when inside an automated test or if the controller root view is
|
||||
// detached.
|
||||
then()
|
||||
return
|
||||
}
|
||||
|
||||
ViewRootSync.synchronizeNextDraw(controller.viewRoot.view, decorView, then)
|
||||
ViewRootSync.synchronizeNextDraw(controllerRootView, decorView, then)
|
||||
decorView.invalidate()
|
||||
controller.viewRoot.view.invalidate()
|
||||
controllerRootView.invalidate()
|
||||
}
|
||||
|
||||
private fun findFirstViewGroupWithBackground(view: View): ViewGroup? {
|
||||
|
||||
@@ -28,7 +28,7 @@ internal constructor(
|
||||
private val source: View,
|
||||
override val cuj: DialogCuj?,
|
||||
) : DialogLaunchAnimator.Controller {
|
||||
override val viewRoot: ViewRootImpl
|
||||
override val viewRoot: ViewRootImpl?
|
||||
get() = source.viewRootImpl
|
||||
|
||||
override val sourceIdentity: Any = source
|
||||
|
||||
@@ -262,7 +262,7 @@ internal class ExpandableControllerImpl(
|
||||
|
||||
private fun dialogController(cuj: DialogCuj?): DialogLaunchAnimator.Controller {
|
||||
return object : DialogLaunchAnimator.Controller {
|
||||
override val viewRoot: ViewRootImpl = composeViewRoot.viewRootImpl
|
||||
override val viewRoot: ViewRootImpl? = composeViewRoot.viewRootImpl
|
||||
override val sourceIdentity: Any = this@ExpandableControllerImpl
|
||||
override val cuj: DialogCuj? = cuj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user