[nfc] fix Abort message: 'Thread[25,tid=7578,Native,Thread*=0xb400007473adcb40,peer=0x77f80300,"disableInternal"] attempting to detach while still running code'

bug:379573882
link:https://partnerissuetracker.corp.google.com/u/0/issues/379573882
log:https://issuetracker.google.com/379573882#attachment60885339

Try to improve the ScopedAttach method and try to avoid the problems caused by it (Although the probability of this is very small, it does happen).

Change-Id: I76963320bc2fba863032c82006982ccac2e38bcb
1 file changed