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
Merged-In: If870478e13dcfa2487da57b223b322847e702ea2
Change-Id: If870478e13dcfa2487da57b223b322847e702ea2
(cherry picked from commit 14a5151ea476d722b48aa58069451a48580998df)
3 files changed