[automerger skipped] Merge "More fixes towards the race conditions in AMS" into oc-mr1-dev am: 239ab1c9d6 -s ours am: 03f7e9d6fc -s ours

am skip reason: Change-Id I6e0bdc8c02bab54f6278096b3a3acadd97c064c6 with SHA-1 9f8923d54a is in history

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

Change-Id: Idd0fd95bcddaeb5f1d964ca63f130bb15a2a9754