TokenWatcher: fix bug in repeated calls to acquire().
The javadoc of TokenWatcher promised to implement repeated calls to acquire() with the same token as a no-op, but this wasn't the case. When acquire() is called repeatedly with the same token, its associated DeathRecipient object is replaced by a new one. The old DeathRecipient can therefore be destroyed. This is problematic because the finalizer of this DeathRecipient implementation calls release() on the same token, resulting in the token being released unexpectedly. In this CL we properly implement the documented no-op behavior. Bug: 68368071 Test: (First, cherry-pick to internal master) Test: cts-tradefed run cts-dev -m OsTest -t android.os.cts.TokenWatcherTest Test: CTS verifier > Managed provisioning > Device owner tests > LockTask UI Change-Id: Idfad7c88075a510ea1f8527b5a8620121a5dd7bb
Loading
Please register or sign in to comment