Merge "Prevent NPE while finishing activity" into rvc-dev am: 1dbee3e34b am: b9bd2da6f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11788494

Change-Id: I0e0f7cf0c8966b26644c176f1f57287e6d0efc51