Skip to content
Commit e2612eb3 authored by Snild Dolkow's avatar Snild Dolkow Committed by Todd Kennedy
Browse files

Fix deadlock between AMS and EphemeralResolverConnection

The ActivityManagerService lock may be taken when calling into ERC
through ActivityStarter.startActivityMayWait().

At the same time, a PackageManagerService.getLastChosenActivity() call
could take the ERC lock and call unbindService(), requesting the AMS
lock.

Deadlock.

Solved by making sure to drop the ERC lock before calling into AMS.
This necessitated an extra state to prevent multiple callers from
clobbering the binding, so mIsBinding became mBindState.

The IDLE state means that nothing is currently binding.

The BINDING state means someone is initiating a bind, including the
wait() call thereafter.

The PENDING state means that bindService() has been called, but the
caller's timeout expired (i.e. the new caller may want to rebind).

Fixes: 63150916
Test: for x in $(seq 100); do adb shell am start  http://127.0.0.1/does-not-exist.html; adb shell input keyevent 3; done
Change-Id: I2cb5610a2277ef641f8e2d7f5ad1c4a72bb4f026
parent b3d487da
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment