Manually merge preconditions sharding fix in mr1

Add fix from go/aog/288805 that was unable to merge into nyc-mr1-dev

Test: turn off screen lock for one of multiple devices, execute
"cts-tradefed run cts --shards 2"
Bug:30022329
Bug:31150255

Change-Id: Ic57eb0eb730202e26df91e8ce49c8220f3dd8b75
7 files changed