Make shutdown logging thread-safe

Previously TRON_METRICS/SHUTDOWN_TIMINGS_LOG were accessed from
different threads. Now all access is properly synchronized.

Important: Moved saveMetrics from rebootOrShutdown. rebootOrShutdown
can be called directly from SystemServer class after reboot when
no metrics were collected.

Test: manual reboot/shutdown and verify that metrics are logged
Bug: 64815357
Change-Id: I7b02c9c6b10b920ce3532a0808ab71a0d6e07d2b
1 file changed