Allow perfetto traces to be collected only when the test fail This prevents us from collecting traves for passing tests, when the traces are used only to debug failures, saving storage. Bug: 315865546 Test: atest ui-trace-collector-test:DefaultUITraceListenerTest --rerun-until-failure 100 Change-Id: I5a98cb4f0f6300ebc6a84f04f2c973fc895a2344