Add support to sbox for only writing output files if they are changed
to support enabling restat. Move the clearing of the output directory
into sbox, and when write if changed is enabled delete obsolete output
files without deleting output files that will be replaced.
Enable restat for local metalava rules. Restat for metalava rules
run remotely is still blocked on b/183630617.
Bug: 222095735
Test: TestRuleBuilder_Build
Test: m SystemUI
Change-Id: If8fc47e711f4a6f43947ab69f17cccc8ba6ae61a