Check window token when extending timeout
When the "no focused window" ANR is raised, the policy responds with a timeout. The timeout indicates whether or not to extend the ANR, and by how much. When we process the response from the policy, it is done in the 'commands' portion of the dispatch cycle. At that time, we already have lost the context about the ANR. We used to rely on the optional 'mNoFocusedWindowTimeout' being set to determine whether this is a 'no focused window' ANR. However, there's a better way to do this, by simply checking the inputs that were first provided to the policy. This way, we are free to modify 'mNoFocusedWindowTimeout' in other portions of the code. Other changes in this CL: * In 'onAnrLocked', we are assuming the connection is non-null, so let's pass it by reference. This will get us closer to the goal of using std::unique_ptr for the connection. * In 'InputDispatcher_test', when we had a missing ANR, we would go on to try to derefence a null (or empty) object. This caused crashes on hwasan build. Fix this by returning default pair when the error condition has been detected. Bug: 164754075 Test: atest inputflinger_tests Change-Id: I656315eda001f1fff31cd265eadce5397606b855
Loading
Please register or sign in to comment