Correct JobServiceContext use of AnrTimer
This fixes two places in JobServiceContext that failed to correctly cancel a timer. The JobAnrTimer relies on an up-to-date value in mRunningCallback: in two places, mRunningCallback was set to null before the timer was canceled. This change cancels the timer before setting that attribute to null. AnrTimer itself now detects calls into the object that occur after the object has been closed. Calling start() on a closed object is a run-time error. Calling cancel(), discard(), or accept() on a close object is considered a permissible race condition and these calls are silently ignored. Tested with an instrumented build to verify that the JobServiceContext no longer generates any invalid timeouts. Flag: com.android.server.utils.anr_timer_for_job_service Bug: 408440679 Test: atest * FrameworksMockingServicesTests_com_android_server_job Change-Id: I3b3541ba287ab0b74da42571f467c61efd12b9ca
Loading
Please register or sign in to comment