This patch uses the binder token represented by the callback
to communicate the identity of the AutoOnOffKeepalive through
the alarm mechanism. This is a lot more robust and easy to
understand.
Addressing this, on top of the robustness and readability
advantages, corrects three bugs.
• The |obj| in the message to CMD_MONITOR_AUTOMATIC_KEEPALIVE
is now the binder token both on the sender side and the
receiver side, while the previous code had a Network in the
sender while the receiver expected AutoOnOffKeepalive,
crashing the system server with a wrong cast.
• The intent sent in the alarm would have a yet-uninitialized
value for the slot, so it would not be possible to find the
auto keepalive when the alarm fires.
• When the slot is reassigned, the alarm continued to fire
with the same slot value, so the auto keepalive would no
longer be found after a pause/resume cycle that would
change the slot.
Test: FrameworksNetTests
Change-Id: Ibdbfcd884e0d3559206cbaae7b6b7a524972c3ca