From baca819d2666fb1bb0b3e71253d2cf0f144c52ca Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 29 Jan 2019 18:44:28 -0800 Subject: [PATCH] Null check before writing RemoteAnimationTarget proto Change-related variables are null when not changing, thus we need to check for that before trying to write them to proto Bug: 123538318 Test: ActivityLifecycleTopResumedStateTests#testTopPositionLostOnFinish passes Change-Id: I643c48621602b5203f7f64a9af0578273f115dbe --- core/java/android/view/RemoteAnimationTarget.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/RemoteAnimationTarget.java b/core/java/android/view/RemoteAnimationTarget.java index 1d2cf4b787567..9b3efe1381701 100644 --- a/core/java/android/view/RemoteAnimationTarget.java +++ b/core/java/android/view/RemoteAnimationTarget.java @@ -246,8 +246,12 @@ public class RemoteAnimationTarget implements Parcelable { position.writeToProto(proto, POSITION); sourceContainerBounds.writeToProto(proto, SOURCE_CONTAINER_BOUNDS); windowConfiguration.writeToProto(proto, WINDOW_CONFIGURATION); - startLeash.writeToProto(proto, START_LEASH); - startBounds.writeToProto(proto, START_BOUNDS); + if (startLeash != null) { + startLeash.writeToProto(proto, START_LEASH); + } + if (startBounds != null) { + startBounds.writeToProto(proto, START_BOUNDS); + } proto.end(token); }