Fix flags_test flakiness am: 14a5151ea4

Original change: https://android-review.googlesource.com/c/platform/art/+/1728330

Change-Id: Ia082c0aad9ee1ff9390adb1150ff41a19615df57