Fixing a crash when doing lock profiling

This is a fix for a crash that can happen when logging Contention
events. This logging is performed when lock profiling is enabled.
This is by default enabled on userdebug builds. The crash happened
when a thread was being destroyed. When a thread is being
destroyed it is normal that the frame depth is zero, and thus the
current frame is null. logContentionEvent() requires that the
current frame is not null, or it will crash.

The fix is to check if the current frame is null, before calling
logContentionEvent().

original Id: I4c2b9ad94b663398645497fdffa1ec6f7ea86a51

picked from
https://android-review.googlesource.com/21321
Merge "Fixing a crash when doing lock profiling" into gingerbread