Refactor leak tests

Change the code to not rely on debug mode compilation for D8/R8.

For R8 -dontoptimize is still required (default for tests) to avoid
inlining that could "revert" this change at compile time.

Test: m -j USE_R8=true SystemUITests
Test: Run tests and see failures from b/70879514 are gone

Bug: 70879514
Change-Id: Ic8bb2bd3a91da0ecb2ec4e40183f47e4daf6323c
2 files changed