Fix APM race conditions in ServiceStateTracker

Root cause: When APM is turned on, SST waits for all data connections
to be disconnected before sending the power off request to the modem
and starts a timer to force power off the radio if data disconnection
takes too long. If the radio is powered on again before all connections
are disconnected, the radio power remains on, but the force power off
timer is not cleared. This causes us to send a false radio power off
request with a potentially incorrect emergency state, causing radio to
power off temporarily and interfere with calls immediately afterwards.

If data teardown is pending after APM and the radio is powered on,
cancel the pending radio power off timer. To prevent additional race
conditions, also synchronize all blocks where we modify the pending
radio power off state.

Bug: 235941750
Test: manual basic tests
Test: atest ServiceStateTrackerTest
Change-Id: I1f5503d2420f6e8449adadc6bc4100a37f35251a
Merged-In: I1f5503d2420f6e8449adadc6bc4100a37f35251a
(cherry picked from commit 9b9286746ec909e7507600c5bb24e495ae88ce74)
Merged-In: I1f5503d2420f6e8449adadc6bc4100a37f35251a
2 files changed