Fix racy static initializers in FileDescriptor and UnixChannelFactory
- We forgot to update SharedSecrets from upstreaam to initialize
javaIOFileDescriptorAccess, or we didn't have a proper way to
replace the method Unsafe.ensureClassInitialized.
- Upstream ensures that the field javaIOFileDescriptorAccess is not null
by calling Unsafe.ensureClassInitialized(FileDescriptor.class).
But Unsafe.ensureClassInitialized isn't supported in Android. Use
Class.forName to initialize the FileDescriptor class.
Bug: 80495283
Test: Cherrypicked this CL onto the branch where the problem was occurring.
"./test/testrunner/testrunner.py --host -b --t 071-dexfile-map-clean --64"
The test fails before the change and is passing now.
Test: cts-tradefed run cts-dev -m CtsLibcoreTestCases -t libcore.sun.misc.SharedSecretsTest
Change-Id: I77aec40f9a82416666b3c57fdde7c642aa0f419e
2 files changed