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

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

Change-Id: I77a74e7828652515b6bbd91becd2f30f405c633d