Fix issue where incorrect call state disables "Home" button.
There is a potential, due to multithreading, for a call to enter a ringing state, become disconnected, and then finally be added to Telecom where it will again be set to ringing. The PhoneWindowManager code uses the TelecomManager API to check if there is a ringing call and to determine if the home button should be disabled. The aforementioned circumstances result in the PhoneStateBroadcaster not properly tracking the current call state. It happens that the Telecom API isRinging method simply checks the current state in the PhoneStateBroadcaster. In the scenario for this but, the phone state is stuck in ringing, and as a result the home button remains disabled. This CL fixes this on 2 fronts: 1. Correct CallsManager onSuccessfulIncomingCall so that it will not automatically set the state of a new incoming call to ringing if it has already been disconnected (this will prevent PhoneStateBroadcaster from getting the wrong state). 2. Change the Teleco isRinging API to check CallsManager#hasRingingCall(), which will look at the list of currently tracked calls to determine whether there is a ringing call (regardless if the PhoneStateBroadcaster has a potentially inconsistent state). Bug: 25146970 Change-Id: I6273c72bac5fc7d91e16a8ff8aa12a7081089824
Loading
Please register or sign in to comment