Throwable: Revert unneeded changes from upstream 8u121-b13

Removes volatile from the backtrace field. It is not needed because the
backtrace field is only ever accessed from a synchronized block and it
is not accessed from native code.

Adds an assert in printEnclosedStackTrace() to check that the current
thread is synchronized on the PrintStream/PrintWriter to which the stack
trace is printed. The assert should always succeed as the only code
paths to the check synchronize correctly.

Bug: 35910877
Test: make checkbuild and run CtsLibcoreTestCases
Change-Id: Id0d49661f00c2886db732c85fce8088f2355db1b
1 file changed