Undecoded jobject leaking in through attachThread

picked from
https://android-review.googlesource.com/#/c/23058/
Merge "Undecoded jobject leaking in through attachThread" into gingerbread