Use frozen state callback to drop listener alarms

Exact listener alarms are currently dropped few seconds after being in
cached to avoid a violation of the exactness guarantee if the app gets
frozen. Now that a callback from activity manager is available, it is
better to use it directly instead of a delayed handler message.

This also improves the efficiency of the logic by avoiding the linear
query in the MessageQueue on the main system-server handler thread
which can be quite busy.

Test: atest FrameworksMockingServicesTests:com.android.server.alarm

Bug: 324470945
Change-Id: I0a05259db98c63c0c17b98aa11a4e52bbdb73d67
5 files changed