Small modifications to AnrTimer
This change has three small modifications to AnrTimer:
1. In AnrTimer.start(), instead of testing if the timer exists before
canceling it, just cancel it. The cancel() method does the same
test internally. Starting a timer that is already running is a
restart: keep a count.
2. Remove an obsolete synchronization block around mTimerArgMap. The
code was left over from an older revision in which mTimerArgMap
was static.
3. Do not restart the ticker when a timer is canceled. Starting the
ticker is expensive and is inline with the cancel operation. In
normal operation the timer will not have to be restarted very
often at all.
Test: atest
* FrameworksServicesTests:AnrTimerTest
Flag: com.android.server.utils.anr_timer_service
Bug: 325594551
Change-Id: I929e51fec5fd433f4a636f372c39b3e9e2bc9b8f
2 files changed