Fix flags_test flakiness

The tests could run in parallel and step on eachothers logic by
setting/resetting global properties.

Revamp the logic to generate unique property names using scratch
files to prevent collisions.

Test: gtest
Bug: 190150217
Bug: 181748174
Change-Id: If870478e13dcfa2487da57b223b322847e702ea2
3 files changed