Refactored CarWatchdogDeviceAppTest tests

- Refactored the writeToDisk logic, in order to handle multiple edge
  cases (e.g. InterruptedIOException, OOM issues).
- Added assertions to make sure the proper amount of bytes were written
  to the test file.

Test: atest --rerun-until-failure 10 CarWatchdogHostTest
Bug: 331988363
Change-Id: I3c9e3bbe2c6b0330e0f83afba821743740c6b5ec
1 file changed