Clean up resource correctly when client died.

Add proper lock to make sure that all resources would be cleaned
up for a client if the client died. Also add check and not to
allocate resources for an already dead client.

Test: atest DefaultVehicleHalTest.
Run manually and do not see 'failed to call callback' messages.
Bug: 221500501

Change-Id: I1c799a6234017b976e7776537ab91526e785b9b4
5 files changed