Remove alarm manager dependency from anomalyalarms

Anomaly alarms, which are used for prediction-base duration metric
anomaly detection, currently use alarm manager for setting alarms. This
can result in excessive binder calls to SCS to set/cancel the alarms if
the duration metric that the alarm is based on gets stopped/started in
quick succession.

To resolve this without losing precision, we can instead rely on the
flow of events into the statsd socket for this prediction. The socket
receives events very frequently, so there should be minimal (if any)
loss of precision, and we can remove the binder call entirely.

One concern is that we used to hold a wakelock when the alarm fired
(since alarm manager would hold a wakelock), and we now lose this
ability.

Test: atest statsd_test
Test: atest AnomalyDetectionTests
Bug: 161326200
Change-Id: If37e5c6ccd8efa4e822c70a0444fa6b5a31bebca
5 files changed