Prevent NPE due to race condition in CallAudioRouteStateMachine.
The existing code checked for mCallsManager.getForegroundCall() to be
null and then proceeds to invoke the same method after the null check.
Since CallAudioRouteStateMachine does not happen within the Telecom
lock in all cases, this means the foreground call can change between
calls to mCallsManager.getForegroundCall().
Caching the value ensures we use the same foreground call state for both
operations and avoids a potential NPE.
This is a rare occurrence failure and has only been seen in RTSI testing.
This is already fixed in the new CallAudioRouteController code path whose
flag is ramping up.
Flag: NONE bugfix to correct NPE
Test: Re-run unit tests and CTS tests.
Fixes: 365217452
Change-Id: Ibddb7118ece23c550bb83ac2ede1b9b3fee358d7
1 file changed