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

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

Change-Id: I68abe32f6412b3b7a0644b7be85a0b21d8534128