[automerger skipped] Merge "More fixes towards the race conditions in AMS" into oc-mr1-dev am: 239ab1c9d6 -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: Ic6abfc0ae396a514e7712c6fbc65662152cd1165