Avoid debug check violation in thread registration.

Bug: 13757855
Change-Id: Ied83a7fc43e2b9a89a8b99aa4f74069ef8a369b1
Merge "Avoid debug check violation in thread registration."
Merge remote-tracking branch 'aosp/master' into slim-master