Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c0bfbb2 authored by Lee Shombert's avatar Lee Shombert
Browse files

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
parent eb1109d0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment