Statsd CTS: improve validation tests

On some devices, doing unplugDevice() automatically turns the screen on,
so when the screen is later turned off, an atom is logged and statsd
sees it. But on some devices, unplugDevice() doesn't turn the screen on;
therefore, nothing is logged when the screen is later told to turn off,
so statsd doesn't know the screen state and the tests fail. This fixes
that issue.

Moreover, testPartialWakelockDuration sometimes failed because it
assumed that resetBatteryStats() also clears BatteryStats's state, which
isn't true (it just resets the metrics' values to 0). This assumption is
removed.

Bug: 77916472
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.validation.ValidationTests#testPartialWakelockDuration
Change-Id: Idd2eb957b02864909a8d33d23bfaf6e049e03fc3
1 file changed